{-# LINE 1 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
module QuantLib.TermStructure.InflationVolatility
(
YoYOptionletVolatilitySurface
, YoYCapFloorTermPriceSurface
, CPICapFloorTermPriceSurface
, CPIVolatilitySurface
, constantYoyOptionletVolatility
, kInterpolatedYoyOptionletVolatilitySurfaceBlack
, kInterpolatedYoyOptionletVolatilitySurfaceUnitDisplacedBlack
, kInterpolatedYoyOptionletVolatilitySurfaceBachelier
, 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 46 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# LINE 47 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
{-# 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" #-}
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 CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a13' ->
Ptr CQuote'
-> CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> CInt
-> CInt
-> CInt
-> CInt
-> CDouble
-> CDouble
-> CInt
-> CDouble
-> Ptr (Ptr CChar)
-> IO (Ptr CYoYOptionletVolatilitySurface')
constantYoyOptionletVolatility'_ Ptr CQuote'
a1' CUInt
a2' :: CUInt
a1' :: Ptr CYoYOptionletVolatilitySurface'
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 CChar)
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 CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
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 75 "./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 84 "./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 94 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorTermPriceSurface :: Word
-> (Word, TimeUnit)
-> YoYInflationIndex -> CPIInterpolationType -> GenYieldTermStructure y
-> DayCounter -> Calendar -> BusinessDayConvention
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D -> Interpolation
-> IO YoYCapFloorTermPriceSurface
yoyCapFloorTermPriceSurface :: forall y.
Word
-> (Word, TimeUnit)
-> YoYInflationIndex
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D
-> Interpolation
-> IO YoYCapFloorTermPriceSurface
yoyCapFloorTermPriceSurface Word
fixingDays (Word, TimeUnit)
yyLag YoYInflationIndex
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 (Word
-> (Word, TimeUnit)
-> YoYInflationIndex
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
forall y.
Word
-> (Word, TimeUnit)
-> YoYInflationIndex
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
qlYoYCapFloorTermPriceSurface Word
fixingDays (Word, TimeUnit)
yyLag YoYInflationIndex
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 :: (Word)
-> ((Word,TimeUnit))
-> (YoYInflationIndex) -> (CPIInterpolationType) -> (GenYieldTermStructure y)
-> (DayCounter) -> (Calendar) -> (BusinessDayConvention) -> ([Double])
-> ([Double])
-> ([Word]) -> ([TimeUnit])
-> (Word) -> (Word) -> (RealVector)
-> (Word) -> (Word) -> (RealVector)
-> (Int)
-> (Int) -> (Int) -> (Int)
-> IO ((YoYCapFloorTermPriceSurface))
qlYoYCapFloorTermPriceSurface :: forall y.
Word
-> (Word, TimeUnit)
-> YoYInflationIndex
-> CPIInterpolationType
-> GenYieldTermStructure y
-> DayCounter
-> Calendar
-> BusinessDayConvention
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> Int
-> Int
-> Int
-> IO YoYCapFloorTermPriceSurface
qlYoYCapFloorTermPriceSurface Word
a1 (Word, TimeUnit)
a2 YoYInflationIndex
a3 CPIInterpolationType
a4 GenYieldTermStructure y
a5 DayCounter
a6 Calendar
a7 BusinessDayConvention
a8 [Double]
a9 [Double]
a10 [Word]
a11 [TimeUnit]
a12 Word
a13 Word
a14 RealVector
a15 Word
a16 Word
a17 RealVector
a18 Int
a19 Int
a20 Int
a21 Int
a22 =
let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in
let {(CInt
a2'1, CInt
a2'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
a2} in
YoYInflationIndex
-> (Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex YoYInflationIndex
a3 ((Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CYoYInflationIndex' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a3' ->
let {a4' :: CInt
a4' = CPIInterpolationType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC CPIInterpolationType
a4} in
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a5 ((Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CYieldTermStructure' -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a5' ->
DayCounter
-> (Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a6 ((Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CDayCounter -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a6' ->
Calendar
-> (Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a7 ((Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> (Ptr CCalendar -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a7' ->
let {a8' :: CInt
a8' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a8} in
[Double]
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a9 (((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CDouble) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a9'1, Ptr CDouble
a9'2) ->
[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) ->
[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]
a11 (((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(CUInt
a11'1, Ptr CInt
a11'2) ->
withEnumArray a12 (((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface)
-> ((CUInt, Ptr CInt) -> IO YoYCapFloorTermPriceSurface)
-> IO YoYCapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \(a12'1, a12'2) ->
let {a13' = fromIntegral a13} in
let {a14' = fromIntegral a14} in
withRealVectorRaw a15 $ \a15' ->
let {a16' = fromIntegral a16} in
let {a17' = fromIntegral a17} in
withRealVectorRaw a18 $ \a18' ->
let {a19' = fromIntegral a19} in
let {a20' = fromIntegral a20} in
let {a21' = fromIntegral a21} in
let {a22' = fromIntegral a22} in
preErrorCheck $ \a23' ->
qlYoYCapFloorTermPriceSurface'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9'1 a9'2 a10'1 a10'2 a11'1 a11'2 a12'1 a12'2 a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' >>= \res ->
peekYoYCapFloorTermPriceSurface res >>= \res' ->
errorCheck a23'>>
return (res')
{-# LINE 128 "./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 134 "./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' ->
preArray $ \(a2'1, a2'2) ->
preArray $ \(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 142 "./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' ->
preArray $ \(a2'1, a2'2) ->
preArray $ \(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 151 "./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 158 "./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 166 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
yoyCapFloorStrikes :: (YoYCapFloorTermPriceSurface) -> IO (([Double]))
yoyCapFloorStrikes a1 =
withGenTermStructure a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
yoyCapFloorStrikes'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 172 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
kInterpolatedYoyOptionletVolatilitySurfaceBlack :: Word
-> Calendar -> BusinessDayConvention -> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurfaceBlack :: forall y.
Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurfaceBlack Word
settlementDays Calendar
cal BusinessDayConvention
bdc DayCounter
dc YoYCapFloorTermPriceSurface
capFloorPrices YoYInflationIndex
index GenYieldTermStructure y
nominalTs Double
slope Interpolation
i1d =
(Int -> Int -> Int -> IO YoYOptionletVolatilitySurface)
-> (Int, (Int, Int)) -> IO YoYOptionletVolatilitySurface
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
forall y.
Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack Word
settlementDays Calendar
cal BusinessDayConvention
bdc DayCounter
dc YoYCapFloorTermPriceSurface
capFloorPrices YoYInflationIndex
index GenYieldTermStructure y
nominalTs Double
slope) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i1d)
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack :: (Word)
-> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> (YoYCapFloorTermPriceSurface)
-> (YoYInflationIndex)
-> (GenYieldTermStructure y)
-> (Double)
-> (Int) -> (Int) -> (Int)
-> IO ((YoYOptionletVolatilitySurface))
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack :: forall y.
Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack Word
a1 Calendar
a2 BusinessDayConvention
a3 DayCounter
a4 YoYCapFloorTermPriceSurface
a5 YoYInflationIndex
a6 GenYieldTermStructure y
a7 Double
a8 Int
a9 Int
a10 Int
a11 =
let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in
Calendar
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a2 ((Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a2' ->
let {a3' :: CInt
a3' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a3} in
DayCounter
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a4 ((Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a4' ->
YoYCapFloorTermPriceSurface
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall t b.
GenTermStructure (ForeignPtr t) -> (Ptr t -> IO b) -> IO b
withGenTermStructure YoYCapFloorTermPriceSurface
a5 ((Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYCapFloorTermPriceSurface'
a5' ->
YoYInflationIndex
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex YoYInflationIndex
a6 ((Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a6' ->
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a7 ((Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a7' ->
let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in
let {a9' :: CInt
a9' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a9} in
let {a10' :: CInt
a10' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a10} in
let {a11' :: CInt
a11' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a11} in
(Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a12' ->
CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> Ptr CYoYCapFloorTermPriceSurface'
-> Ptr CYoYInflationIndex'
-> Ptr CYieldTermStructure'
-> CDouble
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CYoYOptionletVolatilitySurface')
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack'_ CUInt
a1' Ptr CCalendar
a2' CInt
a3' Ptr CDayCounter
a4' Ptr CYoYCapFloorTermPriceSurface'
a5' Ptr CYoYInflationIndex'
a6' Ptr CYieldTermStructure'
a7' CDouble
a8' CInt
a9' CInt
a10' CInt
a11' Ptr (Ptr CChar)
a12' 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 CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a12'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 203 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
kInterpolatedYoyOptionletVolatilitySurfaceUnitDisplacedBlack :: Word
-> Calendar -> BusinessDayConvention -> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurfaceUnitDisplacedBlack settlementDays cal bdc dc capFloorPrices index nominalTs slope i1d =
uncurryNested (qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack settlementDays cal bdc dc capFloorPrices index nominalTs slope) (qlInterpolation i1d)
qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack :: (Word)
-> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> (YoYCapFloorTermPriceSurface)
-> (YoYInflationIndex)
-> (GenYieldTermStructure y)
-> (Double)
-> (Int) -> (Int) -> (Int)
-> IO ((YoYOptionletVolatilitySurface))
qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack :: forall y.
Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack Word
a1 Calendar
a2 BusinessDayConvention
a3 DayCounter
a4 YoYCapFloorTermPriceSurface
a5 YoYInflationIndex
a6 GenYieldTermStructure y
a7 Double
a8 Int
a9 Int
a10 Int
a11 =
let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in
Calendar
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a2 ((Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a2' ->
let {a3' :: CInt
a3' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a3} in
DayCounter
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a4 ((Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a4' ->
YoYCapFloorTermPriceSurface
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall t b.
GenTermStructure (ForeignPtr t) -> (Ptr t -> IO b) -> IO b
withGenTermStructure YoYCapFloorTermPriceSurface
a5 ((Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYCapFloorTermPriceSurface'
a5' ->
YoYInflationIndex
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex YoYInflationIndex
a6 ((Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a6' ->
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a7 ((Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a7' ->
let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in
let {a9' :: CInt
a9' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a9} in
let {a10' :: CInt
a10' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a10} in
let {a11' :: CInt
a11' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a11} in
(Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a12' ->
CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> Ptr CYoYCapFloorTermPriceSurface'
-> Ptr CYoYInflationIndex'
-> Ptr CYieldTermStructure'
-> CDouble
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CYoYOptionletVolatilitySurface')
qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack'_ CUInt
a1' Ptr CCalendar
a2' CInt
a3' Ptr CDayCounter
a4' Ptr CYoYCapFloorTermPriceSurface'
a5' Ptr CYoYInflationIndex'
a6' Ptr CYieldTermStructure'
a7' CDouble
a8' CInt
a9' CInt
a10' CInt
a11' Ptr (Ptr CChar)
a12' 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 CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a12'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 225 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
kInterpolatedYoyOptionletVolatilitySurfaceBachelier :: Word
-> Calendar -> BusinessDayConvention -> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Interpolation
-> IO YoYOptionletVolatilitySurface
kInterpolatedYoyOptionletVolatilitySurfaceBachelier settlementDays cal bdc dc capFloorPrices index nominalTs slope i1d =
uncurryNested (qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier settlementDays cal bdc dc capFloorPrices index nominalTs slope) (qlInterpolation i1d)
qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier :: (Word)
-> (Calendar) -> (BusinessDayConvention) -> (DayCounter) -> (YoYCapFloorTermPriceSurface)
-> (YoYInflationIndex)
-> (GenYieldTermStructure y)
-> (Double)
-> (Int) -> (Int) -> (Int)
-> IO ((YoYOptionletVolatilitySurface))
qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier :: forall y.
Word
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> YoYCapFloorTermPriceSurface
-> YoYInflationIndex
-> GenYieldTermStructure y
-> Double
-> Int
-> Int
-> Int
-> IO YoYOptionletVolatilitySurface
qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier Word
a1 Calendar
a2 BusinessDayConvention
a3 DayCounter
a4 YoYCapFloorTermPriceSurface
a5 YoYInflationIndex
a6 GenYieldTermStructure y
a7 Double
a8 Int
a9 Int
a10 Int
a11 =
let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in
Calendar
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a2 ((Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CCalendar -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a2' ->
let {a3' :: CInt
a3' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a3} in
DayCounter
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a4 ((Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CDayCounter -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a4' ->
YoYCapFloorTermPriceSurface
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall t b.
GenTermStructure (ForeignPtr t) -> (Ptr t -> IO b) -> IO b
withGenTermStructure YoYCapFloorTermPriceSurface
a5 ((Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYCapFloorTermPriceSurface'
-> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYCapFloorTermPriceSurface'
a5' ->
YoYInflationIndex
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall yidx b.
GenYoYInflationIndex yidx
-> (Ptr CYoYInflationIndex' -> IO b) -> IO b
withYoYInflationIndex YoYInflationIndex
a6 ((Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYoYInflationIndex' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYoYInflationIndex'
a6' ->
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a7 ((Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr CYieldTermStructure' -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a7' ->
let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in
let {a9' :: CInt
a9' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a9} in
let {a10' :: CInt
a10' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a10} in
let {a11' :: CInt
a11' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a11} in
(Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface)
-> (Ptr (Ptr CChar) -> IO YoYOptionletVolatilitySurface)
-> IO YoYOptionletVolatilitySurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a12' ->
CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CDayCounter
-> Ptr CYoYCapFloorTermPriceSurface'
-> Ptr CYoYInflationIndex'
-> Ptr CYieldTermStructure'
-> CDouble
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CYoYOptionletVolatilitySurface')
qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier'_ CUInt
a1' Ptr CCalendar
a2' CInt
a3' Ptr CDayCounter
a4' Ptr CYoYCapFloorTermPriceSurface'
a5' Ptr CYoYInflationIndex'
a6' Ptr CYieldTermStructure'
a7' CDouble
a8' CInt
a9' CInt
a10' CInt
a11' Ptr (Ptr CChar)
a12' 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 CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a12'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 247 "./QuantLib/TermStructure/InflationVolatility.chs" #-}
cpiCapFloorTermPriceSurface :: Double
-> Double
-> (Word, TimeUnit)
-> Calendar -> BusinessDayConvention -> DayCounter
-> ZeroInflationIndex -> CPIInterpolationType -> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [(Word, TimeUnit)]
-> RealMatrix
-> RealMatrix
-> Interpolation2D
-> IO CPICapFloorTermPriceSurface
cpiCapFloorTermPriceSurface :: forall y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> ZeroInflationIndex
-> 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 ZeroInflationIndex
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
-> ZeroInflationIndex
-> CPIInterpolationType
-> GenYieldTermStructure y
-> [Double]
-> [Double]
-> [Word]
-> [TimeUnit]
-> Word
-> Word
-> RealVector
-> Word
-> Word
-> RealVector
-> Int
-> IO CPICapFloorTermPriceSurface
forall y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> ZeroInflationIndex
-> 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 ZeroInflationIndex
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) -> (ZeroInflationIndex) -> (CPIInterpolationType) -> (GenYieldTermStructure y) -> ([Double])
-> ([Double])
-> ([Word]) -> ([TimeUnit])
-> (Word) -> (Word) -> (RealVector)
-> (Word) -> (Word) -> (RealVector)
-> (Int)
-> IO ((CPICapFloorTermPriceSurface))
qlCPICapFloorTermPriceSurface :: forall y.
Double
-> Double
-> (Word, TimeUnit)
-> Calendar
-> BusinessDayConvention
-> DayCounter
-> ZeroInflationIndex
-> 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 ZeroInflationIndex
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' ->
ZeroInflationIndex
-> (Ptr CZeroInflationIndex' -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall zidx b.
GenZeroInflationIndex zidx
-> (Ptr CZeroInflationIndex' -> IO b) -> IO b
withZeroInflationIndex ZeroInflationIndex
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 CChar) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface)
-> (Ptr (Ptr CChar) -> IO CPICapFloorTermPriceSurface)
-> IO CPICapFloorTermPriceSurface
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
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 CChar)
-> 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 CChar)
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'
res 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
>>= \CPICapFloorTermPriceSurface
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
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 278 "./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 292 "./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 301 "./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 310 "./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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurface"
qlYoYCapFloorTermPriceSurface'_ :: (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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')))))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceBaseDate"
yoyCapFloorBaseDate'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (IO ())))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlYoYCapFloorTermPriceSurfaceAtmYoYSwapRate"
yoyCapFloorAtmYoySwapRate'_ :: ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlKInterpolatedYoYOptionletVolatilitySurfaceBlack"
qlKInterpolatedYoYOptionletVolatilitySurfaceBlack'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYoYOptionletVolatilitySurface')))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack"
qlKInterpolatedYoYOptionletVolatilitySurfaceUnitDisplacedBlack'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYoYOptionletVolatilitySurface')))))))))))))))
foreign import ccall safe "QuantLib/TermStructure/InflationVolatility.chs.h qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier"
qlKInterpolatedYoYOptionletVolatilitySurfaceBachelier'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYoYCapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (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 C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))))