packages feed

netrium-0.6.0: examples/ForwardTrade2.contract

contract =
    forward'
        (initialMarginFee <> exchangeFee 100)
        (Market gas thm nbp)
        vol1
        0.45 gbp cash
        -- delivering gas every 30 minutes, with a 30 min duration.
        [ datetime 2011 1 day  hour min
        | day  <- [1..31]
        , hour <- [0..23]
        , min  <- [0, 30] ]
        (duration 0 30 0)


forward' :: FeeCalc
         -> Market
         -> Volume
         -> Price -> Currency -> CashFlowType
         -> Schedule -> Duration
         -> Contract
forward' fee market vol pr cur cft sch dur =
        give (calcFee fee vol pr cur sch)
  `and`
        allOf
          [ when (at t) $    physicalWith vol market (withDuration dur)
                       `and` give (financial (vol * pr) cur cft)
          | t <- sch ]