{-# LINE 1 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
module QuantLib.TermStructure.InflationVolatility
(
YoYOptionletVolatilitySurface
, YoYCapFloorTermPriceSurface
, CPICapFloorTermPriceSurface
, CPIVolatilitySurface
, YoyOptionletModel(..)
, YoyPriceSurfaceStart(..)
, constantYoyOptionletVolatility
, kInterpolatedYoyOptionletVolatilitySurface
, yoyCapFloorTermPriceSurface
, cpiCapFloorTermPriceSurface
, constantCpiVolatility
, yoyOptionletVolatility
, yoyOptionletTotalVariance
, yoyCapFloorBaseDate
, yoyCapFloorAtmYoySwapDateRates
, yoyCapFloorAtmYoySwapTimeRates
, yoyCapFloorAtmYoySwapRate
, yoyCapFloorAtmYoyRate
, yoyCapFloorStrikes
, cpiVolatility
, cpiTotalVariance
) where
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.Type
import QuantLib.InterestRate(VolatilityType)
import QuantLib.Time.Schedule(Frequency)
import QuantLib.Internal.Common
{-# LINE 48 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 49 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 50 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 51 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 52 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 53 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 54 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 55 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 56 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 57 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
constantYoyOptionletVolatility :: (GenQuote q) -> (Word)
-> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> ((Word,TimeUnit))
-> (Frequency) -> (Bool)
-> (Double)
-> (Double)
-> (VolatilityType) -> (Double)
-> IO ((YoYOptionletVolatilitySurface))
constantYoyOptionletVolatility :: forall q.
GenQuote q
-> Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> (Word, TimeUnit)
-> Frequency
-> Bool
-> Double
-> Double
-> VolatilityType
-> Double
-> IO YoYOptionletVolatilitySurface
constantYoyOptionletVolatility GenQuote q
a1 Word
a2 Calendar
a3 BusinessDayConvention
a4 DayCounter
a5 (Word, TimeUnit)
a6 Frequency
a7 Bool
a8 Double
a9 Double
a10 VolatilityType
a11 Double
a12 =
GenQuote q
-> (Ptr CQuote' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CQuote' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' ->
let {a2' :: CUInt
a2' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a2} in
Calendar
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a3 ((Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a3' ->
let {a4' :: CInt
a4' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a4} in
DayCounter
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a5 ((Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a5' ->
let {(CInt
a6'1, CInt
a6'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
a6} in
let {a7' :: CInt
a7' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a7} in
let {a8' :: CInt
a8' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a8} in
let {a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9} in
let {a10' :: CDouble
a10' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a10} in
let {a11' :: CInt
a11' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (VolatilityType -> Int) -> VolatilityType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. VolatilityType -> Int
forall a. Enum a => a -> Int
fromEnum) VolatilityType
a11} in
let {a12' :: CDouble
a12' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a12} in
(Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a13' ->
Ptr CQuote'
-> CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> CInt
-> CInt
-> CInt
-> CInt
-> CDouble
-> CDouble
-> CInt
-> CDouble
-> Ptr (Ptr ())
-> IO (Ptr CYoYOptionletVolatilitySurface')
constantYoyOptionletVolatility'_ Ptr CQuote'
a1' CUInt
a2' Ptr CCalendar
a3' CInt
a4' Ptr CDayCounter
a5' CInt
a6'1 CInt
a6'2 CInt
a7' CInt
a8' CDouble
a9' CDouble
a10' CInt
a11' CDouble
a12' Ptr (Ptr ())
a13' IO (Ptr CYoYOptionletVolatilitySurface')
-> (Ptr CYoYOptionletVolatilitySurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CYoYOptionletVolatilitySurface'
res ->
Ptr CYoYOptionletVolatilitySurface'
-> IO YoYOptionletVolatilitySurface
peekYoYOptionletVolatilityStructure Ptr CYoYOptionletVolatilitySurface'
res IO YoYOptionletVolatilitySurface
-> (YoYOptionletVolatilitySurface
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \YoYOptionletVolatilitySurface
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a13'IO ()
-> IO YoYOptionletVolatilitySurface
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
YoYOptionletVolatilitySurface -> IO YoYOptionletVolatilitySurface
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (YoYOptionletVolatilitySurface
res')
{-# LINE 77 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyOptionletVolatility :: (YoYOptionletVolatilitySurface) -> (Day) -> (Double)
-> (Maybe (Word,TimeUnit))
-> (Bool)
-> IO ((Double))
yoyOptionletVolatility a1 a2 a3 a4 a5 =
withGenVolatilityTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {a3' = realToFrac a3} in
let {(a4'1, a4'2) = fromMaybeEnumQuantity a4} in
let {a5' = C2HSImp.fromBool a5} in
preErrorCheck $ \a6' ->
yoyOptionletVolatility'_ a1' a2' a3' a4'1 a4'2 a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 86 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyOptionletTotalVariance :: (YoYOptionletVolatilitySurface) -> (Day) -> (Double)
-> (Maybe (Word,TimeUnit))
-> (Bool)
-> IO ((Double))
yoyOptionletTotalVariance a1 a2 a3 a4 a5 =
withGenVolatilityTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {a3' = realToFrac a3} in
let {(a4'1, a4'2) = fromMaybeEnumQuantity a4} in
let {a5' = C2HSImp.fromBool a5} in
preErrorCheck $ \a6' ->
yoyOptionletTotalVariance'_ a1' a2' a3' a4'1 a4'2 a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 96 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
data YoyPriceSurfaceStart
=
MovingStart
|
BookedAtEvaluationDate
deriving (Eq, Show, Read)
yoyCapFloorTermPriceSurface :: YoyPriceSurfaceStart
-> Word
-> (Word, TimeUnit)
-> GenYoYInflationIndex yidx -> CPIInterpolationType -> GenYieldTermStructure y
-> DayCounter -> Calendar -> BusinessDayConvention
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D -> Interpolation
-> IO YoYCapFloorTermPriceSurface
yoyCapFloorTermPriceSurface :: forall yidx y.
YoyPriceSurfaceStart
-> Word
-> (Word, TimeUnit)
-> GenYoYInflationIndex yidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D
-> Interpolation
-> IO YoYCapFloorTermPriceSurface
yoyCapFloorTermPriceSurface YoyPriceSurfaceStart
startDate Word
fixingDays (Word, TimeUnit)
yyLag GenYoYInflationIndex yidx
yii CPIInterpolationType
interp GenYieldTermStructure y
nominal DayCounter
dc Calendar
cal BusinessDayConvention
bdc [Double]
cStrikes [Double]
fStrikes [(Word, TimeUnit)]
cfMaturities (RealMatrix Word
cr Word
cc RealVector
cd) (RealMatrix Word
fr Word
fc RealVector
fd) Interpolation2D
i2d Interpolation
i1d =
(Int -> Int -> Int -> IO YoYCapFloorTermPriceSurface)
-> (Int, (Int, Int)) -> IO YoYCapFloorTermPriceSurface
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (Bool
-> Word
-> (Word, TimeUnit)
-> GenYoYInflationIndex yidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
forall yidx y.
Bool
-> Word
-> (Word, TimeUnit)
-> GenYoYInflationIndex yidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
qlYoYCapFloorTermPriceSurface (YoyPriceSurfaceStart
startDate YoyPriceSurfaceStart -> YoyPriceSurfaceStart -> Bool
forall a. Eq a => a -> a -> Bool
== YoyPriceSurfaceStart
BookedAtEvaluationDate) Word
fixingDays (Word, TimeUnit)
yyLag GenYoYInflationIndex yidx
yii CPIInterpolationType
interp GenYieldTermStructure y
nominal DayCounter
dc Calendar
cal BusinessDayConvention
bdc [Double]
cStrikes [Double]
fStrikes [Word]
maturityNums [TimeUnit]
maturityUnits Word
cr Word
cc RealVector
cd Word
fr Word
fc RealVector
fd (Interpolation2D -> Int
forall a. Enum a => a -> Int
fromEnum Interpolation2D
i2d)) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i1d)
where ([Word]
maturityNums, [TimeUnit]
maturityUnits) = [(Word, TimeUnit)] -> ([Word], [TimeUnit])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Word, TimeUnit)]
cfMaturities
qlYoYCapFloorTermPriceSurface :: (Bool)
-> (Word)
-> ((Word,TimeUnit))
-> (GenYoYInflationIndex yidx) -> (CPIInterpolationType) -> (GenYieldTermStructure y)
-> (DayCounter) -> (Calendar) -> (BusinessDayConvention) -> ([Double])
-> ([Double])
-> ([Word]) -> ([TimeUnit])
-> (Word) -> (Word) -> (RealVector)
-> (Word) -> (Word) -> (RealVector)
-> (Int)
-> (Int) -> (Int) -> (Int)
-> IO ((YoYCapFloorTermPriceSurface))
qlYoYCapFloorTermPriceSurface :: forall yidx y.
Bool
-> Word
-> (Word, TimeUnit)
-> GenYoYInflationIndex yidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
qlYoYCapFloorTermPriceSurface Bool
a1 Word
a2 (Word, TimeUnit)
a3 GenYoYInflationIndex yidx
a4 CPIInterpolationType
a5 GenYieldTermStructure y
a6 DayCounter
a7 Calendar
a8 BusinessDayConvention
a9 [Double]
a10 [Double]
a11 [Word]
a12 [TimeUnit]
a13 Word
a14 Word
a15 RealVector
a16 Word
a17 Word
a18 RealVector
a19 Int
a20 Int
a21 Int
a22 Int
a23 =
let {a1' :: CInt
a1' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a1} in
let {a2' :: CUInt
a2' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a2} in
let {(CInt
a3'1, CInt
a3'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
a3} in
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex GenYoYInflationIndex yidx
a4 ((Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a4' ->
let {a5' :: CInt
a5' = CPIInterpolationType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC CPIInterpolationType
a5} in
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a6 ((Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a6' ->
DayCounter
-> (Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a7 ((Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a7' ->
Calendar
-> (Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a8 ((Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a8' ->
let {a9' :: CInt
a9' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a9} in
[Double]
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a10 (((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a10'1, Ptr CDouble
a10'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a11 (((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr CDouble
a11'2) ->
[Word]
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a n b.
(Integral a, Num n, Storable n) =>
[a] -> ((CUInt, Ptr n) -> IO b) -> IO b
withIntArray [Word]
a12 (((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a12'1, Ptr CInt
a12'2) ->
[TimeUnit]
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. Enum a => [a] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withEnumArray [TimeUnit]
a13 (((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a13'1, Ptr CInt
a13'2) ->
let {a14' :: CUInt
a14' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a14} in
let {a15' = fromIntegral a15} in
withRealVectorRaw a16 $ \a16' ->
let {a17' = fromIntegral a17} in
let {a18' = fromIntegral a18} in
withRealVectorRaw a19 $ \a19' ->
let {a20' = fromIntegral a20} in
let {a21' = fromIntegral a21} in
let {a22' = fromIntegral a22} in
let {a23' = fromIntegral a23} in
preErrorCheck $ \a24' ->
qlYoYCapFloorTermPriceSurface'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' a8' a9' a10'1 a10'2 a11'1 a11'2 a12'1 a12'2 a13'1 a13'2 a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' >>= \res ->
peekYoYCapFloorTermPriceSurface res >>= \res' ->
errorCheck a24'>>
return (res')
{-# LINE 145 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorBaseDate :: (YoYCapFloorTermPriceSurface) -> IO ((Day))
yoyCapFloorBaseDate a1 =
withGenTermStructure a1 $ \a1' ->
preErrorCheck $ \a2' ->
yoyCapFloorBaseDate'_ a1' a2' >>= \res ->
let {res' = toDay res} in
errorCheck a2'>>
return (res')
{-# LINE 151 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorAtmYoySwapDateRates :: YoYCapFloorTermPriceSurface -> IO [(Day, Double)]
yoyCapFloorAtmYoySwapDateRates s = do
(ds, rs) <- qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates s
return $ zip ds rs
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates :: (YoYCapFloorTermPriceSurface) -> IO (([Day]), ([Double]))
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates a1 =
withGenTermStructure a1 $ \a1' ->
preIntArray $ \(a2'1, a2'2) ->
preDoubleArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates'_ a1' a2'1 a2'2 a3'1 a3'2 a4' >>
peekDayArray a2'1 a2'2>>= \a2'' ->
peekDoubleArray a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a2'', a3'')
{-# LINE 159 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorAtmYoySwapTimeRates :: YoYCapFloorTermPriceSurface -> IO [(Double, Double)]
yoyCapFloorAtmYoySwapTimeRates s = do
(ts, rs) <- qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates s
return $ zip ts rs
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates :: (YoYCapFloorTermPriceSurface) -> IO (([Double]), ([Double]))
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates a1 =
withGenTermStructure a1 $ \a1' ->
preDoubleArray $ \(a2'1, a2'2) ->
preDoubleArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates'_ a1' a2'1 a2'2 a3'1 a3'2 a4' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
peekDoubleArray a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a2'', a3'')
{-# LINE 168 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorAtmYoySwapRate :: (YoYCapFloorTermPriceSurface) -> (Day) -> (Bool)
-> IO ((Double))
yoyCapFloorAtmYoySwapRate a1 a2 a3 =
withGenTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {a3' = C2HSImp.fromBool a3} in
preErrorCheck $ \a4' ->
yoyCapFloorAtmYoySwapRate'_ a1' a2' a3' a4' >>= \res ->
let {res' = realToFrac res} in
errorCheck a4'>>
return (res')
{-# LINE 175 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorAtmYoyRate :: (YoYCapFloorTermPriceSurface) -> (Day) -> (Maybe (Word,TimeUnit))
-> (Bool)
-> IO ((Double))
yoyCapFloorAtmYoyRate a1 a2 a3 a4 =
withGenTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {(a3'1, a3'2) = fromMaybeEnumQuantity a3} in
let {a4' = C2HSImp.fromBool a4} in
preErrorCheck $ \a5' ->
yoyCapFloorAtmYoyRate'_ a1' a2' a3'1 a3'2 a4' a5' >>= \res ->
let {res' = realToFrac res} in
errorCheck a5'>>
return (res')
{-# LINE 183 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorStrikes :: (YoYCapFloorTermPriceSurface) -> IO (([Double]))
yoyCapFloorStrikes a1 =
withGenTermStructure a1 $ \a1' ->
preDoubleArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
yoyCapFloorStrikes'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 189 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
data YoyOptionletModel = YoyBlack
| YoyUnitDisplacedBlack
| YoyBachelier
deriving (Enum,Show,Eq,Read)
{-# LINE 192 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
kInterpolatedYoyOptionletVolatilitySurface
:: YoyOptionletModel
-> Word
-> Calendar -> BusinessDayConvention -> DayCounter
-> YoYCapFloorTermPriceSurface
-> GenYoYInflationIndex yidx
-> GenYieldTermStructure y
-> Double
-> Maybe (Double, Double)
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurface :: forall yidx y.
YoyOptionletModel
-> Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> GenYoYInflationIndex yidx
-> GenYieldTermStructure y
-> Double
-> Maybe (Double, Double)
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurface YoyOptionletModel
model Word
settlementDays Calendar
cal BusinessDayConvention
bdc DayCounter
dc YoYCapFloorTermPriceSurface
prices GenYoYInflationIndex yidx
index GenYieldTermStructure y
nominal Double
slope Maybe (Double, Double)
bracket Interpolation
i1d =
let (Bool
useBracket, Double
lower, Double
upper) = case Maybe (Double, Double)
bracket of Maybe (Double, Double)
Nothing -> (Bool
False, Double
1e-5, Double
0.08); Just (Double
lo, Double
hi) -> (Bool
True, Double
lo, Double
hi)
in (Int -> Int -> Int -> IO YoYOptionletVolatilitySurface)
-> (Int, (Int, Int)) -> IO YoYOptionletVolatilitySurface
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (YoyOptionletModel
-> Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> GenYoYInflationIndex yidx
-> GenYieldTermStructure y
-> Double
-> Bool
-> Double
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
forall yidx y.
YoyOptionletModel
-> Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> GenYoYInflationIndex yidx
-> GenYieldTermStructure y
-> Double
-> Bool
-> Double
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurface YoyOptionletModel
model Word
settlementDays Calendar
cal BusinessDayConvention
bdc DayCounter
dc YoYCapFloorTermPriceSurface
prices GenYoYInflationIndex yidx
index GenYieldTermStructure y
nominal Double
slope Bool
useBracket Double
lower Double
upper) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i1d)
qlKInterpolatedYoYOptionletVolatilitySurface :: (YoyOptionletModel) -> (Word) -> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> (YoYCapFloorTermPriceSurface) -> (GenYoYInflationIndex yidx) -> (GenYieldTermStructure y) -> (Double) -> (Bool) -> (Double) -> (Double) -> (Int) -> (Int) -> (Int) -> IO ((YoYOptionletVolatilitySurface))
qlKInterpolatedYoYOptionletVolatilitySurface :: forall yidx y.
YoyOptionletModel
-> Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> GenYoYInflationIndex yidx
-> GenYieldTermStructure y
-> Double
-> Bool
-> Double
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurface YoyOptionletModel
a1 Word
a2 Calendar
a3 BusinessDayConvention
a4 DayCounter
a5 YoYCapFloorTermPriceSurface
a6 GenYoYInflationIndex yidx
a7 GenYieldTermStructure y
a8 Double
a9 Bool
a10 Double
a11 Double
a12 Int
a13 Int
a14 Int
a15 =
let {a1' :: CInt
a1' = YoyOptionletModel -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC YoyOptionletModel
a1} in
let {a2' :: CUInt
a2' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a2} in
Calendar
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a3 ((Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a3' ->
let {a4' :: CInt
a4' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a4} in
DayCounter
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a5 ((Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a5' ->
YoYCapFloorTermPriceSurface
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall t b.
GenTermStructure (ForeignPtr t) -> (Ptr t -> IO b) -> IO b
withGenTermStructure YoYCapFloorTermPriceSurface
a6 ((Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYCapFloorTermPriceSurface'
a6' ->
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex GenYoYInflationIndex yidx
a7 ((Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a7' ->
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a8 ((Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a8' ->
let {a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9} in
let {a10' :: CInt
a10' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a10} in
let {a11' :: CDouble
a11' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a11} in
let {a12' :: CDouble
a12' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a12} in
let {a13' :: CInt
a13' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a13} in
let {a14' :: CInt
a14' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a14} in
let {a15' :: CInt
a15' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a15} in
(Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr ()) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a16' ->
CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> Ptr CYoYCapFloorTermPriceSurface'
-> Ptr CYoYInflationIndex'
-> Ptr CYieldTermStructure'
-> CDouble
-> CInt
-> CDouble
-> CDouble
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CYoYOptionletVolatilitySurface')
qlKInterpolatedYoYOptionletVolatilitySurface'_ CInt
a1' CUInt
a2' Ptr CCalendar
a3' CInt
a4' Ptr CDayCounter
a5' Ptr CYoYCapFloorTermPriceSurface'
a6' Ptr CYoYInflationIndex'
a7' Ptr CYieldTermStructure'
a8' CDouble
a9' CInt
a10' CDouble
a11' CDouble
a12' CInt
a13' CInt
a14' CInt
a15' Ptr (Ptr ())
a16' IO (Ptr CYoYOptionletVolatilitySurface')
-> (Ptr CYoYOptionletVolatilitySurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CYoYOptionletVolatilitySurface'
res ->
Ptr CYoYOptionletVolatilitySurface'
-> IO YoYOptionletVolatilitySurface
peekYoYOptionletVolatilityStructure Ptr CYoYOptionletVolatilitySurface'
res IO YoYOptionletVolatilitySurface
-> (YoYOptionletVolatilitySurface
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \YoYOptionletVolatilitySurface
res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a16'IO ()
-> IO YoYOptionletVolatilitySurface
-> IO YoYOptionletVolatilitySurface
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
YoYOptionletVolatilitySurface -> IO YoYOptionletVolatilitySurface
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (YoYOptionletVolatilitySurface
res')
{-# LINE 223 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
cpiCapFloorTermPriceSurface :: Double
-> Double
-> (Word, TimeUnit)
-> Calendar -> BusinessDayConvention -> DayCounter
-> GenZeroInflationIndex zidx -> CPIInterpolationType -> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D
-> IO CPICapFloorTermPriceSurface
cpiCapFloorTermPriceSurface :: forall zidx y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> GenZeroInflationIndex zidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D
-> IO CPICapFloorTermPriceSurface
cpiCapFloorTermPriceSurface Double
nom Double
baseRate (Word, TimeUnit)
obsLag Calendar
cal BusinessDayConvention
bdc DayCounter
dc GenZeroInflationIndex zidx
zii CPIInterpolationType
interp GenYieldTermStructure y
yts [Double]
cStrikes [Double]
fStrikes [(Word, TimeUnit)]
cfMaturities (RealMatrix Word
cr Word
cc RealVector
cd) (RealMatrix Word
fr Word
fc RealVector
fd) Interpolation2D
i2d =
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> GenZeroInflationIndex zidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> IO CPICapFloorTermPriceSurface
forall zidx y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> GenZeroInflationIndex zidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> IO CPICapFloorTermPriceSurface
qlCPICapFloorTermPriceSurface Double
nom Double
baseRate (Word, TimeUnit)
obsLag Calendar
cal BusinessDayConvention
bdc DayCounter
dc GenZeroInflationIndex zidx
zii CPIInterpolationType
interp GenYieldTermStructure y
yts [Double]
cStrikes [Double]
fStrikes [Word]
maturityNums [TimeUnit]
maturityUnits Word
cr Word
cc RealVector
cd Word
fr Word
fc RealVector
fd (Interpolation2D -> Int
forall a. Enum a => a -> Int
fromEnum Interpolation2D
i2d)
where ([Word]
maturityNums, [TimeUnit]
maturityUnits) = [(Word, TimeUnit)] -> ([Word], [TimeUnit])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Word, TimeUnit)]
cfMaturities
qlCPICapFloorTermPriceSurface :: (Double) -> (Double) -> ((Word,TimeUnit)) -> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> (GenZeroInflationIndex zidx) -> (CPIInterpolationType) -> (GenYieldTermStructure y) -> ([Double])
-> ([Double])
-> ([Word]) -> ([TimeUnit])
-> (Word) -> (Word) -> (RealVector)
-> (Word) -> (Word) -> (RealVector)
-> (Int)
-> IO ((CPICapFloorTermPriceSurface))
qlCPICapFloorTermPriceSurface :: forall zidx y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> GenZeroInflationIndex zidx
-> CPIInterpolationType
-> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> IO CPICapFloorTermPriceSurface
qlCPICapFloorTermPriceSurface Double
a1 Double
a2 (Word, TimeUnit)
a3 Calendar
a4 BusinessDayConvention
a5 DayCounter
a6 GenZeroInflationIndex zidx
a7 CPIInterpolationType
a8 GenYieldTermStructure y
a9 [Double]
a10 [Double]
a11 [Word]
a12 [TimeUnit]
a13 Word
a14 Word
a15 RealVector
a16 Word
a17 Word
a18 RealVector
a19 Int
a20 =
let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
let {(CInt
a3'1, CInt
a3'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
a3} in
Calendar
-> (Ptr CCalendar -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CCalendar -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' ->
let {a5' :: CInt
a5' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a5} in
DayCounter
-> (Ptr CDayCounter -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a6 ((Ptr CDayCounter -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CDayCounter -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a6' ->
GenZeroInflationIndex zidx
-> (Ptr CZeroInflationIndex' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall zidx b.
GenZeroInflationIndex zidx
-> (Ptr CZeroInflationIndex' -> IO b) -> IO b
withZeroInflationIndex GenZeroInflationIndex zidx
a7 ((Ptr CZeroInflationIndex' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CZeroInflationIndex' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CZeroInflationIndex'
a7' ->
let {a8' :: CInt
a8' = CPIInterpolationType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC CPIInterpolationType
a8} in
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a9 ((Ptr CYieldTermStructure' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CYieldTermStructure' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a9' ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a10 (((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> ((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a10'1, Ptr CDouble
a10'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a11 (((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> ((CUInt, Ptr CDouble) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr CDouble
a11'2) ->
[Word]
-> ((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a n b.
(Integral a, Num n, Storable n) =>
[a] -> ((CUInt, Ptr n) -> IO b) -> IO b
withIntArray [Word]
a12 (((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a12'1, Ptr CInt
a12'2) ->
[TimeUnit]
-> ((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. Enum a => [a] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withEnumArray [TimeUnit]
a13 (((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a13'1, Ptr CInt
a13'2) ->
let {a14' :: CUInt
a14' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a14} in
let {a15' :: CUInt
a15' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a15} in
RealVector
-> (Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. RealVector -> (Ptr CDouble -> IO b) -> IO b
withRealVectorRaw RealVector
a16 ((Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDouble
a16' ->
let {a17' :: CUInt
a17' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a17} in
let {a18' :: CUInt
a18' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a18} in
RealVector
-> (Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall b. RealVector -> (Ptr CDouble -> IO b) -> IO b
withRealVectorRaw RealVector
a19 ((Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr CDouble -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDouble
a19' ->
let {a20' :: CInt
a20' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a20} in
(Ptr (Ptr ()) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr (Ptr ()) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a21' ->
CDouble
-> CDouble
-> CInt
-> CInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> Ptr CZeroInflationIndex'
-> CInt
-> Ptr CYieldTermStructure'
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> CUInt
-> Ptr CDouble
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CCPICapFloorTermPriceSurface')
qlCPICapFloorTermPriceSurface'_ CDouble
a1' CDouble
a2' CInt
a3'1 CInt
a3'2 Ptr CCalendar
a4' CInt
a5' Ptr CDayCounter
a6' Ptr CZeroInflationIndex'
a7' CInt
a8' Ptr CYieldTermStructure'
a9' CUInt
a10'1 Ptr CDouble
a10'2 CUInt
a11'1 Ptr CDouble
a11'2 CUInt
a12'1 Ptr CInt
a12'2 CUInt
a13'1 Ptr CInt
a13'2 CUInt
a14' CUInt
a15' Ptr CDouble
a16' CUInt
a17' CUInt
a18' Ptr CDouble
a19' CInt
a20' Ptr (Ptr ())
a21' IO (Ptr CCPICapFloorTermPriceSurface')
-> (Ptr CCPICapFloorTermPriceSurface'
-> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CCPICapFloorTermPriceSurface'
res ->
Ptr CCPICapFloorTermPriceSurface' -> IO CPICapFloorTermPriceSurface
peekCPICapFloorTermPriceSurface Ptr CCPICapFloorTermPriceSurface'
Ptr CCalendar
res :: Ptr CCPICapFloorTermPriceSurface'
a3' :: Ptr CCalendar
res CInt
IO CPICapFloorTermPriceSurface
-> (CPICapFloorTermPriceSurface -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= :: forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
a4' :: CInt
>>= \res' ->
Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck Ptr (Ptr ())
a21'IO ()
-> IO CPICapFloorTermPriceSurface -> IO CPICapFloorTermPriceSurface
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
CPICapFloorTermPriceSurface -> IO CPICapFloorTermPriceSurface
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CPICapFloorTermPriceSurface
res')
{-# LINE 254 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
constantCpiVolatility :: (GenQuote q) -> (Word)
-> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> ((Word,TimeUnit))
-> (Frequency) -> (Bool)
-> IO ((CPIVolatilitySurface))
constantCpiVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
withQuote a1 $ \a1' ->
let {a2' = fromIntegral a2} in
withCalendar a3 $ \a3' ->
let {a4' = fromEnumC a4} in
withDayCounter a5 $ \a5' ->
let {(a6'1, a6'2) = fromEnumQuantity a6} in
let {a7' = (fromIntegral . fromEnum) a7} in
let {a8' = C2HSImp.fromBool a8} in
preErrorCheck $ \a9' ->
constantCpiVolatility'_ a1' a2' a3' a4' a5' a6'1 a6'2 a7' a8' a9' >>= \res ->
peekCPIVolatilitySurface res >>= \res' ->
errorCheck a9'>>
return (res')
{-# LINE 268 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
cpiVolatility :: (CPIVolatilitySurface) -> (Day) -> (Double)
-> (Maybe (Word,TimeUnit))
-> (Bool)
-> IO ((Double))
cpiVolatility a1 a2 a3 a4 a5 =
withGenVolatilityTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {a3' = realToFrac a3} in
let {(a4'1, a4'2) = fromMaybeEnumQuantity a4} in
let {a5' = C2HSImp.fromBool a5} in
preErrorCheck $ \a6' ->
cpiVolatility'_ a1' a2' a3' a4'1 a4'2 a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 277 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
cpiTotalVariance :: (CPIVolatilitySurface) -> (Day) -> (Double)
-> (Maybe (Word,TimeUnit))
-> (Bool)
-> IO ((Double))
cpiTotalVariance a1 a2 a3 a4 a5 =
withGenVolatilityTermStructure a1 $ \a1' ->
withDay a2 $ \a2' ->
let {a3' = realToFrac a3} in
let {(a4'1, a4'2) = fromMaybeEnumQuantity a4} in
let {a5' = C2HSImp.fromBool a5} in
preErrorCheck $ \a6' ->
cpiTotalVariance'_ a1' a2' a3' a4'1 a4'2 a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 286 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlConstantYoYOptionletVolatility"
constantYoyOptionletVolatility'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYoYOptionletVolatilitySurface')))))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYOptionletVolatilitySurfaceVolatility"
yoyOptionletVolatility'_ :: ((C2HSImp.Ptr (CYoYOptionletVolatilitySurface')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYOptionletVolatilitySurfaceTotalVariance"
yoyOptionletTotalVariance'_ :: ((C2HSImp.Ptr (CYoYOptionletVolatilitySurface')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurface"
qlYoYCapFloorTermPriceSurface'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYoYInflationIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYoYCapFloorTermPriceSurface'))))))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceBaseDate"
yoyCapFloorBaseDate'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates"
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapDateRates'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates"
qlYoYCapFloorTermPriceSurfaceAtmYoYSwapTimeRates'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceAtmYoYSwapRate"
yoyCapFloorAtmYoySwapRate'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceAtmYoYRate"
yoyCapFloorAtmYoyRate'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceStrikes"
yoyCapFloorStrikes'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlKInterpolatedYoYOptionletVolatilitySurface"
qlKInterpolatedYoYOptionletVolatilitySurface'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYoYOptionletVolatilitySurface')))))))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlCPICapFloorTermPriceSurface"
qlCPICapFloorTermPriceSurface'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CZeroInflationIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCPICapFloorTermPriceSurface')))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlConstantCPIVolatility"
constantCpiVolatility'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCPIVolatilitySurface')))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlCPIVolatilitySurfaceVolatility"
cpiVolatility'_ :: ((C2HSImp.Ptr (CCPIVolatilitySurface')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlCPIVolatilitySurfaceTotalVariance"
cpiTotalVariance'_ :: ((C2HSImp.Ptr (CCPIVolatilitySurface')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))