{-# LINE 1 "./QuantLib/Instrument/Energy.chs" #-}
module QuantLib.Instrument.Energy
(
GenCommodity
, Commodity
, GenEnergyCommodity
, EnergyCommodity
, GenEnergySwap
, EnergySwap
, EnergyFuture
, EnergyVanillaSwap
, EnergyBasisSwap
, SecondaryCosts
, SecondaryCostAmounts
, PricingErrorLevel(..)
, PricingError(..)
, PricingErrors
, EnergyDailyPosition(..)
, EnergyDailyPositions
, CommodityCashFlow
, CommodityCashFlows
, DeliverySchedule(..)
, QuantityPeriodicity(..)
, energyFuture
, energyVanillaSwap
, energyBasisSwap
, createPricingPeriods
, addPricingError
, discountedAmount
, undiscountedAmount
, discountedPaymentAmount
, undiscountedPaymentAmount
, discountFactor
, paymentDiscountFactor
, finalized
, secondaryCostAmounts
, pricingErrors
, quantity
, dailyPositions
, paymentCashFlows
) where
import qualified Foreign.C.String as C2HSImp
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import qualified System.IO.Unsafe as C2HSImp
import QuantLib.Internal
import QuantLib.Internal.Type
import QuantLib.Internal.Common
import QuantLib.Commodity
import Foreign.Marshal.Alloc(alloca)
import Foreign.Marshal.Utils(fromBool)
{-# LINE 66 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 67 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 68 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 69 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 70 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 71 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 72 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 73 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 74 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 75 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 76 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 77 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 78 "./QuantLib/Instrument/Energy.chs" #-}
{-# LINE 79 "./QuantLib/Instrument/Energy.chs" #-}
type SecondaryCosts = [(String, Either CommodityUnitCost (Double, Currency))]
type SecondaryCostAmounts = [(String, (Double, Currency))]
data PricingError = PricingError
{ PricingError -> PricingErrorLevel
pricingErrorLevel :: PricingErrorLevel
, PricingError -> String
pricingErrorMessage :: String
, PricingError -> String
pricingErrorDetail :: String
} deriving (Int -> PricingError -> ShowS
[PricingError] -> ShowS
PricingError -> String
(Int -> PricingError -> ShowS)
-> (PricingError -> String)
-> ([PricingError] -> ShowS)
-> Show PricingError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PricingError -> ShowS
showsPrec :: Int -> PricingError -> ShowS
$cshow :: PricingError -> String
show :: PricingError -> String
$cshowList :: [PricingError] -> ShowS
showList :: [PricingError] -> ShowS
Show, PricingError -> PricingError -> Bool
(PricingError -> PricingError -> Bool)
-> (PricingError -> PricingError -> Bool) -> Eq PricingError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PricingError -> PricingError -> Bool
== :: PricingError -> PricingError -> Bool
$c/= :: PricingError -> PricingError -> Bool
/= :: PricingError -> PricingError -> Bool
Eq)
type PricingErrors = [PricingError]
data EnergyDailyPosition = EnergyDailyPosition
{ EnergyDailyPosition -> Day
edpDate :: Day
, EnergyDailyPosition -> Double
edpQuantityAmount :: Double
, EnergyDailyPosition -> Double
edpPayLegPrice :: Double
, EnergyDailyPosition -> Double
edpReceiveLegPrice :: Double
, EnergyDailyPosition -> Double
edpRiskDelta :: Double
, EnergyDailyPosition -> Bool
edpUnrealized :: Bool
} deriving (Int -> EnergyDailyPosition -> ShowS
[EnergyDailyPosition] -> ShowS
EnergyDailyPosition -> String
(Int -> EnergyDailyPosition -> ShowS)
-> (EnergyDailyPosition -> String)
-> ([EnergyDailyPosition] -> ShowS)
-> Show EnergyDailyPosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EnergyDailyPosition -> ShowS
showsPrec :: Int -> EnergyDailyPosition -> ShowS
$cshow :: EnergyDailyPosition -> String
show :: EnergyDailyPosition -> String
$cshowList :: [EnergyDailyPosition] -> ShowS
showList :: [EnergyDailyPosition] -> ShowS
Show, EnergyDailyPosition -> EnergyDailyPosition -> Bool
(EnergyDailyPosition -> EnergyDailyPosition -> Bool)
-> (EnergyDailyPosition -> EnergyDailyPosition -> Bool)
-> Eq EnergyDailyPosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EnergyDailyPosition -> EnergyDailyPosition -> Bool
== :: EnergyDailyPosition -> EnergyDailyPosition -> Bool
$c/= :: EnergyDailyPosition -> EnergyDailyPosition -> Bool
/= :: EnergyDailyPosition -> EnergyDailyPosition -> Bool
Eq)
type EnergyDailyPositions = [EnergyDailyPosition]
type CommodityCashFlows = [CommodityCashFlow]
discountedAmount :: (CommodityCashFlow) -> IO ((Double), (Currency))
discountedAmount :: CommodityCashFlow -> IO (Double, Currency)
discountedAmount CommodityCashFlow
a1 =
CommodityCashFlow
-> (Ptr CCommodityCashFlow' -> IO (Double, Currency))
-> IO (Double, Currency)
forall b.
CommodityCashFlow -> (Ptr CCommodityCashFlow' -> IO b) -> IO b
withCommodityCashFlow CommodityCashFlow
a1 ((Ptr CCommodityCashFlow' -> IO (Double, Currency))
-> IO (Double, Currency))
-> (Ptr CCommodityCashFlow' -> IO (Double, Currency))
-> IO (Double, Currency)
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityCashFlow'
a1' ->
(Ptr (Ptr CCurrency) -> IO (Double, Currency))
-> IO (Double, Currency)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr CCurrency) -> IO (Double, Currency))
-> IO (Double, Currency))
-> (Ptr (Ptr CCurrency) -> IO (Double, Currency))
-> IO (Double, Currency)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CCurrency)
a2' ->
(Ptr (Ptr CChar) -> IO (Double, Currency)) -> IO (Double, Currency)
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO (Double, Currency))
-> IO (Double, Currency))
-> (Ptr (Ptr CChar) -> IO (Double, Currency))
-> IO (Double, Currency)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a3' ->
Ptr CCommodityCashFlow'
-> Ptr (Ptr CCurrency) -> Ptr (Ptr CChar) -> IO CDouble
discountedAmount'_ Ptr CCommodityCashFlow'
a1' Ptr (Ptr CCurrency)
a2' Ptr (Ptr CChar)
a3' IO CDouble
-> (CDouble -> IO (Double, Currency)) -> IO (Double, Currency)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CCurrency) -> IO Currency
peekCurrencyPtr Ptr (Ptr CCurrency)
a2'IO Currency
-> (Currency -> IO (Double, Currency)) -> IO (Double, Currency)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Currency
a2'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a3'IO () -> IO (Double, Currency) -> IO (Double, Currency)
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
(Double, Currency) -> IO (Double, Currency)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res', Currency
a2'')
{-# LINE 123 "./QuantLib/Instrument/Energy.chs" #-}
undiscountedAmount :: (CommodityCashFlow) -> IO ((Double), (Currency))
undiscountedAmount a1 =
withCommodityCashFlow a1 $ \a1' ->
alloca $ \a2' ->
preErrorCheck $ \a3' ->
undiscountedAmount'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
peekCurrencyPtr a2'>>= \a2'' ->
errorCheck a3'>>
return (res', a2'')
{-# LINE 126 "./QuantLib/Instrument/Energy.chs" #-}
discountedPaymentAmount :: (CommodityCashFlow) -> IO ((Double), (Currency))
discountedPaymentAmount a1 =
withCommodityCashFlow a1 $ \a1' ->
alloca $ \a2' ->
preErrorCheck $ \a3' ->
discountedPaymentAmount'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
peekCurrencyPtr a2'>>= \a2'' ->
errorCheck a3'>>
return (res', a2'')
{-# LINE 129 "./QuantLib/Instrument/Energy.chs" #-}
undiscountedPaymentAmount :: (CommodityCashFlow) -> IO ((Double), (Currency))
undiscountedPaymentAmount a1 =
withCommodityCashFlow a1 $ \a1' ->
alloca $ \a2' ->
preErrorCheck $ \a3' ->
undiscountedPaymentAmount'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
peekCurrencyPtr a2'>>= \a2'' ->
errorCheck a3'>>
return (res', a2'')
{-# LINE 132 "./QuantLib/Instrument/Energy.chs" #-}
discountFactor :: (CommodityCashFlow) -> (Double)
discountFactor a1 =
C2HSImp.unsafePerformIO $
withCommodityCashFlow a1 $ \a1' ->
discountFactor'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 135 "./QuantLib/Instrument/Energy.chs" #-}
paymentDiscountFactor :: (CommodityCashFlow) -> (Double)
paymentDiscountFactor a1 =
C2HSImp.unsafePerformIO $
withCommodityCashFlow a1 $ \a1' ->
paymentDiscountFactor'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 138 "./QuantLib/Instrument/Energy.chs" #-}
finalized :: (CommodityCashFlow) -> (Bool)
finalized a1 =
C2HSImp.unsafePerformIO $
withCommodityCashFlow a1 $ \a1' ->
finalized'_ a1' >>= \res ->
let {res' = C2HSImp.toBool res} in
return (res')
{-# LINE 141 "./QuantLib/Instrument/Energy.chs" #-}
addPricingError :: (GenCommodity c) -> (PricingErrorLevel) -> (String) -> (String) -> IO ()
addPricingError a1 a2 a3 a4 =
withCommodity a1 $ \a1' ->
let {a2' = fromEnumC a2} in
C2HSImp.withCString a3 $ \a3' ->
C2HSImp.withCString a4 $ \a4' ->
addPricingError'_ a1' a2' a3' a4' >>
return ()
{-# LINE 150 "./QuantLib/Instrument/Energy.chs" #-}
qlCommoditySecondaryCostAmounts_ :: (GenCommodity c) -> IO (([String]), ([Double]), ([Currency]))
qlCommoditySecondaryCostAmounts_ a1 =
withCommodity a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preArray $ \(a3'1, a3'2) ->
preArray $ \(a4'1, a4'2) ->
preErrorCheck $ \a5' ->
qlCommoditySecondaryCostAmounts_'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5' >>
peekCStringArray a2'1 a2'2>>= \a2'' ->
peekDoubleArray a3'1 a3'2>>= \a3'' ->
peekCurrencyArray a4'1 a4'2>>= \a4'' ->
errorCheck a5'>>
return (a2'', a3'', a4'')
{-# LINE 157 "./QuantLib/Instrument/Energy.chs" #-}
secondaryCostAmounts :: GenCommodity c -> IO SecondaryCostAmounts
secondaryCostAmounts o = do
(keys, amts, ccys) <- qlCommoditySecondaryCostAmounts_ o
pure $ zip keys (zip amts ccys)
qlCommodityPricingErrors_ :: (GenCommodity c) -> IO (([PricingErrorLevel]), ([String]), ([String]))
qlCommodityPricingErrors_ :: forall c.
GenCommodity c -> IO ([PricingErrorLevel], [String], [String])
qlCommodityPricingErrors_ GenCommodity c
a1 =
GenCommodity c
-> (Ptr CCommodity'
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall c b. GenCommodity c -> (Ptr CCommodity' -> IO b) -> IO b
withCommodity GenCommodity c
a1 ((Ptr CCommodity' -> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String]))
-> (Ptr CCommodity'
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodity'
a1' ->
((Ptr CUInt, Ptr (Ptr CInt))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String]))
-> ((Ptr CUInt, Ptr (Ptr CInt))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a2'1, Ptr (Ptr CInt)
a2'2) ->
((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String]))
-> ((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a3'1, Ptr (Ptr (Ptr CChar))
a3'2) ->
((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String]))
-> ((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a4'1, Ptr (Ptr (Ptr CChar))
a4'2) ->
(Ptr (Ptr CChar) -> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String]))
-> (Ptr (Ptr CChar)
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a5' ->
Ptr CCommodity'
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CUInt
-> Ptr (Ptr (Ptr CChar))
-> Ptr CUInt
-> Ptr (Ptr (Ptr CChar))
-> Ptr (Ptr CChar)
-> IO ()
qlCommodityPricingErrors_'_ Ptr CCommodity'
a1' Ptr CUInt
a2'1 Ptr (Ptr CInt)
a2'2 Ptr CUInt
a3'1 Ptr (Ptr (Ptr CChar))
a3'2 Ptr CUInt
a4'1 Ptr (Ptr (Ptr CChar))
a4'2 Ptr (Ptr CChar)
a5' IO () -> IO [PricingErrorLevel] -> IO [PricingErrorLevel]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> Ptr (Ptr CInt) -> IO [PricingErrorLevel]
peekPricingErrorLevelArray Ptr CUInt
a2'1 Ptr (Ptr CInt)
a2'2IO [PricingErrorLevel]
-> ([PricingErrorLevel]
-> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[PricingErrorLevel]
a2'' ->
Ptr CUInt -> Ptr (Ptr (Ptr CChar)) -> IO [String]
peekCStringArray Ptr CUInt
a3'1 Ptr (Ptr (Ptr CChar))
a3'2IO [String]
-> ([String] -> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[String]
a3'' ->
Ptr CUInt -> Ptr (Ptr (Ptr CChar)) -> IO [String]
peekCStringArray Ptr CUInt
a4'1 Ptr (Ptr (Ptr CChar))
a4'2IO [String]
-> ([String] -> IO ([PricingErrorLevel], [String], [String]))
-> IO ([PricingErrorLevel], [String], [String])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[String]
a4'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a5'IO ()
-> IO ([PricingErrorLevel], [String], [String])
-> IO ([PricingErrorLevel], [String], [String])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
([PricingErrorLevel], [String], [String])
-> IO ([PricingErrorLevel], [String], [String])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([PricingErrorLevel]
a2'', [String]
a3'', [String]
a4'')
{-# LINE 172 "./QuantLib/Instrument/Energy.chs" #-}
pricingErrors :: GenCommodity c -> IO PricingErrors
pricingErrors o = do
(levels, errs, details) <- qlCommodityPricingErrors_ o
pure $ zipWith3 PricingError levels errs details
qlEnergyCommodityQuantity_ :: (GenEnergyCommodity e) -> IO ((Double), (CommodityType), (UnitOfMeasure))
qlEnergyCommodityQuantity_ :: forall e.
GenEnergyCommodity e -> IO (Double, CommodityType, UnitOfMeasure)
qlEnergyCommodityQuantity_ GenEnergyCommodity e
a1 =
GenEnergyCommodity e
-> (Ptr CEnergyCommodity'
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall e b.
GenEnergyCommodity e -> (Ptr CEnergyCommodity' -> IO b) -> IO b
withEnergyCommodity GenEnergyCommodity e
a1 ((Ptr CEnergyCommodity'
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure))
-> (Ptr CEnergyCommodity'
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. (a -> b) -> a -> b
$ \Ptr CEnergyCommodity'
a1' ->
(Ptr (Ptr CCommodityType)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr CCommodityType)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure))
-> (Ptr (Ptr CCommodityType)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CCommodityType)
a2' ->
(Ptr (Ptr CUnitOfMeasure)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr CUnitOfMeasure)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure))
-> (Ptr (Ptr CUnitOfMeasure)
-> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CUnitOfMeasure)
a3' ->
(Ptr (Ptr CChar) -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure))
-> (Ptr (Ptr CChar) -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a4' ->
Ptr CEnergyCommodity'
-> Ptr (Ptr CCommodityType)
-> Ptr (Ptr CUnitOfMeasure)
-> Ptr (Ptr CChar)
-> IO CDouble
qlEnergyCommodityQuantity_'_ Ptr CEnergyCommodity'
a1' Ptr (Ptr CCommodityType)
a2' Ptr (Ptr CUnitOfMeasure)
a3' Ptr (Ptr CChar)
a4' IO CDouble
-> (CDouble -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CCommodityType) -> IO CommodityType
peekCommodityTypePtr Ptr (Ptr CCommodityType)
a2'IO CommodityType
-> (CommodityType -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CommodityType
a2'' ->
Ptr (Ptr CUnitOfMeasure) -> IO UnitOfMeasure
peekUnitOfMeasurePtr Ptr (Ptr CUnitOfMeasure)
a3'IO UnitOfMeasure
-> (UnitOfMeasure -> IO (Double, CommodityType, UnitOfMeasure))
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \UnitOfMeasure
a3'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a4'IO ()
-> IO (Double, CommodityType, UnitOfMeasure)
-> IO (Double, CommodityType, UnitOfMeasure)
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
(Double, CommodityType, UnitOfMeasure)
-> IO (Double, CommodityType, UnitOfMeasure)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GenEnergyCommodity e
(Double
res', CommodityType
a2'', UnitOfMeasure
a3'')
{-# LINE 185 "./QuantLib/Instrument/Energy.chs" #-}
quantity :: GenEnergyCommodity e -> IO Quantity
quantity o = do
(amt, ct, uom) <- qlEnergyCommodityQuantity_ o
pure (ct, uom, amt)
energyFuture :: Int
-> Quantity
-> CommodityUnitCost
-> CommodityIndex
-> CommodityType
-> SecondaryCosts
-> IO EnergyFuture
energyFuture :: Int
-> Quantity
-> CommodityUnitCost
-> CommodityIndex
-> CommodityType
-> SecondaryCosts
-> IO EnergyFuture
energyFuture Int
buySell (CommodityType
qCt, UnitOfMeasure
qUom, Double
qAmt) (Double
tpAmt, Currency
tpCcy, UnitOfMeasure
tpUom) CommodityIndex
index CommodityType
cmdType SecondaryCosts
secCosts =
Int
-> CommodityType
-> UnitOfMeasure
-> Double
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityIndex
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> IO EnergyFuture
qlEnergyFuture_ Int
buySell CommodityType
qCt UnitOfMeasure
qUom Double
qAmt Double
tpAmt Currency
tpCcy UnitOfMeasure
tpUom CommodityIndex
index CommodityType
cmdType
[String]
scKeys [Bool]
scIsUnitCost [Double]
scAmts [Currency]
scCcys [Maybe UnitOfMeasure]
scUoms
where ([String]
scKeys, [Bool]
scIsUnitCost, [Double]
scAmts, [Currency]
scCcys, [Maybe UnitOfMeasure]
scUoms) = SecondaryCosts
-> ([String], [Bool], [Double], [Currency], [Maybe UnitOfMeasure])
secondaryCostsFields SecondaryCosts
secCosts
qlEnergyFuture_ :: (Int) -> (CommodityType) -> (UnitOfMeasure) -> (Double) -> (Double) -> (Currency) -> (UnitOfMeasure) -> (CommodityIndex) -> (CommodityType) -> ([String]) -> ([Bool]) -> ([Double]) -> ([Currency]) -> ([Maybe UnitOfMeasure]) -> IO ((EnergyFuture))
qlEnergyFuture_ :: Int
-> CommodityType
-> UnitOfMeasure
-> Double
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityIndex
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> IO EnergyFuture
qlEnergyFuture_ Int
a1 CommodityType
a2 UnitOfMeasure
a3 Double
a4 Double
a5 Currency
a6 UnitOfMeasure
a7 CommodityIndex
a8 CommodityType
a9 [String]
a10 [Bool]
a11 [Double]
a12 [Currency]
a13 [Maybe UnitOfMeasure]
a14 =
let {a1' :: CInt
a1' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1} in
CommodityType
-> (Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture
forall b. CommodityType -> (Ptr CCommodityType -> IO b) -> IO b
withCommodityType CommodityType
a2 ((Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityType
a2' ->
UnitOfMeasure
-> (Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture
forall b. UnitOfMeasure -> (Ptr CUnitOfMeasure -> IO b) -> IO b
withUnitOfMeasure UnitOfMeasure
a3 ((Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CUnitOfMeasure
a3' ->
let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in
let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in
Currency -> (Ptr CCurrency -> IO EnergyFuture) -> IO EnergyFuture
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a6 ((Ptr CCurrency -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CCurrency -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a6' ->
UnitOfMeasure
-> (Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture
forall b. UnitOfMeasure -> (Ptr CUnitOfMeasure -> IO b) -> IO b
withUnitOfMeasure UnitOfMeasure
a7 ((Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CUnitOfMeasure -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CUnitOfMeasure
a7' ->
CommodityIndex
-> (Ptr CCommodityIndex' -> IO EnergyFuture) -> IO EnergyFuture
forall b. CommodityIndex -> (Ptr CCommodityIndex' -> IO b) -> IO b
withCommodityIndex CommodityIndex
a8 ((Ptr CCommodityIndex' -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CCommodityIndex' -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityIndex'
a8' ->
CommodityType
-> (Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture
forall b. CommodityType -> (Ptr CCommodityType -> IO b) -> IO b
withCommodityType CommodityType
a9 ((Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr CCommodityType -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityType
a9' ->
[String]
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyFuture) -> IO EnergyFuture
forall b. [String] -> ((CUInt, Ptr (Ptr CChar)) -> IO b) -> IO b
withStringArray [String]
a10 (((CUInt, Ptr (Ptr CChar)) -> IO EnergyFuture) -> IO EnergyFuture)
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \(CUInt
a10'1, Ptr (Ptr CChar)
a10'2) ->
[Bool] -> ((CUInt, Ptr CInt) -> IO EnergyFuture) -> IO EnergyFuture
forall b. [Bool] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withBoolArray [Bool]
a11 (((CUInt, Ptr CInt) -> IO EnergyFuture) -> IO EnergyFuture)
-> ((CUInt, Ptr CInt) -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr CInt
a11'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO EnergyFuture) -> IO EnergyFuture
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a12 (((CUInt, Ptr CDouble) -> IO EnergyFuture) -> IO EnergyFuture)
-> ((CUInt, Ptr CDouble) -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \(CUInt
a12'1, Ptr CDouble
a12'2) ->
[Currency]
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyFuture)
-> IO EnergyFuture
forall b.
[Currency] -> ((CUInt, Ptr (Ptr CCurrency)) -> IO b) -> IO b
withCurrencyArray [Currency]
a13 (((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyFuture)
-> IO EnergyFuture)
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyFuture)
-> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \(CUInt
a13'1, Ptr (Ptr CCurrency)
a13'2) ->
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyFuture)
-> IO EnergyFuture
forall b.
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO b) -> IO b
withMaybeUnitOfMeasureArray [Maybe UnitOfMeasure]
a14 (((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyFuture)
-> IO EnergyFuture)
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyFuture)
-> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \(CUInt
a14'1, Ptr (Ptr CUnitOfMeasure)
a14'2) ->
(Ptr (Ptr CChar) -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO EnergyFuture) -> IO EnergyFuture)
-> (Ptr (Ptr CChar) -> IO EnergyFuture) -> IO EnergyFuture
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a15' ->
CInt
-> Ptr CCommodityType
-> Ptr CUnitOfMeasure
-> CDouble
-> CDouble
-> Ptr CCurrency
-> Ptr CUnitOfMeasure
-> Ptr CCommodityIndex'
-> Ptr CCommodityType
-> CUInt
-> Ptr (Ptr CChar)
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr (Ptr CCurrency)
-> CUInt
-> Ptr (Ptr CUnitOfMeasure)
-> Ptr (Ptr CChar)
-> IO (Ptr CEnergyFuture')
qlEnergyFuture_'_ CInt
a1' Ptr CCommodityType
a2' Ptr CUnitOfMeasure
a3' CDouble
a4' CDouble
a5' Ptr CCurrency
a6' Ptr CUnitOfMeasure
a7' Ptr CCommodityIndex'
a8' Ptr CCommodityType
a9' CUInt
a10'1 Ptr (Ptr CChar)
a10'2 CUInt
a11'1 Ptr CInt
a11'2 CUInt
a12'1 Ptr CDouble
a12'2 CUInt
a13'1 Ptr (Ptr CCurrency)
a13'2 CUInt
a14'1 Ptr (Ptr CUnitOfMeasure)
a14'2 Ptr (Ptr CChar)
a15' IO (Ptr CEnergyFuture')
-> (Ptr CEnergyFuture' -> IO EnergyFuture) -> IO EnergyFuture
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CEnergyFuture'
res ->
Ptr CEnergyFuture' -> IO EnergyFuture
peekEnergyFuture Ptr CEnergyFuture'
res IO EnergyFuture
-> (EnergyFuture -> IO EnergyFuture) -> IO EnergyFuture
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \EnergyFuture
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a15'IO () -> IO EnergyFuture -> IO EnergyFuture
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
EnergyFuture -> IO EnergyFuture
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (EnergyFuture
res')
{-# LINE 223 "./QuantLib/Instrument/Energy.chs" #-}
qlEnergySwapDailyPositions_ :: (GenEnergySwap s) -> IO (([Day]), ([Double]), ([Double]), ([Double]), ([Double]), ([Bool]))
qlEnergySwapDailyPositions_ a1 =
withEnergySwap a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preArray $ \(a3'1, a3'2) ->
preArray $ \(a4'1, a4'2) ->
preArray $ \(a5'1, a5'2) ->
preArray $ \(a6'1, a6'2) ->
preArray $ \(a7'1, a7'2) ->
preErrorCheck $ \a8' ->
qlEnergySwapDailyPositions_'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8' >>
peekDayArray a2'1 a2'2>>= \a2'' ->
peekDoubleArray a3'1 a3'2>>= \a3'' ->
peekDoubleArray a4'1 a4'2>>= \a4'' ->
peekDoubleArray a5'1 a5'2>>= \a5'' ->
peekDoubleArray a6'1 a6'2>>= \a6'' ->
peekBoolArray a7'1 a7'2>>= \a7'' ->
errorCheck a8'>>
return (a2'', a3'', a4'', a5'', a6'', a7'')
{-# LINE 233 "./QuantLib/Instrument/Energy.chs" #-}
dailyPositions :: GenEnergySwap s -> IO EnergyDailyPositions
dailyPositions s = do
(dates, qtyAmts, payPrices, recvPrices, riskDeltas, unrealized) <- qlEnergySwapDailyPositions_ s
pure $ zipWith6 EnergyDailyPosition dates qtyAmts payPrices recvPrices riskDeltas unrealized
paymentCashFlows :: (GenEnergySwap s) -> IO (([CommodityCashFlow]))
paymentCashFlows a1 =
withEnergySwap a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
paymentCashFlows'_ a1' a2'1 a2'2 a3' >>
peekCommodityCashFlowArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 247 "./QuantLib/Instrument/Energy.chs" #-}
secondaryCostsFields :: SecondaryCosts -> ([String], [Bool], [Double], [Currency], [Maybe UnitOfMeasure])
secondaryCostsFields entries =
( map fst entries
, map (either (const True) (const False) . snd) entries
, map (either (\(a,_,_) -> a) fst . snd) entries
, map (either (\(_,c,_) -> c) snd . snd) entries
, map (either (\(_,_,u) -> Just u) (const Nothing) . snd) entries
)
pricingPeriodsFields :: PricingPeriods -> ([Day], [Day], [Day], [CommodityType], [UnitOfMeasure], [Double])
pricingPeriodsFields :: PricingPeriods
-> ([Day], [Day], [Day], [CommodityType], [UnitOfMeasure],
[Double])
pricingPeriodsFields PricingPeriods
pps =
( (PricingPeriod -> Day) -> PricingPeriods -> [Day]
forall a b. (a -> b) -> [a] -> [b]
map PricingPeriod -> Day
pricingPeriodStartDate PricingPeriods
pps
, (PricingPeriod -> Day) -> PricingPeriods -> [Day]
forall a b. (a -> b) -> [a] -> [b]
map PricingPeriod -> Day
pricingPeriodEndDate PricingPeriods
pps
, (PricingPeriod -> Day) -> PricingPeriods -> [Day]
forall a b. (a -> b) -> [a] -> [b]
map PricingPeriod -> Day
pricingPeriodPaymentDate PricingPeriods
pps
, (Quantity -> CommodityType) -> [Quantity] -> [CommodityType]
forall a b. (a -> b) -> [a] -> [b]
map (\(CommodityType
t,UnitOfMeasure
_,Double
_) -> CommodityType
t) [Quantity]
qtys
, (Quantity -> UnitOfMeasure) -> [Quantity] -> [UnitOfMeasure]
forall a b. (a -> b) -> [a] -> [b]
map (\(CommodityType
_,UnitOfMeasure
u,Double
_) -> UnitOfMeasure
u) [Quantity]
qtys
, (Quantity -> Double) -> [Quantity] -> [Double]
forall a b. (a -> b) -> [a] -> [b]
map (\(CommodityType
_,UnitOfMeasure
_,Double
a) -> Double
a) [Quantity]
qtys
)
where qtys :: [Quantity]
qtys = (PricingPeriod -> Quantity) -> PricingPeriods -> [Quantity]
forall a b. (a -> b) -> [a] -> [b]
map PricingPeriod -> Quantity
pricingPeriodQuantity PricingPeriods
pps
energyVanillaSwap :: Bool
-> Calendar
-> (Double, Currency)
-> UnitOfMeasure
-> CommodityIndex
-> Currency
-> Currency
-> PricingPeriods
-> CommodityType
-> SecondaryCosts
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyVanillaSwap
energyVanillaSwap :: forall y1 y2 y3.
Bool
-> Calendar
-> (Double, Currency)
-> UnitOfMeasure
-> CommodityIndex
-> Currency
-> Currency
-> PricingPeriods
-> CommodityType
-> SecondaryCosts
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyVanillaSwap
energyVanillaSwap Bool
payer Calendar
calendar (Double
fpAmt, Currency
fpCcy) UnitOfMeasure
fpUom CommodityIndex
index Currency
payCcy Currency
receiveCcy PricingPeriods
pps CommodityType
cmdType SecondaryCosts
secCosts
GenYieldTermStructure y1
payLegTS GenYieldTermStructure y2
receiveLegTS GenYieldTermStructure y3
discountTS =
Bool
-> Calendar
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityIndex
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyVanillaSwap
forall y1 y2 y3.
Bool
-> Calendar
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityIndex
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyVanillaSwap
qlEnergyVanillaSwap_ Bool
payer Calendar
calendar Double
fpAmt Currency
fpCcy UnitOfMeasure
fpUom CommodityIndex
index Currency
payCcy Currency
receiveCcy
[Day]
ppStarts [Day]
ppEnds [Day]
ppPays [CommodityType]
ppTypes [UnitOfMeasure]
ppUoms [Double]
ppAmts
CommodityType
cmdType [String]
scKeys [Bool]
scIsUnitCost [Double]
scAmts [Currency]
scCcys [Maybe UnitOfMeasure]
scUoms
GenYieldTermStructure y1
payLegTS GenYieldTermStructure y2
receiveLegTS GenYieldTermStructure y3
discountTS
where
([Day]
ppStarts, [Day]
ppEnds, [Day]
ppPays, [CommodityType]
ppTypes, [UnitOfMeasure]
ppUoms, [Double]
ppAmts) = PricingPeriods
-> ([Day], [Day], [Day], [CommodityType], [UnitOfMeasure],
[Double])
pricingPeriodsFields PricingPeriods
pps
([String]
scKeys, [Bool]
scIsUnitCost, [Double]
scAmts, [Currency]
scCcys, [Maybe UnitOfMeasure]
scUoms) = SecondaryCosts
-> ([String], [Bool], [Double], [Currency], [Maybe UnitOfMeasure])
secondaryCostsFields SecondaryCosts
secCosts
qlEnergyVanillaSwap_ :: (Bool) -> (Calendar) -> (Double) -> (Currency) -> (UnitOfMeasure) -> (CommodityIndex) -> (Currency) -> (Currency) -> ([Day]) -> ([Day]) -> ([Day]) -> ([CommodityType]) -> ([UnitOfMeasure]) -> ([Double]) -> (CommodityType) -> ([String]) -> ([Bool]) -> ([Double]) -> ([Currency]) -> ([Maybe UnitOfMeasure]) -> (GenYieldTermStructure y1) -> (GenYieldTermStructure y2) -> (GenYieldTermStructure y3) -> IO ((EnergyVanillaSwap))
qlEnergyVanillaSwap_ :: forall y1 y2 y3.
Bool
-> Calendar
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityIndex
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyVanillaSwap
qlEnergyVanillaSwap_ Bool
a1 Calendar
a2 Double
a3 Currency
a4 UnitOfMeasure
a5 CommodityIndex
a6 Currency
a7 Currency
a8 [Day]
a9 [Day]
a10 [Day]
a11 [CommodityType]
a12 [UnitOfMeasure]
a13 [Double]
a14 CommodityType
a15 [String]
a16 [Bool]
a17 [Double]
a18 [Currency]
a19 [Maybe UnitOfMeasure]
a20 GenYieldTermStructure y1
a21 GenYieldTermStructure y2
a22 GenYieldTermStructure y3
a23 =
let {a1' :: CInt
a1' = Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
a1} in
Calendar
-> (Ptr CCalendar -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a2 ((Ptr CCalendar -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap)
-> (Ptr CCalendar -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a2' ->
let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
Currency
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a4 ((Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap)
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a4' ->
UnitOfMeasure
-> (Ptr CUnitOfMeasure -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. UnitOfMeasure -> (Ptr CUnitOfMeasure -> IO b) -> IO b
withUnitOfMeasure UnitOfMeasure
a5 ((Ptr CUnitOfMeasure -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CUnitOfMeasure -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CUnitOfMeasure
a5' ->
CommodityIndex
-> (Ptr CCommodityIndex' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. CommodityIndex -> (Ptr CCommodityIndex' -> IO b) -> IO b
withCommodityIndex CommodityIndex
a6 ((Ptr CCommodityIndex' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CCommodityIndex' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityIndex'
a6' ->
Currency
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a7 ((Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap)
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a7' ->
Currency
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a8 ((Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap)
-> (Ptr CCurrency -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a8' ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a9 (((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a9'1, Ptr CInt
a9'2) ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a10 (((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a10'1, Ptr CInt
a10'2) ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a11 (((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr CInt
a11'2) ->
[CommodityType]
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b.
[CommodityType]
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO b) -> IO b
withCommodityTypeArray [CommodityType]
a12 (((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a12'1, Ptr (Ptr CCommodityType)
a12'2) ->
[UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b.
[UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO b) -> IO b
withUnitOfMeasureArray [UnitOfMeasure]
a13 (((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a13'1, Ptr (Ptr CUnitOfMeasure)
a13'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a14 (((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a14'1, Ptr CDouble
a14'2) ->
CommodityType
-> (Ptr CCommodityType -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. CommodityType -> (Ptr CCommodityType -> IO b) -> IO b
withCommodityType CommodityType
a15 ((Ptr CCommodityType -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CCommodityType -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityType
a15' ->
[String]
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [String] -> ((CUInt, Ptr (Ptr CChar)) -> IO b) -> IO b
withStringArray [String]
a16 (((CUInt, Ptr (Ptr CChar)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a16'1, Ptr (Ptr CChar)
a16'2) ->
[Bool]
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Bool] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withBoolArray [Bool]
a17 (((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a17'1, Ptr CInt
a17'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a18 (((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr CDouble) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a18'1, Ptr CDouble
a18'2) ->
[Currency]
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b.
[Currency] -> ((CUInt, Ptr (Ptr CCurrency)) -> IO b) -> IO b
withCurrencyArray [Currency]
a19 (((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a19'1, Ptr (Ptr CCurrency)
a19'2) ->
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall b.
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO b) -> IO b
withMaybeUnitOfMeasureArray [Maybe UnitOfMeasure]
a20 (((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a20'1, Ptr (Ptr CUnitOfMeasure)
a20'2) ->
GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a21 ((Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a21' ->
GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a22 ((Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a22' ->
GenYieldTermStructure y3
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y3
a23 ((Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a23' ->
(Ptr (Ptr CChar) -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO EnergyVanillaSwap) -> IO EnergyVanillaSwap)
-> (Ptr (Ptr CChar) -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a24' ->
CInt
-> Ptr CCalendar
-> CDouble
-> Ptr CCurrency
-> Ptr CUnitOfMeasure
-> Ptr CCommodityIndex'
-> Ptr CCurrency
-> Ptr CCurrency
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr (Ptr CCommodityType)
-> CUInt
-> Ptr (Ptr CUnitOfMeasure)
-> CUInt
-> Ptr CDouble
-> Ptr CCommodityType
-> CUInt
-> Ptr (Ptr CChar)
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr (Ptr CCurrency)
-> CUInt
-> Ptr (Ptr CUnitOfMeasure)
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr (Ptr CChar)
-> IO (Ptr CEnergyVanillaSwap')
qlEnergyVanillaSwap_'_ CInt
a1' Ptr CCalendar
a2' CDouble
a3' Ptr CCurrency
a4' Ptr CUnitOfMeasure
a5' Ptr CCommodityIndex'
a6' Ptr CCurrency
a7' Ptr CCurrency
a8' CUInt
a9'1 Ptr CInt
a9'2 CUInt
a10'1 Ptr CInt
a10'2 CUInt
a11'1 Ptr CInt
a11'2 CUInt
a12'1 Ptr (Ptr CCommodityType)
a12'2 CUInt
a13'1 Ptr (Ptr CUnitOfMeasure)
a13'2 CUInt
a14'1 Ptr CDouble
a14'2 Ptr CCommodityType
a15' CUInt
a16'1 Ptr (Ptr CChar)
a16'2 CUInt
a17'1 Ptr CInt
a17'2 CUInt
a18'1 Ptr CDouble
a18'2 CUInt
a19'1 Ptr (Ptr CCurrency)
a19'2 CUInt
a20'1 Ptr (Ptr CUnitOfMeasure)
a20'2 Ptr CYieldTermStructure'
a21' Ptr CYieldTermStructure'
a22' Ptr CYieldTermStructure'
a23' Ptr (Ptr CChar)
a24' IO (Ptr CEnergyVanillaSwap')
-> (Ptr CEnergyVanillaSwap' -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CEnergyVanillaSwap'
res ->
Ptr CEnergyVanillaSwap' -> IO EnergyVanillaSwap
peekEnergyVanillaSwap Ptr CEnergyVanillaSwap'
res IO EnergyVanillaSwap
-> (EnergyVanillaSwap -> IO EnergyVanillaSwap)
-> IO EnergyVanillaSwap
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \EnergyVanillaSwap
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a24'IO () -> IO EnergyVanillaSwap -> IO EnergyVanillaSwap
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
EnergyVanillaSwap -> IO EnergyVanillaSwap
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (EnergyVanillaSwap
res')
{-# LINE 327 "./QuantLib/Instrument/Energy.chs" #-}
energyBasisSwap :: Calendar
-> CommodityIndex
-> CommodityIndex
-> CommodityIndex
-> Bool
-> Currency
-> Currency
-> PricingPeriods
-> CommodityUnitCost
-> CommodityType
-> SecondaryCosts
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyBasisSwap
energyBasisSwap :: forall y1 y2 y3.
Calendar
-> CommodityIndex
-> CommodityIndex
-> CommodityIndex
-> Bool
-> Currency
-> Currency
-> PricingPeriods
-> CommodityUnitCost
-> CommodityType
-> SecondaryCosts
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyBasisSwap
energyBasisSwap Calendar
calendar CommodityIndex
spreadIndex CommodityIndex
payIndex CommodityIndex
receiveIndex Bool
spreadToPayLeg Currency
payCcy Currency
receiveCcy PricingPeriods
pps
(Double
basisAmt, Currency
basisCcy, UnitOfMeasure
basisUom) CommodityType
cmdType SecondaryCosts
secCosts GenYieldTermStructure y1
payLegTS GenYieldTermStructure y2
receiveLegTS GenYieldTermStructure y3
discountTS =
Calendar
-> CommodityIndex
-> CommodityIndex
-> CommodityIndex
-> Bool
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyBasisSwap
forall y1 y2 y3.
Calendar
-> CommodityIndex
-> CommodityIndex
-> CommodityIndex
-> Bool
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyBasisSwap
qlEnergyBasisSwap_ Calendar
calendar CommodityIndex
spreadIndex CommodityIndex
payIndex CommodityIndex
receiveIndex Bool
spreadToPayLeg Currency
payCcy Currency
receiveCcy
[Day]
ppStarts [Day]
ppEnds [Day]
ppPays [CommodityType]
ppTypes [UnitOfMeasure]
ppUoms [Double]
ppAmts
Double
basisAmt Currency
basisCcy UnitOfMeasure
basisUom
CommodityType
cmdType [String]
scKeys [Bool]
scIsUnitCost [Double]
scAmts [Currency]
scCcys [Maybe UnitOfMeasure]
scUoms
GenYieldTermStructure y1
payLegTS GenYieldTermStructure y2
receiveLegTS GenYieldTermStructure y3
discountTS
where
([Day]
ppStarts, [Day]
ppEnds, [Day]
ppPays, [CommodityType]
ppTypes, [UnitOfMeasure]
ppUoms, [Double]
ppAmts) = PricingPeriods
-> ([Day], [Day], [Day], [CommodityType], [UnitOfMeasure],
[Double])
pricingPeriodsFields PricingPeriods
pps
([String]
scKeys, [Bool]
scIsUnitCost, [Double]
scAmts, [Currency]
scCcys, [Maybe UnitOfMeasure]
scUoms) = SecondaryCosts
-> ([String], [Bool], [Double], [Currency], [Maybe UnitOfMeasure])
secondaryCostsFields SecondaryCosts
secCosts
qlEnergyBasisSwap_ :: (Calendar) -> (CommodityIndex) -> (CommodityIndex) -> (CommodityIndex) -> (Bool) -> (Currency) -> (Currency) -> ([Day]) -> ([Day]) -> ([Day]) -> ([CommodityType]) -> ([UnitOfMeasure]) -> ([Double]) -> (Double) -> (Currency) -> (UnitOfMeasure) -> (CommodityType) -> ([String]) -> ([Bool]) -> ([Double]) -> ([Currency]) -> ([Maybe UnitOfMeasure]) -> (GenYieldTermStructure y1) -> (GenYieldTermStructure y2) -> (GenYieldTermStructure y3) -> IO ((EnergyBasisSwap))
qlEnergyBasisSwap_ :: forall y1 y2 y3.
Calendar
-> CommodityIndex
-> CommodityIndex
-> CommodityIndex
-> Bool
-> Currency
-> Currency
-> [Day]
-> [Day]
-> [Day]
-> [CommodityType]
-> [UnitOfMeasure]
-> [Double]
-> Double
-> Currency
-> UnitOfMeasure
-> CommodityType
-> [String]
-> [Bool]
-> [Double]
-> [Currency]
-> [Maybe UnitOfMeasure]
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> IO EnergyBasisSwap
qlEnergyBasisSwap_ Calendar
a1 CommodityIndex
a2 CommodityIndex
a3 CommodityIndex
a4 Bool
a5 Currency
a6 Currency
a7 [Day]
a8 [Day]
a9 [Day]
a10 [CommodityType]
a11 [UnitOfMeasure]
a12 [Double]
a13 Double
a14 Currency
a15 UnitOfMeasure
a16 CommodityType
a17 [String]
a18 [Bool]
a19 [Double]
a20 [Currency]
a21 [Maybe UnitOfMeasure]
a22 GenYieldTermStructure y1
a23 GenYieldTermStructure y2
a24 GenYieldTermStructure y3
a25 =
Calendar
-> (Ptr CCalendar -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a1 ((Ptr CCalendar -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CCalendar -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a1' ->
CommodityIndex
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. CommodityIndex -> (Ptr CCommodityIndex' -> IO b) -> IO b
withCommodityIndex CommodityIndex
a2 ((Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityIndex'
a2' ->
CommodityIndex
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. CommodityIndex -> (Ptr CCommodityIndex' -> IO b) -> IO b
withCommodityIndex CommodityIndex
a3 ((Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityIndex'
a3' ->
CommodityIndex
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. CommodityIndex -> (Ptr CCommodityIndex' -> IO b) -> IO b
withCommodityIndex CommodityIndex
a4 ((Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CCommodityIndex' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityIndex'
a4' ->
let {a5' :: CInt
a5' = Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
a5} in
Currency
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a6 ((Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a6' ->
Currency
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a7 ((Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a7' ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a8 (((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a8'1, Ptr CInt
a8'2) ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a9 (((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a9'1, Ptr CInt
a9'2) ->
[Day]
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a10 (((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a10'1, Ptr CInt
a10'2) ->
[CommodityType]
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b.
[CommodityType]
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO b) -> IO b
withCommodityTypeArray [CommodityType]
a11 (((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr (Ptr CCommodityType)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr (Ptr CCommodityType)
a11'2) ->
[UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b.
[UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO b) -> IO b
withUnitOfMeasureArray [UnitOfMeasure]
a12 (((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a12'1, Ptr (Ptr CUnitOfMeasure)
a12'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a13 (((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a13'1, Ptr CDouble
a13'2) ->
let {a14' :: CDouble
a14' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a14} in
Currency
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. Currency -> (Ptr CCurrency -> IO b) -> IO b
withCurrency Currency
a15 ((Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CCurrency -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCurrency
a15' ->
UnitOfMeasure
-> (Ptr CUnitOfMeasure -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. UnitOfMeasure -> (Ptr CUnitOfMeasure -> IO b) -> IO b
withUnitOfMeasure UnitOfMeasure
a16 ((Ptr CUnitOfMeasure -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CUnitOfMeasure -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CUnitOfMeasure
a16' ->
CommodityType
-> (Ptr CCommodityType -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. CommodityType -> (Ptr CCommodityType -> IO b) -> IO b
withCommodityType CommodityType
a17 ((Ptr CCommodityType -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr CCommodityType -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CCommodityType
a17' ->
[String]
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. [String] -> ((CUInt, Ptr (Ptr CChar)) -> IO b) -> IO b
withStringArray [String]
a18 (((CUInt, Ptr (Ptr CChar)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr (Ptr CChar)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a18'1, Ptr (Ptr CChar)
a18'2) ->
[Bool]
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall b. [Bool] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withBoolArray [Bool]
a19 (((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> ((CUInt, Ptr CInt) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a19'1, Ptr CInt
a19'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a20 (((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr CDouble) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a20'1, Ptr CDouble
a20'2) ->
[Currency]
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b.
[Currency] -> ((CUInt, Ptr (Ptr CCurrency)) -> IO b) -> IO b
withCurrencyArray [Currency]
a21 (((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr (Ptr CCurrency)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a21'1, Ptr (Ptr CCurrency)
a21'2) ->
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall b.
[Maybe UnitOfMeasure]
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO b) -> IO b
withMaybeUnitOfMeasureArray [Maybe UnitOfMeasure]
a22 (((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> ((CUInt, Ptr (Ptr CUnitOfMeasure)) -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \(CUInt
a22'1, Ptr (Ptr CUnitOfMeasure)
a22'2) ->
GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a23 ((Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a23' ->
GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a24 ((Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a24' ->
GenYieldTermStructure y3
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y3
a25 ((Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap)
-> (Ptr CYieldTermStructure' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a25' ->
(Ptr (Ptr CChar) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap)
-> (Ptr (Ptr CChar) -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a26' ->
Ptr CCalendar
-> Ptr CCommodityIndex'
-> Ptr CCommodityIndex'
-> Ptr CCommodityIndex'
-> CInt
-> Ptr CCurrency
-> Ptr CCurrency
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr (Ptr CCommodityType)
-> CUInt
-> Ptr (Ptr CUnitOfMeasure)
-> CUInt
-> Ptr CDouble
-> CDouble
-> Ptr CCurrency
-> Ptr CUnitOfMeasure
-> Ptr CCommodityType
-> CUInt
-> Ptr (Ptr CChar)
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr (Ptr CCurrency)
-> CUInt
-> Ptr (Ptr CUnitOfMeasure)
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr (Ptr CChar)
-> IO (Ptr CEnergyBasisSwap')
qlEnergyBasisSwap_'_ Ptr CCalendar
a1' Ptr CCommodityIndex'
a2' Ptr CCommodityIndex'
a3' Ptr CCommodityIndex'
a4' CInt
a5' Ptr CCurrency
a6' Ptr CCurrency
a7' CUInt
a8'1 Ptr CInt
a8'2 CUInt
a9'1 Ptr CInt
a9'2 CUInt
a10'1 Ptr CInt
a10'2 CUInt
a11'1 Ptr (Ptr CCommodityType)
a11'2 CUInt
a12'1 Ptr (Ptr CUnitOfMeasure)
a12'2 CUInt
a13'1 Ptr CDouble
a13'2 CDouble
a14' Ptr CCurrency
a15' Ptr CUnitOfMeasure
a16' Ptr CCommodityType
a17' CUInt
a18'1 Ptr (Ptr CChar)
a18'2 CUInt
a19'1 Ptr CInt
a19'2 CUInt
a20'1 Ptr CDouble
a20'2 CUInt
a21'1 Ptr (Ptr CCurrency)
a21'2 CUInt
a22'1 Ptr (Ptr CUnitOfMeasure)
a22'2 Ptr CYieldTermStructure'
a23' Ptr CYieldTermStructure'
a24' Ptr CYieldTermStructure'
a25' Ptr (Ptr CChar)
a26' IO (Ptr CEnergyBasisSwap')
-> (Ptr CEnergyBasisSwap' -> IO EnergyBasisSwap)
-> IO EnergyBasisSwap
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CEnergyBasisSwap'
res ->
Ptr CEnergyBasisSwap' -> IO EnergyBasisSwap
peekEnergyBasisSwap Ptr CEnergyBasisSwap'
res IO EnergyBasisSwap
-> (EnergyBasisSwap -> IO EnergyBasisSwap) -> IO EnergyBasisSwap
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \EnergyBasisSwap
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a26'IO () -> IO EnergyBasisSwap -> IO EnergyBasisSwap
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
EnergyBasisSwap -> IO EnergyBasisSwap
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (EnergyBasisSwap
res')
{-# LINE 383 "./QuantLib/Instrument/Energy.chs" #-}
qlCreatePricingPeriods_ :: (Day) -> (Day) -> (CommodityType) -> (UnitOfMeasure) -> (Double) -> (DeliverySchedule) -> (QuantityPeriodicity) -> (PaymentTerm) -> IO (([Day]), ([Day]), ([Day]), ([CommodityType]), ([UnitOfMeasure]), ([Double]))
qlCreatePricingPeriods_ a1 a2 a3 a4 a5 a6 a7 a8 =
withDay a1 $ \a1' ->
withDay a2 $ \a2' ->
withCommodityType a3 $ \a3' ->
withUnitOfMeasure a4 $ \a4' ->
let {a5' = realToFrac a5} in
let {a6' = fromEnumC a6} in
let {a7' = fromEnumC a7} in
withPaymentTerm a8 $ \a8' ->
preArray $ \(a9'1, a9'2) ->
preArray $ \(a10'1, a10'2) ->
preArray $ \(a11'1, a11'2) ->
preArray $ \(a12'1, a12'2) ->
preArray $ \(a13'1, a13'2) ->
preArray $ \(a14'1, a14'2) ->
preErrorCheck $ \a15' ->
qlCreatePricingPeriods_'_ a1' a2' a3' a4' a5' a6' a7' a8' a9'1 a9'2 a10'1 a10'2 a11'1 a11'2 a12'1 a12'2 a13'1 a13'2 a14'1 a14'2 a15' >>
peekDayArray a9'1 a9'2>>= \a9'' ->
peekDayArray a10'1 a10'2>>= \a10'' ->
peekDayArray a11'1 a11'2>>= \a11'' ->
peekCommodityTypeArray a12'1 a12'2>>= \a12'' ->
peekUnitOfMeasureArray a13'1 a13'2>>= \a13'' ->
peekDoubleArray a14'1 a14'2>>= \a14'' ->
errorCheck a15'>>
return (a9'', a10'', a11'', a12'', a13'', a14'')
{-# LINE 398 "./QuantLib/Instrument/Energy.chs" #-}
createPricingPeriods :: Day -> Day -> Quantity -> DeliverySchedule -> QuantityPeriodicity -> PaymentTerm -> IO PricingPeriods
createPricingPeriods startDate endDate (ct, uom, amt) deliverySchedule qtyPeriodicity pmtTerm = do
(starts, ends, pays, types, uoms, amts) <-
qlCreatePricingPeriods_ startDate endDate ct uom amt deliverySchedule qtyPeriodicity pmtTerm
pure $ zipWith6 (\s e p t u a -> pricingPeriod s e p (t, u, a)) starts ends pays types uoms amts
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowDiscountedAmount"
discountedAmount'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowUndiscountedAmount"
undiscountedAmount'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowDiscountedPaymentAmount"
discountedPaymentAmount'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowUndiscountedPaymentAmount"
undiscountedPaymentAmount'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowDiscountFactor"
discountFactor'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowPaymentDiscountFactor"
paymentDiscountFactor'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityCashFlowFinalized"
finalized'_ :: ((C2HSImp.Ptr (CCommodityCashFlow')) -> (IO C2HSImp.CInt))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityAddPricingError"
addPricingError'_ :: ((C2HSImp.Ptr (CCommodity')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO ())))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommoditySecondaryCostAmounts"
qlCommoditySecondaryCostAmounts_'_ :: ((C2HSImp.Ptr (CCommodity')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar))) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr (CCurrency)))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCommodityPricingErrors"
qlCommodityPricingErrors_'_ :: ((C2HSImp.Ptr (CCommodity')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar))) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergyCommodityQuantity"
qlEnergyCommodityQuantity_'_ :: ((C2HSImp.Ptr (CEnergyCommodity')) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCommodityType))) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergyFuture"
qlEnergyFuture_'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> ((C2HSImp.Ptr (CCommodityIndex')) -> ((C2HSImp.Ptr (CCommodityType)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CEnergyFuture')))))))))))))))))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergySwapDailyPositions"
qlEnergySwapDailyPositions_'_ :: ((C2HSImp.Ptr (CEnergySwap')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergySwapPaymentCashFlows"
paymentCashFlows'_ :: ((C2HSImp.Ptr (CEnergySwap')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr (CCommodityCashFlow')))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergyVanillaSwap"
qlEnergyVanillaSwap_'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> ((C2HSImp.Ptr (CCommodityIndex')) -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CCurrency)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCommodityType))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CCommodityType)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CEnergyVanillaSwap'))))))))))))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlEnergyBasisSwap"
qlEnergyBasisSwap_'_ :: ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CCommodityIndex')) -> ((C2HSImp.Ptr (CCommodityIndex')) -> ((C2HSImp.Ptr (CCommodityIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CCurrency)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCommodityType))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> ((C2HSImp.Ptr (CCommodityType)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCurrency))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CEnergyBasisSwap'))))))))))))))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/Instrument/Energy.chs.h qlCreatePricingPeriods"
qlCreatePricingPeriods_'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CPaymentTerm)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr (CCommodityType)))) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure)))) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))))))))))))))