{-# LINE 1 "./QuantLib/Quote.chs" #-}
module QuantLib.Quote
(
GenQuote
, Quote
, SimpleQuote
, DeltaVolQuote
, FuturesConvAdjustmentQuote
, RelinkableQuote
, PriceType(..)
, IntervalPriceType(..)
, AtmType(..)
, DeltaType(..)
, QuoteOp(..)
, MultiQuoteOp(..)
, asQuote
, simpleQuote
, deltaVolQuote
, atmVolQuote
, eurodollarFuturesImpliedStdDevQuote
, forwardSwapQuote
, forwardValueQuote
, fxCashSpotQuote
, futuresConvAdjustmentQuoteFromImmCode
, futuresConvAdjustmentQuote
, impliedStdDevQuote
, lastFixingQuote
, relinkableQuote
, derivedQuote
, compositeQuote
, multiCompositeQuote
, withDerivedQuote
, withCompositeQuote
, withMultiCompositeQuote
, setValue
, linkTo
, value
, isValid
, futuresValue
) 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 QuantLib.Internal
import QuantLib.Internal.Common
import QuantLib.Internal.Type
data IntervalPriceType = IntervalPriceOpen
| IntervalPriceClose
| IntervalPriceHigh
| IntervalPriceLow
deriving (Enum,Show,Eq,Read)
{-# LINE 63 "./QuantLib/Quote.chs" #-}
data AtmType = AtmNull
| AtmSpot
| AtmFwd
| AtmDeltaNeutral
| AtmVegaMax
| AtmGammaMax
| AtmPutCall50
deriving (Enum,Show,Eq,Read)
{-# LINE 64 "./QuantLib/Quote.chs" #-}
data PriceType = Bid
| Ask
| Last
| Close
| Mid
| MidEquivalent
| MidSafe
deriving (Enum,Show,Eq,Read)
{-# LINE 65 "./QuantLib/Quote.chs" #-}
data DeltaType = Spot
| Fwd
| PaSpot
| PaFwd
deriving (Enum,Show,Eq,Read)
{-# LINE 66 "./QuantLib/Quote.chs" #-}
data QuoteOp = QuoteAdd
| QuoteSubtract
| QuoteMultiply
| QuoteDivide
deriving (Show,Eq,Read,Bounded)
instance Enum QuoteOp where
succ :: QuoteOp -> QuoteOp
succ QuoteOp
QuoteAdd = QuoteOp
QuoteSubtract
succ QuoteOp
QuoteSubtract = QuoteOp
QuoteMultiply
succ QuoteOp
QuoteMultiply = QuoteDivide
succ QuoteOp
QuoteDivide = error String
"QuoteOp.succ: QuoteDivide has no successor"
pred :: QuoteOp -> QuoteOp
pred QuoteOp
QuoteSubtract = QuoteOp
QuoteAdd
pred QuoteOp
QuoteMultiply = QuoteOp
QuoteSubtract
pred QuoteOp
QuoteDivide = QuoteOp
QuoteMultiply
pred QuoteOp
QuoteAdd = String -> QuoteOp
forall a. HasCallStack => String -> a
error String
"QuoteOp.pred: QuoteAdd has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from QuoteDivide
fromEnum QuoteAdd = 0
fromEnum QuoteSubtract = 1
fromEnum QuoteMultiply = 2
fromEnum QuoteDivide = 3
toEnum 0 = QuoteAdd
toEnum 1 = QuoteSubtract
toEnum 2 = QuoteMultiply
toEnum 3 = QuoteDivide
toEnum unmatched = error ("QuoteOp.toEnum: Cannot match " ++ show unmatched)
{-# LINE 71 "./QuantLib/Quote.chs" #-}
data MultiQuoteOp = QuoteSum
| QuoteProduct
| QuoteNorm2
deriving (Show,Eq,Read,Bounded)
instance Enum MultiQuoteOp where
succ QuoteSum = QuoteProduct
succ QuoteProduct = QuoteNorm2
succ QuoteNorm2 = error "MultiQuoteOp.succ: QuoteNorm2 has no successor"
pred QuoteProduct = QuoteSum
pred QuoteNorm2 = QuoteProduct
pred QuoteSum = error "MultiQuoteOp.pred: QuoteSum has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from QuoteNorm2
fromEnum QuoteSum = 0
fromEnum QuoteProduct = 1
fromEnum QuoteNorm2 = 2
toEnum 0 = QuoteSum
toEnum 1 = QuoteProduct
toEnum 2 = QuoteNorm2
toEnum unmatched = error ("MultiQuoteOp.toEnum: Cannot match " ++ show unmatched)
{-# LINE 74 "./QuantLib/Quote.chs" #-}
{-# LINE 76 "./QuantLib/Quote.chs" #-}
{-# LINE 77 "./QuantLib/Quote.chs" #-}
{-# LINE 78 "./QuantLib/Quote.chs" #-}
{-# LINE 79 "./QuantLib/Quote.chs" #-}
{-# LINE 80 "./QuantLib/Quote.chs" #-}
{-# LINE 81 "./QuantLib/Quote.chs" #-}
{-# LINE 82 "./QuantLib/Quote.chs" #-}
{-# LINE 83 "./QuantLib/Quote.chs" #-}
{-# LINE 84 "./QuantLib/Quote.chs" #-}
{-# LINE 85 "./QuantLib/Quote.chs" #-}
simpleQuote :: (Double) -> IO ((SimpleQuote))
simpleQuote a1 =
let {a1' = realToFrac a1} in
preErrorCheck $ \a2' ->
simpleQuote'_ a1' a2' >>= \res ->
peekSimpleQuote res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 88 "./QuantLib/Quote.chs" #-}
deltaVolQuote :: (Double)
-> (GenQuote q)
-> (Double)
-> (DeltaType) -> IO ((DeltaVolQuote))
deltaVolQuote a1 a2 a3 a4 =
let {a1' = realToFrac a1} in
withQuote a2 $ \a2' ->
let {a3' = realToFrac a3} in
let {a4' = fromEnumC a4} in
preErrorCheck $ \a5' ->
deltaVolQuote'_ a1' a2' a3' a4' a5' >>= \res ->
peekDeltaVolQuote res >>= \res' ->
errorCheck a5'>>
return (res')
{-# LINE 95 "./QuantLib/Quote.chs" #-}
atmVolQuote :: (GenQuote q)
-> (DeltaType) -> (Double)
-> (AtmType) -> IO ((DeltaVolQuote))
atmVolQuote a1 a2 a3 a4 =
withQuote a1 $ \a1' ->
let {a2' = fromEnumC a2} in
let {a3' = realToFrac a3} in
let {a4' = fromEnumC a4} in
preErrorCheck $ \a5' ->
atmVolQuote'_ a1' a2' a3' a4' a5' >>= \res ->
peekDeltaVolQuote res >>= \res' ->
errorCheck a5'>>
return (res')
{-# LINE 102 "./QuantLib/Quote.chs" #-}
value :: (GenQuote q) -> IO ((Double))
value a1 =
withQuote a1 $ \a1' ->
preErrorCheck $ \a2' ->
value'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 105 "./QuantLib/Quote.chs" #-}
setValue :: (SimpleQuote) -> (Double) -> IO ()
setValue a1 a2 =
withGenQuote a1 $ \a1' ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
setValue'_ a1' a2' a3' >>
errorCheck a3'>>
return ()
{-# LINE 108 "./QuantLib/Quote.chs" #-}
eurodollarFuturesImpliedStdDevQuote :: (GenQuote q1)
-> (GenQuote q2)
-> (GenQuote q3)
-> (Double)
-> (Double)
-> (Double)
-> (Word)
-> IO ((Quote))
eurodollarFuturesImpliedStdDevQuote :: forall q1 q2 q3.
GenQuote q1
-> GenQuote q2
-> GenQuote q3
-> Double
-> Double
-> Double
-> Word
-> IO Quote
eurodollarFuturesImpliedStdDevQuote GenQuote q1
a1 GenQuote q2
a2 GenQuote q3
a3 Double
a4 Double
a5 Double
a6 Word
a7 =
GenQuote q1 -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' ->
GenQuote q2 -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q2
a2 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a2' ->
GenQuote q3 -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q3
a3 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
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
let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in
let {a7' :: CUInt
a7' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a7} in
(Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO Quote) -> IO Quote)
-> (Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a8' ->
Ptr CQuote'
-> Ptr CQuote'
-> Ptr CQuote'
-> CDouble
-> CDouble
-> CDouble
-> CUInt
-> Ptr (Ptr ())
-> IO (Ptr CQuote')
eurodollarFuturesImpliedStdDevQuote'_ Ptr CQuote'
a1' Ptr CQuote'
a2' Ptr CQuote'
a3' CDouble
a4' CDouble
a5' CDouble
a6' CUInt
a7' Ptr (Ptr ())
a8' IO (Ptr CQuote') -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CQuote'
res ->
Ptr CQuote' -> IO Quote
peekQuote Ptr CQuote'
res IO Quote -> (Quote -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Quote
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a8'IO () -> IO Quote -> IO Quote
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Quote -> IO Quote
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Quote
res')
{-# LINE 118 "./QuantLib/Quote.chs" #-}
forwardSwapQuote :: (GenSwapIndex sidx) -> (GenQuote q)
-> ((Int,TimeUnit))
-> IO ((Quote))
forwardSwapQuote a1 a2 a3 =
withSwapIndex a1 $ \a1' ->
withQuote a2 $ \a2' ->
let {(a3'1, a3'2) = fromEnumQuantity a3} in
preErrorCheck $ \a4' ->
forwardSwapQuote'_ a1' a2' a3'1 a3'2 a4' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 123 "./QuantLib/Quote.chs" #-}
forwardValueQuote :: (GenIndex idx) -> (Day) -> IO ((Quote))
forwardValueQuote a1 a2 =
withIndex a1 $ \a1' ->
withDay a2 $ \a2' ->
preErrorCheck $ \a3' ->
forwardValueQuote'_ a1' a2' a3' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 126 "./QuantLib/Quote.chs" #-}
fxCashSpotQuote :: (GenQuote q)
-> (GenYieldTermStructure y1)
-> (GenYieldTermStructure y2)
-> (Calendar)
-> (Word)
-> IO ((Quote))
fxCashSpotQuote :: forall q y1 y2.
GenQuote q
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> Calendar
-> Word
-> IO Quote
fxCashSpotQuote GenQuote q
a1 GenYieldTermStructure y1
a2 GenYieldTermStructure y2
a3 Calendar
a4 Word
a5 =
GenQuote q -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' ->
GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO Quote) -> IO Quote
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a2 ((Ptr CYieldTermStructure' -> IO Quote) -> IO Quote)
-> (Ptr CYieldTermStructure' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' ->
GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO Quote) -> IO Quote
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a3 ((Ptr CYieldTermStructure' -> IO Quote) -> IO Quote)
-> (Ptr CYieldTermStructure' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a3' ->
Calendar -> (Ptr CCalendar -> IO Quote) -> IO Quote
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO Quote) -> IO Quote)
-> (Ptr CCalendar -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' ->
let {a5' :: CUInt
a5' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a5} in
(Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO Quote) -> IO Quote)
-> (Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a6' ->
Ptr CQuote'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CCalendar
-> CUInt
-> Ptr (Ptr ())
-> IO (Ptr CQuote')
fxCashSpotQuote'_ Ptr CQuote'
a1' Ptr CYieldTermStructure'
a2' Ptr CYieldTermStructure'
a3' Ptr CCalendar
a4' CUInt
a5' Ptr (Ptr ())
a6' IO (Ptr CQuote') -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CQuote'
res ->
Ptr CQuote' -> IO Quote
peekQuote Ptr CQuote'
res IO Quote -> (Quote -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Quote
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a6'IO () -> IO Quote -> IO Quote
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Quote -> IO Quote
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Quote
res')
{-# LINE 148 "./QuantLib/Quote.chs" #-}
futuresConvAdjustmentQuoteFromImmCode :: (GenIborIndex ibor) -> (String)
-> (GenQuote q1)
-> (GenQuote q2)
-> (GenQuote q3)
-> IO ((FuturesConvAdjustmentQuote))
futuresConvAdjustmentQuoteFromImmCode a1 a2 a3 a4 a5 =
withIborIndex a1 $ \a1' ->
C2HSImp.withCString a2 $ \a2' ->
withQuote a3 $ \a3' ->
withQuote a4 $ \a4' ->
withQuote a5 $ \a5' ->
preErrorCheck $ \a6' ->
futuresConvAdjustmentQuoteFromImmCode'_ a1' a2' a3' a4' a5' a6' >>= \res ->
peekFuturesConvAdjustmentQuote res >>= \res' ->
errorCheck a6'>>
return (res')
{-# LINE 155 "./QuantLib/Quote.chs" #-}
futuresConvAdjustmentQuote :: (GenIborIndex ibor) -> (Day)
-> (GenQuote q1)
-> (GenQuote q2)
-> (GenQuote q3)
-> IO ((FuturesConvAdjustmentQuote))
futuresConvAdjustmentQuote a1 a2 a3 a4 a5 =
withIborIndex a1 $ \a1' ->
withDay a2 $ \a2' ->
withQuote a3 $ \a3' ->
withQuote a4 $ \a4' ->
withQuote a5 $ \a5' ->
preErrorCheck $ \a6' ->
futuresConvAdjustmentQuote'_ a1' a2' a3' a4' a5' a6' >>= \res ->
peekFuturesConvAdjustmentQuote res >>= \res' ->
errorCheck a6'>>
return (res')
{-# LINE 162 "./QuantLib/Quote.chs" #-}
futuresValue :: (FuturesConvAdjustmentQuote) -> IO ((Double))
futuresValue a1 =
withGenQuote a1 $ \a1' ->
preErrorCheck $ \a2' ->
futuresValue'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 165 "./QuantLib/Quote.chs" #-}
impliedStdDevQuote :: (OptionType) -> (GenQuote q1)
-> (GenQuote q2)
-> (Double)
-> (Double)
-> (Double)
-> (Word)
-> IO ((Quote))
impliedStdDevQuote :: forall q1 q2.
OptionType
-> GenQuote q1
-> GenQuote q2
-> Double
-> Double
-> Double
-> Word
-> IO Quote
impliedStdDevQuote OptionType
a1 GenQuote q1
a2 GenQuote q2
a3 Double
a4 Double
a5 Double
a6 Word
a7 =
let {a1' :: CInt
a1' = OptionType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC OptionType
a1} in
GenQuote q1 -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a2 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a2' ->
withQuote a3 $ \a3' ->
let {a4' = realToFrac a4} in
let {a5' = realToFrac a5} in
let {a6' = realToFrac a6} in
let {a7' = fromIntegral a7} in
preErrorCheck $ \a8' ->
impliedStdDevQuote'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \Ptr CQuote'
res ->
Ptr CQuote' -> IO Quote
peekQuote Ptr CQuote'
res IO Quote -> (Quote -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Quote
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a8'IO () -> IO Quote -> IO Quote
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Quote -> IO Quote
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Quote
res')
{-# LINE 174 "./QuantLib/Quote.chs" #-}
lastFixingQuote :: (GenIndex idx) -> IO ((Quote))
lastFixingQuote a1 =
withIndex a1 $ \a1' ->
preErrorCheck $ \a2' ->
lastFixingQuote'_ a1' a2' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 177 "./QuantLib/Quote.chs" #-}
isValid :: (GenQuote q) -> IO ((Bool))
isValid a1 =
withQuote a1 $ \a1' ->
preErrorCheck $ \a2' ->
isValid'_ a1' a2' >>= \res ->
let {res' = C2HSImp.toBool res} in
errorCheck a2'>>
return (res')
{-# LINE 180 "./QuantLib/Quote.chs" #-}
relinkableQuote :: (Maybe (GenQuote q)) -> IO ((RelinkableQuote))
relinkableQuote a1 =
withMaybeQuote a1 $ \a1' ->
preErrorCheck $ \a2' ->
relinkableQuote'_ a1' a2' >>= \res ->
peekRelinkableQuote res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 185 "./QuantLib/Quote.chs" #-}
linkTo :: (RelinkableQuote) -> (GenQuote q) -> IO ()
linkTo a1 a2 =
withRelinkableQuote a1 $ \a1' ->
withQuote a2 $ \a2' ->
preErrorCheck $ \a3' ->
linkTo'_ a1' a2' a3' >>
errorCheck a3'>>
return ()
{-# LINE 190 "./QuantLib/Quote.chs" #-}
derivedQuote :: (QuoteOp) -> (GenQuote q) -> (Double)
-> IO ((Quote))
derivedQuote :: forall q. QuoteOp -> GenQuote q -> Double -> IO Quote
derivedQuote QuoteOp
a1 GenQuote q
a2 Double
a3 =
let {a1' :: CInt
a1' = QuoteOp -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC QuoteOp
a1} in
GenQuote q -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a2 ((Ptr CQuote' -> IO Quote) -> IO Quote)
-> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a2' ->
let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
(Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO Quote) -> IO Quote)
-> (Ptr (Ptr ()) -> IO Quote) -> IO Quote
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a4' ->
CInt -> Ptr CQuote' -> CDouble -> Ptr (Ptr ()) -> IO (Ptr CQuote')
derivedQuote'_ CInt
a1' Ptr CQuote'
a2' CDouble
a3' Ptr (Ptr ())
a4' IO (Ptr CQuote') -> (Ptr CQuote' -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CQuote'
res ->
Ptr CQuote' -> IO Quote
peekQuote Ptr CQuote'
res IO Quote -> (Quote -> IO Quote) -> IO Quote
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Quote
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a4'IO () -> IO Quote -> IO Quote
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Quote -> IO Quote
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Quote
res')
{-# LINE 202 "./QuantLib/Quote.chs" #-}
compositeQuote :: (QuoteOp) -> (GenQuote q1) -> (GenQuote q2) -> IO ((Quote))
compositeQuote a1 a2 a3 =
let {a1' = fromEnumC a1} in
withQuote a2 $ \a2' ->
withQuote a3 $ \a3' ->
preErrorCheck $ \a4' ->
compositeQuote'_ a1' a2' a3' a4' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 207 "./QuantLib/Quote.chs" #-}
multiCompositeQuote :: (MultiQuoteOp) -> ([GenQuote q]) -> IO ((Quote))
multiCompositeQuote a1 a2 =
let {a1' = fromEnumC a1} in
withQuoteArray a2 $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
multiCompositeQuote'_ a1' a2'1 a2'2 a3' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 214 "./QuantLib/Quote.chs" #-}
qlDerivedQuoteFromFunction :: (GenQuote q) -> (Callback) -> IO ((Quote))
qlDerivedQuoteFromFunction a1 a2 =
withQuote a1 $ \a1' ->
withCallbackPtr a2 $ \a2' ->
preErrorCheck $ \a3' ->
qlDerivedQuoteFromFunction'_ a1' a2' a3' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 217 "./QuantLib/Quote.chs" #-}
qlCompositeQuoteFromFunction :: (GenQuote q1) -> (GenQuote q2) -> (Callback) -> IO ((Quote))
qlCompositeQuoteFromFunction a1 a2 a3 =
withQuote a1 $ \a1' ->
withQuote a2 $ \a2' ->
withCallbackPtr a3 $ \a3' ->
preErrorCheck $ \a4' ->
qlCompositeQuoteFromFunction'_ a1' a2' a3' a4' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 219 "./QuantLib/Quote.chs" #-}
qlMultiCompositeQuoteFromFunction :: ([GenQuote q]) -> (Callback) -> IO ((Quote))
qlMultiCompositeQuoteFromFunction a1 a2 =
withQuoteArray a1 $ \(a1'1, a1'2) ->
withCallbackPtr a2 $ \a2' ->
preErrorCheck $ \a3' ->
qlMultiCompositeQuoteFromFunction'_ a1'1 a1'2 a2' a3' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 221 "./QuantLib/Quote.chs" #-}
withDerivedQuote :: (Double -> Double)
-> GenQuote q -> (Quote -> IO b) -> IO b
withDerivedQuote f q k = withPayoffFun f (\fp -> qlDerivedQuoteFromFunction q fp >>= k)
withCompositeQuote :: (Double -> Double -> Double)
-> GenQuote q1 -> GenQuote q2 -> (Quote -> IO b) -> IO b
withCompositeQuote :: forall q1 q2 b.
(Double -> Double -> Double)
-> GenQuote q1 -> GenQuote q2 -> (Quote -> IO b) -> IO b
withCompositeQuote Double -> Double -> Double
f GenQuote q1
q1 GenQuote q2
q2 Quote -> IO b
k = (Double -> Double -> Double) -> (Callback -> IO b) -> IO b
forall b.
(Double -> Double -> Double) -> (Callback -> IO b) -> IO b
withQuoteBinaryFun Double -> Double -> Double
f (\Callback
fp -> GenQuote q1 -> GenQuote q2 -> Callback -> IO Quote
forall q1 q2. GenQuote q1 -> GenQuote q2 -> Callback -> IO Quote
qlCompositeQuoteFromFunction GenQuote q1
q1 GenQuote q2
q2 Callback
fp IO Quote -> (Quote -> IO b) -> IO b
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Quote -> IO b
k)
withMultiCompositeQuote :: ([Double] -> Double)
-> [GenQuote q] -> (Quote -> IO b) -> IO b
withMultiCompositeQuote :: forall q b.
([Double] -> Double) -> [GenQuote q] -> (Quote -> IO b) -> IO b
withMultiCompositeQuote [Double] -> Double
f [GenQuote q]
qs Quote -> IO b
k = ([Double] -> Double) -> (Callback -> IO b) -> IO b
forall b. ([Double] -> Double) -> (Callback -> IO b) -> IO b
withBasketAccumulateFun [Double] -> Double
f (\Callback
fp -> [GenQuote q] -> Callback -> IO Quote
forall q. [GenQuote q] -> Callback -> IO Quote
qlMultiCompositeQuoteFromFunction [GenQuote q]
qs Callback
fp IO Quote -> (Quote -> IO b) -> IO b
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Quote -> IO b
k)
foreign import ccall safe "QuantLib/Quote.chs.h qlSimpleQuote"
simpleQuote'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSimpleQuote')))))
foreign import ccall safe "QuantLib/Quote.chs.h qlDeltaVolQuote1"
deltaVolQuote'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDeltaVolQuote'))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlDeltaVolQuote2"
atmVolQuote'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDeltaVolQuote'))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlQuoteValue"
value'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Quote.chs.h qlSimpleQuoteSetValue"
setValue'_ :: ((C2HSImp.Ptr (CSimpleQuote')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))
foreign import ccall safe "QuantLib/Quote.chs.h qlEurodollarFuturesImpliedStdDevQuote"
eurodollarFuturesImpliedStdDevQuote'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlForwardSwapQuote"
forwardSwapQuote'_ :: ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote'))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlForwardValueQuote"
forwardValueQuote'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote'))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlFxCashSpotQuote"
fxCashSpotQuote'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlFuturesConvAdjustmentQuote1"
futuresConvAdjustmentQuoteFromImmCode'_ :: ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFuturesConvAdjustmentQuote')))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlFuturesConvAdjustmentQuote"
futuresConvAdjustmentQuote'_ :: ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFuturesConvAdjustmentQuote')))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlFuturesConvAdjustmentQuoteFuturesValue"
futuresValue'_ :: ((C2HSImp.Ptr (CFuturesConvAdjustmentQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Quote.chs.h qlImpliedStdDevQuote"
impliedStdDevQuote'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlLastFixingQuote"
lastFixingQuote'_ :: ((C2HSImp.Ptr (CIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))
foreign import ccall safe "QuantLib/Quote.chs.h qlQuoteIsValid"
isValid'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
foreign import ccall safe "QuantLib/Quote.chs.h qlRelinkableQuote"
relinkableQuote'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRelinkableQuote')))))
foreign import ccall safe "QuantLib/Quote.chs.h qlRelinkableQuoteLinkTo"
linkTo'_ :: ((C2HSImp.Ptr (CRelinkableQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))
foreign import ccall safe "QuantLib/Quote.chs.h qlDerivedQuote"
derivedQuote'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlCompositeQuote"
compositeQuote'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlMultiCompositeQuote"
multiCompositeQuote'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlDerivedQuoteFromFunction"
qlDerivedQuoteFromFunction'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote'))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlCompositeQuoteFromFunction"
qlCompositeQuoteFromFunction'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))
foreign import ccall safe "QuantLib/Quote.chs.h qlMultiCompositeQuoteFromFunction"
qlMultiCompositeQuoteFromFunction'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))))