{-# LINE 1 "./QuantLib/Model.chs" #-}
{-# LANGUAGE FlexibleInstances #-}
module QuantLib.Model
(
GenCalibratedModel
, CalibratedModel
, GenShortRateModel
, ShortRateModel
, GenOneFactorAffineModel
, OneFactorAffineModel
, HullWhite
, G2
, GenHestonModel
, HestonModel
, PiecewiseTimeDependentHestonModel
, GenBatesModel
, BatesModel
, BatesDetJumpModel
, GenBatesDoubleExpModel
, BatesDoubleExpModel
, BatesDoubleExpDetJumpModel
, GJRGARCHModel
, Gaussian1dModel
, Gsr
, MarkovFunctional
, LiborForwardModel
, HestonSLVMCModel
, HestonSLVFDMModel
, AffineModel
, ShortRateDynamics
, Garch11
, Garch11Mode(..)
, GenCalibrationHelper
, CalibrationHelper
, GenBlackCalibrationHelper
, BlackCalibrationHelper
, SwaptionHelper
, BrownianGeneratorFactory
, CalibrationErrorType(..)
, SobolBrownianOrdering(..)
, HestonSLVGreensAlgorithm(..)
, HestonSLVVarianceTransformation(..)
, HestonSLVFokkerPlanckFdmParams(..)
, HestonSLVFDMLogEntry(..)
, LfmHullWhiteParameterization
, LmCorrelationModel(..)
, LmVolatilityModel(..)
, SwaptionSpan(..)
, AsAffineModel(..)
, AsGaussian1dModel(..)
, asCalibratedModel
, asHestonModel
, asShortRateModel
, asOneFactorAffineModel
, asBatesModel
, asBatesDoubleExpModel
, asCalibrationHelper
, asBlackCalibrationHelper
, batesModel
, blackKarasinski
, coxIngersollRoss
, extendedCoxIngersollRoss
, g2
, generalizedHullWhite
, gjrGarchModel
, hestonModel
, mtBrownianGeneratorFactory
, sobolBrownianGeneratorFactory
, hestonSlvMcModel
, hestonSlvFdmModel
, hullWhite
, varianceGammaModel
, vasicek
, liborForwardModel
, lfmHullWhiteParameterization
, gsr
, markovFunctional
, markovFunctionalCaplet
, garch11
, garch11Calibrated
, capHelper
, hestonModelHelper
, swaptionHelper
, setCovarParam
, calibrate
, calibrateVolatilitiesIterative
, moveVolatility
, moveReversion
, setPricingEngine
, discount
, discountBond
, discountBondOption
, convexityBias
, numeraire
, gaussian1dZerobond
, gaussian1dZerobondOption
, gaussian1dForwardRate
, gaussian1dSwapRate
, gaussian1dSwapAnnuity
, gaussian1dYGrid
, lfmHullWhiteCovariance
, liborForwardModelS0
, blackPrice
, impliedVolatility
, HasLeverageFunction(..)
, HasVolatilities(..)
, HasHelperUnderlying(..)
, g2Dynamics
, shortRate
, stateProcess
, hestonSlvFdmLogEntries
, helperSwaption
, times
, fixedReversion
, params
, value
, calibrationError
, marketValue
, modelValue
, volatility
, forecast
, calculate
, garmanKlassSimpleSigma
, garmanKlassSigma1
, parkinsonSigma
, garmanKlassSigma3
, garmanKlassSigma4
, garmanKlassSigma5
, garmanKlassSigma6
, constantVolatilityEstimator
, simpleLocalVolatilityEstimator
, alpha
, beta
, omega
, longTermVolatility
, logLikelihood
) 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 qualified System.IO.Unsafe as C2HSImp
import QuantLib.Internal
import QuantLib.Time.Schedule(Frequency)
import QuantLib.InterestRate(VolatilityType)
import QuantLib.CashFlow(RateAveragingType)
import QuantLib.Internal.Type
import QuantLib.Internal.Common
import QuantLib.TermStructure(HasHelperUnderlying(..))
import QuantLib.Math(SobolDirectionIntegers)
import Data.List(genericTake)
import Data.List.NonEmpty(NonEmpty, toList)
import Data.Maybe(fromMaybe)
data CalibrationErrorType = RelativePriceError
| PriceError
| ImpliedVolError
deriving (Int -> CalibrationErrorType
CalibrationErrorType -> Int
CalibrationErrorType -> [CalibrationErrorType]
CalibrationErrorType -> CalibrationErrorType
CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType]
CalibrationErrorType
-> CalibrationErrorType
-> CalibrationErrorType
-> [CalibrationErrorType]
(CalibrationErrorType -> CalibrationErrorType)
-> (CalibrationErrorType -> CalibrationErrorType)
-> (Int -> CalibrationErrorType)
-> (CalibrationErrorType -> Int)
-> (CalibrationErrorType -> [CalibrationErrorType])
-> (CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType])
-> (CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType])
-> (CalibrationErrorType
-> CalibrationErrorType
-> CalibrationErrorType
-> [CalibrationErrorType])
-> Enum CalibrationErrorType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: CalibrationErrorType -> CalibrationErrorType
succ :: CalibrationErrorType -> CalibrationErrorType
$cpred :: CalibrationErrorType -> CalibrationErrorType
pred :: CalibrationErrorType -> CalibrationErrorType
$ctoEnum :: Int -> CalibrationErrorType
toEnum :: Int -> CalibrationErrorType
$cfromEnum :: CalibrationErrorType -> Int
fromEnum :: CalibrationErrorType -> Int
$cenumFrom :: CalibrationErrorType -> [CalibrationErrorType]
enumFrom :: CalibrationErrorType -> [CalibrationErrorType]
$cenumFromThen :: CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType]
enumFromThen :: CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType]
$cenumFromTo :: CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType]
enumFromTo :: CalibrationErrorType
-> CalibrationErrorType -> [CalibrationErrorType]
$cenumFromThenTo :: CalibrationErrorType
-> CalibrationErrorType
-> CalibrationErrorType
-> [CalibrationErrorType]
enumFromThenTo :: CalibrationErrorType
-> CalibrationErrorType
-> CalibrationErrorType
-> [CalibrationErrorType]
Enum,Int -> CalibrationErrorType -> ShowS
[CalibrationErrorType] -> ShowS
CalibrationErrorType -> String
(Int -> CalibrationErrorType -> ShowS)
-> (CalibrationErrorType -> String)
-> ([CalibrationErrorType] -> ShowS)
-> Show CalibrationErrorType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CalibrationErrorType -> ShowS
showsPrec :: Int -> CalibrationErrorType -> ShowS
$cshow :: CalibrationErrorType -> String
show :: CalibrationErrorType -> String
$cshowList :: [CalibrationErrorType] -> ShowS
showList :: [CalibrationErrorType] -> ShowS
Show,CalibrationErrorType -> CalibrationErrorType -> Bool
(CalibrationErrorType -> CalibrationErrorType -> Bool)
-> (CalibrationErrorType -> CalibrationErrorType -> Bool)
-> Eq CalibrationErrorType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CalibrationErrorType -> CalibrationErrorType -> Bool
== :: CalibrationErrorType -> CalibrationErrorType -> Bool
$c/= :: CalibrationErrorType -> CalibrationErrorType -> Bool
/= :: CalibrationErrorType -> CalibrationErrorType -> Bool
Eq,ReadPrec [CalibrationErrorType]
ReadPrec CalibrationErrorType
Int -> ReadS CalibrationErrorType
ReadS [CalibrationErrorType]
(Int -> ReadS CalibrationErrorType)
-> ReadS [CalibrationErrorType]
-> ReadPrec CalibrationErrorType
-> ReadPrec [CalibrationErrorType]
-> Read CalibrationErrorType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS CalibrationErrorType
readsPrec :: Int -> ReadS CalibrationErrorType
$creadList :: ReadS [CalibrationErrorType]
readList :: ReadS [CalibrationErrorType]
$creadPrec :: ReadPrec CalibrationErrorType
readPrec :: ReadPrec CalibrationErrorType
$creadListPrec :: ReadPrec [CalibrationErrorType]
readListPrec :: ReadPrec [CalibrationErrorType]
Read)
{-# LINE 188 "./QuantLib/Model.chs" #-}
data Garch11Mode = MomentMatchingGuess
| GammaGuess
| BestOfTwo
| DoubleOptimization
deriving (Enum,Show,Eq,Read)
{-# LINE 189 "./QuantLib/Model.chs" #-}
data SobolBrownianOrdering = Factors | Steps | Diagonal deriving (Show, Eq, Read, Enum, Bounded)
data HestonSLVGreensAlgorithm = ZeroCorrelation | Gaussian | SemiAnalytical deriving (Show, Eq, Read, Enum, Bounded)
data HestonSLVVarianceTransformation = Plain | Power | Log deriving (Show, Eq, Read, Enum, Bounded)
data HestonSLVFokkerPlanckFdmParams = HestonSLVFokkerPlanckFdmParams
{ HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvXGrid :: !Word, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvVGrid :: !Word
, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvTMaxStepsPerYear :: !Word, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvTMinStepsPerYear :: !Word, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvTStepNumberDecay :: !Double
, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvNRannacherTimeSteps :: !Word, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvPredictionCorrectionSteps :: !Word
, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvX0Density :: !Double, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvLocalVolEpsProb :: !Double, HestonSLVFokkerPlanckFdmParams -> Word
hestonSlvMaxIntegrationIterations :: !Word
, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvVLowerEps :: !Double, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvVUpperEps :: !Double, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvVMin :: !Double
, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvV0Density :: !Double, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvVLowerBoundDensity :: !Double, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvVUpperBoundDensity :: !Double
, HestonSLVFokkerPlanckFdmParams -> Double
hestonSlvLeverageFctPropEps :: !Double, HestonSLVFokkerPlanckFdmParams -> HestonSLVGreensAlgorithm
hestonSlvGreensAlgorithm :: !HestonSLVGreensAlgorithm
, HestonSLVFokkerPlanckFdmParams -> HestonSLVVarianceTransformation
hestonSlvVarianceTransformation :: !HestonSLVVarianceTransformation, HestonSLVFokkerPlanckFdmParams -> FdmScheme
hestonSlvSchemeDesc :: !FdmScheme
}
data HestonSLVFDMLogEntry = HestonSLVFDMLogEntry
{ HestonSLVFDMLogEntry -> Double
hestonSlvLogTime :: !Double, HestonSLVFDMLogEntry -> RealVector
hestonSlvLogSpotCoordinates :: !RealVector
, HestonSLVFDMLogEntry -> RealVector
hestonSlvLogVarianceCoordinates :: !RealVector, HestonSLVFDMLogEntry -> RealMatrix
hestonSlvLogDensity :: !RealMatrix
} deriving (Int -> HestonSLVFDMLogEntry -> ShowS
[HestonSLVFDMLogEntry] -> ShowS
HestonSLVFDMLogEntry -> String
(Int -> HestonSLVFDMLogEntry -> ShowS)
-> (HestonSLVFDMLogEntry -> String)
-> ([HestonSLVFDMLogEntry] -> ShowS)
-> Show HestonSLVFDMLogEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HestonSLVFDMLogEntry -> ShowS
showsPrec :: Int -> HestonSLVFDMLogEntry -> ShowS
$cshow :: HestonSLVFDMLogEntry -> String
show :: HestonSLVFDMLogEntry -> String
$cshowList :: [HestonSLVFDMLogEntry] -> ShowS
showList :: [HestonSLVFDMLogEntry] -> ShowS
Show, HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool
(HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool)
-> (HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool)
-> Eq HestonSLVFDMLogEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool
== :: HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool
$c/= :: HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool
/= :: HestonSLVFDMLogEntry -> HestonSLVFDMLogEntry -> Bool
Eq)
{-# LINE 220 "./QuantLib/Model.chs" #-}
{-# LINE 221 "./QuantLib/Model.chs" #-}
{-# LINE 222 "./QuantLib/Model.chs" #-}
{-# LINE 223 "./QuantLib/Model.chs" #-}
{-# LINE 224 "./QuantLib/Model.chs" #-}
{-# LINE 225 "./QuantLib/Model.chs" #-}
{-# LINE 226 "./QuantLib/Model.chs" #-}
{-# LINE 227 "./QuantLib/Model.chs" #-}
{-# LINE 228 "./QuantLib/Model.chs" #-}
{-# LINE 229 "./QuantLib/Model.chs" #-}
{-# LINE 230 "./QuantLib/Model.chs" #-}
{-# LINE 231 "./QuantLib/Model.chs" #-}
{-# LINE 232 "./QuantLib/Model.chs" #-}
{-# LINE 233 "./QuantLib/Model.chs" #-}
{-# LINE 234 "./QuantLib/Model.chs" #-}
{-# LINE 235 "./QuantLib/Model.chs" #-}
{-# LINE 236 "./QuantLib/Model.chs" #-}
{-# LINE 237 "./QuantLib/Model.chs" #-}
{-# LINE 238 "./QuantLib/Model.chs" #-}
{-# LINE 239 "./QuantLib/Model.chs" #-}
{-# LINE 240 "./QuantLib/Model.chs" #-}
{-# LINE 241 "./QuantLib/Model.chs" #-}
{-# LINE 242 "./QuantLib/Model.chs" #-}
{-# LINE 243 "./QuantLib/Model.chs" #-}
{-# LINE 244 "./QuantLib/Model.chs" #-}
{-# LINE 245 "./QuantLib/Model.chs" #-}
{-# LINE 246 "./QuantLib/Model.chs" #-}
{-# LINE 247 "./QuantLib/Model.chs" #-}
{-# LINE 248 "./QuantLib/Model.chs" #-}
{-# LINE 249 "./QuantLib/Model.chs" #-}
{-# LINE 250 "./QuantLib/Model.chs" #-}
{-# LINE 251 "./QuantLib/Model.chs" #-}
{-# LINE 252 "./QuantLib/Model.chs" #-}
{-# LINE 253 "./QuantLib/Model.chs" #-}
{-# LINE 254 "./QuantLib/Model.chs" #-}
{-# LINE 255 "./QuantLib/Model.chs" #-}
{-# LINE 256 "./QuantLib/Model.chs" #-}
{-# LINE 257 "./QuantLib/Model.chs" #-}
{-# LINE 258 "./QuantLib/Model.chs" #-}
batesModel :: (BatesProcess) -> IO ((BatesModel))
batesModel :: BatesProcess -> IO BatesModel
batesModel BatesProcess
a1 =
BatesProcess
-> (Ptr CBatesProcess' -> IO BatesModel) -> IO BatesModel
forall b. BatesProcess -> (Ptr CBatesProcess' -> IO b) -> IO b
withBatesProcess BatesProcess
a1 ((Ptr CBatesProcess' -> IO BatesModel) -> IO BatesModel)
-> (Ptr CBatesProcess' -> IO BatesModel) -> IO BatesModel
forall a b. (a -> b) -> a -> b
$ \Ptr CBatesProcess'
a1' ->
(Ptr (Ptr CChar) -> IO BatesModel) -> IO BatesModel
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO BatesModel) -> IO BatesModel)
-> (Ptr (Ptr CChar) -> IO BatesModel) -> IO BatesModel
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' ->
Ptr CBatesProcess' -> Ptr (Ptr CChar) -> IO (Ptr CBatesModel')
batesModel'_ Ptr CBatesProcess'
a1' Ptr (Ptr CChar)
a2' IO (Ptr CBatesModel')
-> (Ptr CBatesModel' -> IO BatesModel) -> IO BatesModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CBatesModel'
res ->
Ptr CBatesModel' -> IO BatesModel
peekBatesModel Ptr CBatesModel'
res IO BatesModel -> (BatesModel -> IO BatesModel) -> IO BatesModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \BatesModel
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a2'IO () -> IO BatesModel -> IO BatesModel
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
BatesModel -> IO BatesModel
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (BatesModel
res')
{-# LINE 261 "./QuantLib/Model.chs" #-}
blackKarasinski :: (GenYieldTermStructure y) -> (Double)
-> (Double)
-> IO ((ShortRateModel))
blackKarasinski a1 a2 a3 =
withYieldTermStructure a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
preErrorCheck $ \a4' ->
blackKarasinski'_ a1' a2' a3' a4' >>= \res ->
peekShortRateModel res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 266 "./QuantLib/Model.chs" #-}
coxIngersollRoss :: (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Bool)
-> IO ((OneFactorAffineModel))
coxIngersollRoss a1 a2 a3 a4 a5 =
let {a1' = realToFrac a1} in
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
let {a5' = C2HSImp.fromBool a5} in
preErrorCheck $ \a6' ->
coxIngersollRoss'_ a1' a2' a3' a4' a5' a6' >>= \res ->
peekOneFactorAffineModel res >>= \res' ->
errorCheck a6'>>
return (res')
{-# LINE 274 "./QuantLib/Model.chs" #-}
extendedCoxIngersollRoss :: (GenYieldTermStructure y) -> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Bool)
-> IO ((OneFactorAffineModel))
extendedCoxIngersollRoss a1 a2 a3 a4 a5 a6 =
withYieldTermStructure a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
let {a5' = realToFrac a5} in
let {a6' = C2HSImp.fromBool a6} in
preErrorCheck $ \a7' ->
extendedCoxIngersollRoss'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
peekOneFactorAffineModel res >>= \res' ->
errorCheck a7'>>
return (res')
{-# LINE 282 "./QuantLib/Model.chs" #-}
g2 :: (GenYieldTermStructure y) -> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> IO ((G2))
g2 a1 a2 a3 a4 a5 a6 =
withYieldTermStructure a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
let {a5' = realToFrac a5} in
let {a6' = realToFrac a6} in
preErrorCheck $ \a7' ->
g2'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
peekG2 res >>= \res' ->
errorCheck a7'>>
return (res')
{-# LINE 290 "./QuantLib/Model.chs" #-}
g2Dynamics :: (G2) -> IO ((ShortRateDynamics))
g2Dynamics a1 =
withG2 a1 $ \a1' ->
preErrorCheck $ \a2' ->
g2Dynamics'_ a1' a2' >>= \res ->
peekStandalone res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 293 "./QuantLib/Model.chs" #-}
shortRate :: (ShortRateDynamics) -> (Double)
-> (Double)
-> (Double)
-> IO ((Double))
shortRate a1 a2 a3 a4 =
withStandalone a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
preErrorCheck $ \a5' ->
shortRate'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = realToFrac res} in
errorCheck a5'>>
return (res')
{-# LINE 300 "./QuantLib/Model.chs" #-}
generalizedHullWhite :: GenYieldTermStructure y -> NonEmpty (Day, Double)
-> NonEmpty (Day, Double)
-> IO ShortRateModel
generalizedHullWhite ts s v = qlGeneralizedHullWhite ts sd vd sq vq where {(sd, sq) = unzip (toList s); (vd, vq) = unzip (toList v)}
qlGeneralizedHullWhite :: (GenYieldTermStructure y) -> ([Day]) -> ([Day]) -> ([Double]) -> ([Double]) -> IO ((ShortRateModel))
qlGeneralizedHullWhite a1 a2 a3 a4 a5 =
withYieldTermStructure a1 $ \a1' ->
withDayArray a2 $ \(a2'1, a2'2) ->
withDayArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
preErrorCheck $ \a6' ->
qlGeneralizedHullWhite'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6' >>= \res ->
peekShortRateModel res >>= \res' ->
errorCheck a6'>>
return (res')
{-# LINE 307 "./QuantLib/Model.chs" #-}
gjrGarchModel :: (GJRGARCHProcess) -> IO ((GJRGARCHModel))
gjrGarchModel a1 =
withGenStochasticProcess a1 $ \a1' ->
preErrorCheck $ \a2' ->
gjrGarchModel'_ a1' a2' >>= \res ->
peekGJRGARCHModel res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 310 "./QuantLib/Model.chs" #-}
hestonModel :: (GenHestonProcess hp) -> IO ((HestonModel))
hestonModel a1 =
withHestonProcess a1 $ \a1' ->
preErrorCheck $ \a2' ->
hestonModel'_ a1' a2' >>= \res ->
peekHestonModel res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 313 "./QuantLib/Model.chs" #-}
mtBrownianGeneratorFactory :: (Word)
-> IO ((BrownianGeneratorFactory))
mtBrownianGeneratorFactory a1 =
let {a1' = fromIntegral a1} in
preErrorCheck $ \a2' ->
mtBrownianGeneratorFactory'_ a1' a2' >>= \res ->
peekBrownianGeneratorFactory res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 318 "./QuantLib/Model.chs" #-}
sobolBrownianGeneratorFactory :: (SobolBrownianOrdering)
-> (Word)
-> (SobolDirectionIntegers)
-> IO ((BrownianGeneratorFactory))
sobolBrownianGeneratorFactory a1 a2 a3 =
let {a1' = fromEnumC a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromEnumC a3} in
preErrorCheck $ \a4' ->
sobolBrownianGeneratorFactory'_ a1' a2' a3' a4' >>= \res ->
peekBrownianGeneratorFactory res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 325 "./QuantLib/Model.chs" #-}
hestonSlvMcModel :: (GenLocalVolTermStructure lv)
-> (GenHestonModel hm)
-> (BrownianGeneratorFactory)
-> (Day)
-> (Word)
-> (Word)
-> (Word)
-> ([Day])
-> (Double)
-> IO ((HestonSLVMCModel))
hestonSlvMcModel :: forall lv hm.
GenLocalVolTermStructure lv
-> GenHestonModel hm
-> BrownianGeneratorFactory
-> Day
-> Word
-> Word
-> Word
-> [Day]
-> Double
-> IO HestonSLVMCModel
hestonSlvMcModel GenLocalVolTermStructure lv
a1 GenHestonModel hm
a2 BrownianGeneratorFactory
a3 Day
a4 Word
a5 Word
a6 Word
a7 [Day]
a8 Double
a9 =
GenLocalVolTermStructure lv
-> (Ptr CLocalVolTermStructure' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall lv b.
GenLocalVolTermStructure lv
-> (Ptr CLocalVolTermStructure' -> IO b) -> IO b
withGenLocalVolTermStructure GenLocalVolTermStructure lv
a1 ((Ptr CLocalVolTermStructure' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel)
-> (Ptr CLocalVolTermStructure' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall a b. (a -> b) -> a -> b
$ \Ptr CLocalVolTermStructure'
a1' ->
GenHestonModel hm
-> (Ptr CHestonModel' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall hm b.
GenHestonModel hm -> (Ptr CHestonModel' -> IO b) -> IO b
withHestonModel GenHestonModel hm
a2 ((Ptr CHestonModel' -> IO HestonSLVMCModel) -> IO HestonSLVMCModel)
-> (Ptr CHestonModel' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall a b. (a -> b) -> a -> b
$ \Ptr CHestonModel'
a2' ->
BrownianGeneratorFactory
-> (Ptr CBrownianGeneratorFactory' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall b.
BrownianGeneratorFactory
-> (Ptr CBrownianGeneratorFactory' -> IO b) -> IO b
withBrownianGeneratorFactory BrownianGeneratorFactory
a3 ((Ptr CBrownianGeneratorFactory' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel)
-> (Ptr CBrownianGeneratorFactory' -> IO HestonSLVMCModel)
-> IO HestonSLVMCModel
forall a b. (a -> b) -> a -> b
$ \Ptr CBrownianGeneratorFactory'
a3' ->
Day -> (CInt -> IO HestonSLVMCModel) -> IO HestonSLVMCModel
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a4 ((CInt -> IO HestonSLVMCModel) -> IO HestonSLVMCModel)
-> (CInt -> IO HestonSLVMCModel) -> IO HestonSLVMCModel
forall a b. (a -> b) -> a -> b
$ \CInt
a4' ->
let {a5' = fromIntegral a5} in
let {a6' = fromIntegral a6} in
let {a7' = fromIntegral a7} in
withDayArray a8 $ \(a8'1, a8'2) ->
let {a9' = realToFrac a9} in
preErrorCheck $ \a10' ->
hestonSlvMcModel'_ a1' a2' a3' a4' a5' a6' a7' a8'1 a8'2 a9' a10' >>= \res ->
peekHestonSLVMCModel res >>= \res' ->
errorCheck a10'>>
return (res')
{-# LINE 339 "./QuantLib/Model.chs" #-}
qlHestonSLVMCModelLeverageFunction :: (HestonSLVMCModel)
-> IO ((LocalVolTermStructure))
qlHestonSLVMCModelLeverageFunction a1 =
withHestonSLVMCModel a1 $ \a1' ->
preErrorCheck $ \a2' ->
qlHestonSLVMCModelLeverageFunction'_ a1' a2' >>= \res ->
peekLocalVolTermStructure res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 343 "./QuantLib/Model.chs" #-}
hestonSlvFdmModel :: GenLocalVolTermStructure lv -> GenHestonModel hm -> Day
-> HestonSLVFokkerPlanckFdmParams -> Bool -> [Day] -> Double -> IO HestonSLVFDMModel
hestonSlvFdmModel localVol model endDate p logging mandatoryDates mixingFactor =
hestonSlvFdmModelRaw localVol model endDate
(hestonSlvXGrid p) (hestonSlvVGrid p) (hestonSlvTMaxStepsPerYear p) (hestonSlvTMinStepsPerYear p)
(hestonSlvTStepNumberDecay p) (hestonSlvNRannacherTimeSteps p) (hestonSlvPredictionCorrectionSteps p)
(hestonSlvX0Density p) (hestonSlvLocalVolEpsProb p) (hestonSlvMaxIntegrationIterations p)
(hestonSlvVLowerEps p) (hestonSlvVUpperEps p) (hestonSlvVMin p) (hestonSlvV0Density p)
(hestonSlvVLowerBoundDensity p) (hestonSlvVUpperBoundDensity p) (hestonSlvLeverageFctPropEps p)
(hestonSlvGreensAlgorithm p) (hestonSlvVarianceTransformation p) (hestonSlvSchemeDesc p)
logging mandatoryDates mixingFactor
hestonSlvFdmModelRaw :: (GenLocalVolTermStructure lv)
-> (GenHestonModel hm)
-> (Day)
-> (Word)
-> (Word)
-> (Word)
-> (Word)
-> (Double)
-> (Word)
-> (Word)
-> (Double)
-> (Double)
-> (Word)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> (HestonSLVGreensAlgorithm)
-> (HestonSLVVarianceTransformation)
-> (FdmScheme)
-> (Bool)
-> ([Day])
-> (Double)
-> IO ((HestonSLVFDMModel))
hestonSlvFdmModelRaw :: forall lv hm.
GenLocalVolTermStructure lv
-> GenHestonModel hm
-> Day
-> Word
-> Word
-> Word
-> Word
-> Double
-> Word
-> Word
-> Double
-> Double
-> Word
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> HestonSLVGreensAlgorithm
-> HestonSLVVarianceTransformation
-> FdmScheme
-> Bool
-> [Day]
-> Double
-> IO HestonSLVFDMModel
hestonSlvFdmModelRaw GenLocalVolTermStructure lv
a1 GenHestonModel hm
a2 Day
a3 Word
a4 Word
a5 Word
a6 Word
a7 Double
a8 Word
a9 Word
a10 Double
a11 Double
a12 Word
a13 Double
a14 Double
a15 Double
a16 Double
a17 Double
a18 Double
a19 Double
a20 HestonSLVGreensAlgorithm
a21 HestonSLVVarianceTransformation
a22 FdmScheme
a23 Bool
a24 [Day]
a25 Double
a26 =
GenLocalVolTermStructure lv
-> (Ptr CLocalVolTermStructure' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel
forall lv b.
GenLocalVolTermStructure lv
-> (Ptr CLocalVolTermStructure' -> IO b) -> IO b
withGenLocalVolTermStructure GenLocalVolTermStructure lv
a1 ((Ptr CLocalVolTermStructure' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel)
-> (Ptr CLocalVolTermStructure' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel
forall a b. (a -> b) -> a -> b
$ \Ptr CLocalVolTermStructure'
a1' ->
GenHestonModel hm
-> (Ptr CHestonModel' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel
forall hm b.
GenHestonModel hm -> (Ptr CHestonModel' -> IO b) -> IO b
withHestonModel GenHestonModel hm
a2 ((Ptr CHestonModel' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel)
-> (Ptr CHestonModel' -> IO HestonSLVFDMModel)
-> IO HestonSLVFDMModel
forall a b. (a -> b) -> a -> b
$ \Ptr CHestonModel'
a2' ->
Day -> (CInt -> IO HestonSLVFDMModel) -> IO HestonSLVFDMModel
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a3 ((CInt -> IO HestonSLVFDMModel) -> IO HestonSLVFDMModel)
-> (CInt -> IO HestonSLVFDMModel) -> IO HestonSLVFDMModel
forall a b. (a -> b) -> a -> b
$ \CInt
a3' ->
let {a4' :: CUInt
a4' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a4} in
let {a5' :: CUInt
a5' = fromIntegral a5} in
let {a6' = fromIntegral a6} in
let {a7' = fromIntegral a7} in
let {a8' = realToFrac a8} in
let {a9' = fromIntegral a9} in
let {a10' = fromIntegral a10} in
let {a11' = realToFrac a11} in
let {a12' = realToFrac a12} in
let {a13' = fromIntegral a13} in
let {a14' = realToFrac a14} in
let {a15' = realToFrac a15} in
let {a16' = realToFrac a16} in
let {a17' = realToFrac a17} in
let {a18' = realToFrac a18} in
let {a19' = realToFrac a19} in
let {a20' = realToFrac a20} in
let {a21' = fromEnumC a21} in
let {a22' = fromEnumC a22} in
withFdmSchemeDesc a23 $ \a23' ->
let {a24' = C2HSImp.fromBool a24} in
withDayArray a25 $ \(a25'1, a25'2) ->
let {a26' = realToFrac a26} in
preErrorCheck $ \a27' ->
hestonSlvFdmModelRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25'1 a25'2 a26' a27' >>= \res ->
peekHestonSLVFDMModel res >>= \res' ->
errorCheck a27'>>
return (res')
{-# LINE 385 "./QuantLib/Model.chs" #-}
qlHestonSLVFDMModelLeverageFunction :: (HestonSLVFDMModel)
-> IO ((LocalVolTermStructure))
qlHestonSLVFDMModelLeverageFunction a1 =
withHestonSLVFDMModel a1 $ \a1' ->
preErrorCheck $ \a2' ->
qlHestonSLVFDMModelLeverageFunction'_ a1' a2' >>= \res ->
peekLocalVolTermStructure res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 389 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntries :: HestonSLVFDMModel -> IO [HestonSLVFDMLogEntry]
hestonSlvFdmLogEntries model = do
snapshot <- hestonSlvFdmLogEntriesSnapshot model
let n = hestonSlvFdmLogEntriesSize snapshot
mapM (hestonSlvFdmLogEntry snapshot) (genericTake n [0 ..])
hestonSlvFdmLogEntry :: HestonSLVFDMLogEntries -> Word -> IO HestonSLVFDMLogEntry
hestonSlvFdmLogEntry snapshot i = do
t <- hestonSlvFdmLogEntriesTime snapshot i
x <- hestonSlvFdmLogEntriesSpotGrid snapshot i
v <- hestonSlvFdmLogEntriesVarianceGrid snapshot i
(r, c, d) <- hestonSlvFdmLogEntriesDensity snapshot i
pure $ HestonSLVFDMLogEntry t x v (RealMatrix r c d)
hestonSlvFdmLogEntriesSnapshot :: (HestonSLVFDMModel) -> IO ((HestonSLVFDMLogEntries))
hestonSlvFdmLogEntriesSnapshot a1 =
withHestonSLVFDMModel a1 $ \a1' ->
preErrorCheck $ \a2' ->
hestonSlvFdmLogEntriesSnapshot'_ a1' a2' >>= \res ->
peekHestonSLVFDMLogEntries res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 408 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntriesSize :: (HestonSLVFDMLogEntries) -> (Word)
hestonSlvFdmLogEntriesSize a1 =
C2HSImp.unsafePerformIO $
withHestonSLVFDMLogEntries a1 $ \a1' ->
hestonSlvFdmLogEntriesSize'_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 409 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntriesTime :: (HestonSLVFDMLogEntries) -> (Word) -> IO ((Double))
hestonSlvFdmLogEntriesTime a1 a2 =
withHestonSLVFDMLogEntries a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preErrorCheck $ \a3' ->
hestonSlvFdmLogEntriesTime'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 410 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntriesSpotGrid :: (HestonSLVFDMLogEntries) -> (Word) -> IO ((RealVector))
hestonSlvFdmLogEntriesSpotGrid a1 a2 =
withHestonSLVFDMLogEntries a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
hestonSlvFdmLogEntriesSpotGrid'_ a1' a2' a3'1 a3'2 a4' >>
peekRealVector a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a3'')
{-# LINE 411 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntriesVarianceGrid :: (HestonSLVFDMLogEntries) -> (Word) -> IO ((RealVector))
hestonSlvFdmLogEntriesVarianceGrid a1 a2 =
withHestonSLVFDMLogEntries a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
hestonSlvFdmLogEntriesVarianceGrid'_ a1' a2' a3'1 a3'2 a4' >>
peekRealVector a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a3'')
{-# LINE 412 "./QuantLib/Model.chs" #-}
hestonSlvFdmLogEntriesDensity :: (HestonSLVFDMLogEntries) -> (Word) -> IO ((Word), (Word), (RealVector))
hestonSlvFdmLogEntriesDensity a1 a2 =
withHestonSLVFDMLogEntries a1 $ \a1' ->
let {a2' = fromIntegral a2} in
prePtr $ \a3' ->
prePtr $ \a4' ->
preArray $ \(a5'1, a5'2) ->
preErrorCheck $ \a6' ->
hestonSlvFdmLogEntriesDensity'_ a1' a2' a3' a4' a5'1 a5'2 a6' >>
peekWord a3'>>= \a3'' ->
peekWord a4'>>= \a4'' ->
peekRealVector a5'1 a5'2>>= \a5'' ->
errorCheck a6'>>
return (a3'', a4'', a5'')
{-# LINE 413 "./QuantLib/Model.chs" #-}
hullWhite :: (GenYieldTermStructure y) -> (Double)
-> (Double)
-> IO ((HullWhite))
hullWhite a1 a2 a3 =
withYieldTermStructure a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
preErrorCheck $ \a4' ->
hullWhite'_ a1' a2' a3' a4' >>= \res ->
peekHullWhite res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 418 "./QuantLib/Model.chs" #-}
convexityBias :: (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> IO ((Double))
convexityBias :: Double -> Double -> Double -> Double -> Double -> IO Double
convexityBias Double
a1 Double
a2 Double
a3 Double
a4 Double
a5 =
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 {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in
let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in
(Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' ->
CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> Ptr (Ptr CChar)
-> IO CDouble
convexityBias'_ CDouble
a1' CDouble
a2' CDouble
a3' CDouble
a4' CDouble
a5' Ptr (Ptr CChar)
a6' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a6'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 429 "./QuantLib/Model.chs" #-}
fixedReversion :: [Bool]
fixedReversion = [True, False]
gsr :: GenYieldTermStructure y -> GenQuote q1 -> [(Day, GenQuote q1)] -> GenQuote q2 -> Double -> IO Gsr
gsr ts initialVol subsequentVols reversion horizon =
qlGsr ts dates (initialVol : vols) reversion horizon
where (dates, vols) = unzip subsequentVols
qlGsr :: (GenYieldTermStructure y) -> ([Day])
-> ([GenQuote q1])
-> (GenQuote q2)
-> (Double)
-> IO ((Gsr))
qlGsr :: forall y q1 q2.
GenYieldTermStructure y
-> [Day] -> [GenQuote q1] -> GenQuote q2 -> Double -> IO Gsr
qlGsr GenYieldTermStructure y
a1 [Day]
a2 [GenQuote q1]
a3 GenQuote q2
a4 Double
a5 =
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO Gsr) -> IO Gsr
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO Gsr) -> IO Gsr)
-> (Ptr CYieldTermStructure' -> IO Gsr) -> IO Gsr
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' ->
[Day] -> ((CUInt, Ptr CInt) -> IO Gsr) -> IO Gsr
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a2 (((CUInt, Ptr CInt) -> IO Gsr) -> IO Gsr)
-> ((CUInt, Ptr CInt) -> IO Gsr) -> IO Gsr
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr CInt
a2'2) ->
withQuoteArray a3 $ \(a3'1, a3'2) ->
withQuote a4 $ \a4' ->
let {a5' = realToFrac a5} in
preErrorCheck $ \a6' ->
qlGsr'_ a1' a2'1 a2'2 a3'1 a3'2 a4' a5' a6' >>= \res ->
peekGsr res >>= \res' ->
errorCheck a6'>>
return (res')
{-# LINE 445 "./QuantLib/Model.chs" #-}
qlGsrVolatility :: (Gsr) -> IO (([Double]))
qlGsrVolatility a1 =
withGenCalibratedModel a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
qlGsrVolatility'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 448 "./QuantLib/Model.chs" #-}
moveVolatility :: (Gsr) -> (Word)
-> IO (([Bool]))
moveVolatility a1 a2 =
withGenCalibratedModel a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
moveVolatility'_ a1' a2' a3'1 a3'2 a4' >>
peekBoolArray a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a3'')
{-# LINE 455 "./QuantLib/Model.chs" #-}
moveReversion :: (Gsr) -> (Word)
-> IO (([Bool]))
moveReversion a1 a2 =
withGenCalibratedModel a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preArray $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
moveReversion'_ a1' a2' a3'1 a3'2 a4' >>
peekBoolArray a3'1 a3'2>>= \a3'' ->
errorCheck a4'>>
return (a3'')
{-# LINE 461 "./QuantLib/Model.chs" #-}
calibrateVolatilitiesIterative :: (Gsr) -> ([GenBlackCalibrationHelper bch]) -> (OptimizationMethod) -> (EndCriteria) -> (Maybe Constraint) -> ([Double]) -> IO ()
calibrateVolatilitiesIterative a1 a2 a3 a4 a5 a6 =
withGenCalibratedModel a1 $ \a1' ->
withBlackCalibrationHelperArray a2 $ \(a2'1, a2'2) ->
withOptimizationMethod a3 $ \a3' ->
withEndCriteria a4 $ \a4' ->
withMaybeConstraint a5 $ \a5' ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
preErrorCheck $ \a7' ->
calibrateVolatilitiesIterative'_ a1' a2'1 a2'2 a3' a4' a5' a6'1 a6'2 a7' >>
errorCheck a7'>>
return ()
{-# LINE 467 "./QuantLib/Model.chs" #-}
markovFunctional :: GenYieldTermStructure y -> Double
-> Double
-> [(Day, Double)]
-> SwaptionVolatilityStructure
-> NonEmpty (Day, (Word, TimeUnit))
-> GenSwapIndex sidx
-> Word
-> IO MarkovFunctional
markovFunctional :: forall y sidx.
GenYieldTermStructure y
-> Double
-> Double
-> [(Day, Double)]
-> SwaptionVolatilityStructure
-> NonEmpty (Day, (Word, TimeUnit))
-> GenSwapIndex sidx
-> Word
-> IO MarkovFunctional
markovFunctional GenYieldTermStructure y
ts Double
reversion Double
initialVol [(Day, Double)]
steps SwaptionVolatilityStructure
svol NonEmpty (Day, (Word, TimeUnit))
points = GenYieldTermStructure y
-> Double
-> [Day]
-> [Double]
-> SwaptionVolatilityStructure
-> [Day]
-> [Word]
-> [TimeUnit]
-> GenSwapIndex sidx
-> Word
-> IO MarkovFunctional
forall y sv sidx.
GenYieldTermStructure y
-> Double
-> [Day]
-> [Double]
-> GenSwaptionVolatilityStructure sv
-> [Day]
-> [Word]
-> [TimeUnit]
-> GenSwapIndex sidx
-> Word
-> IO MarkovFunctional
qlMarkovFunctional GenYieldTermStructure y
ts Double
reversion [Day]
dates (Double
initialVol Double -> [Double] -> [Double]
forall a. a -> [a] -> [a]
: [Double]
vols) SwaptionVolatilityStructure
svol [Day]
expiries [Word]
tq [TimeUnit]
tu
where ([Day]
dates, [Double]
vols) = [(Day, Double)] -> ([Day], [Double])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Day, Double)]
steps
([Day]
expiries, [(Word, TimeUnit)]
tenors) = [(Day, (Word, TimeUnit))] -> ([Day], [(Word, TimeUnit)])
forall a b. [(a, b)] -> ([a], [b])
unzip (NonEmpty (Day, (Word, TimeUnit)) -> [(Day, (Word, TimeUnit))]
forall a. NonEmpty a -> [a]
toList NonEmpty (Day, (Word, TimeUnit))
points)
([Word]
tq, [TimeUnit]
tu) = [(Word, TimeUnit)] -> ([Word], [TimeUnit])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Word, TimeUnit)]
tenors
qlMarkovFunctional :: (GenYieldTermStructure y) -> (Double) -> ([Day]) -> ([Double]) -> (GenSwaptionVolatilityStructure sv) -> ([Day]) -> ([Word]) -> ([TimeUnit]) -> (GenSwapIndex sidx) -> (Word) -> IO ((MarkovFunctional))
qlMarkovFunctional :: forall y sv sidx.
GenYieldTermStructure y
-> Double
-> [Day]
-> [Double]
-> GenSwaptionVolatilityStructure sv
-> [Day]
-> [Word]
-> [TimeUnit]
-> GenSwapIndex sidx
-> Word
-> IO MarkovFunctional
qlMarkovFunctional GenYieldTermStructure y
a1 Double
a2 [Day]
a3 [Double]
a4 GenSwaptionVolatilityStructure sv
a5 [Day]
a6 [Word]
a7 [TimeUnit]
a8 GenSwapIndex sidx
a9 Word
a10 =
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> (Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' ->
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
[Day]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a3 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CInt
a3'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a4 (((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> ((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr CDouble
a4'2) ->
GenSwaptionVolatilityStructure sv
-> (Ptr CSwaptionVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall sv b.
GenSwaptionVolatilityStructure sv
-> (Ptr CSwaptionVolatilityStructure' -> IO b) -> IO b
withSwaptionVolatilityStructure GenSwaptionVolatilityStructure sv
a5 ((Ptr CSwaptionVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> (Ptr CSwaptionVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr CSwaptionVolatilityStructure'
a5' ->
[Day]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a6 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a6'1, Ptr CInt
a6'2) ->
[Word]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a n b.
(Integral a, Num n, Storable n) =>
[a] -> ((CUInt, Ptr n) -> IO b) -> IO b
withIntArray [Word]
a7 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a7'1, Ptr CInt
a7'2) ->
[TimeUnit]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. Enum a => [a] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withEnumArray [TimeUnit]
a8 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a8'1, Ptr CInt
a8'2) ->
GenSwapIndex sidx
-> (Ptr CSwapIndex' -> IO MarkovFunctional) -> IO MarkovFunctional
forall sidx b.
GenSwapIndex sidx -> (Ptr CSwapIndex' -> IO b) -> IO b
withSwapIndex GenSwapIndex sidx
a9 ((Ptr CSwapIndex' -> IO MarkovFunctional) -> IO MarkovFunctional)
-> (Ptr CSwapIndex' -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr CSwapIndex'
a9' ->
let {a10' :: CUInt
a10' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a10} in
(Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> (Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a11' ->
Ptr CYieldTermStructure'
-> CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> Ptr CSwaptionVolatilityStructure'
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CInt
-> Ptr CSwapIndex'
-> CUInt
-> Ptr (Ptr CChar)
-> IO (Ptr CMarkovFunctional')
qlMarkovFunctional'_ Ptr CYieldTermStructure'
a1' CDouble
a2' CUInt
a3'1 Ptr CInt
a3'2 CUInt
a4'1 Ptr CDouble
a4'2 Ptr CSwaptionVolatilityStructure'
a5' CUInt
a6'1 Ptr CInt
a6'2 CUInt
a7'1 Ptr CInt
a7'2 CUInt
a8'1 Ptr CInt
a8'2 Ptr CSwapIndex'
a9' CUInt
a10' Ptr (Ptr CChar)
a11' IO (Ptr CMarkovFunctional')
-> (Ptr CMarkovFunctional' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CMarkovFunctional'
res ->
Ptr CMarkovFunctional' -> IO MarkovFunctional
peekMarkovFunctional Ptr CMarkovFunctional'
res IO MarkovFunctional
-> (MarkovFunctional -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \MarkovFunctional
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a11'IO () -> IO MarkovFunctional -> IO MarkovFunctional
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
MarkovFunctional -> IO MarkovFunctional
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (MarkovFunctional
res')
{-# LINE 489 "./QuantLib/Model.chs" #-}
markovFunctionalCaplet :: GenYieldTermStructure y -> Double -> Double -> [(Day, Double)]
-> OptionletVolatilityStructure -> NonEmpty Day -> GenIborIndex ibor -> Word -> IO MarkovFunctional
markovFunctionalCaplet ts reversion initialVol steps capletVol expiries ibor gridPoints =
qlMarkovFunctionalCaplet ts reversion dates (initialVol : vols) capletVol (toList expiries) ibor gridPoints
where (dates, vols) = unzip steps
qlMarkovFunctionalCaplet :: (GenYieldTermStructure y) -> (Double)
-> ([Day])
-> ([Double])
-> (OptionletVolatilityStructure)
-> ([Day])
-> (GenIborIndex ibor)
-> (Word)
-> IO ((MarkovFunctional))
qlMarkovFunctionalCaplet :: forall y ibor.
GenYieldTermStructure y
-> Double
-> [Day]
-> [Double]
-> OptionletVolatilityStructure
-> [Day]
-> GenIborIndex ibor
-> Word
-> IO MarkovFunctional
qlMarkovFunctionalCaplet GenYieldTermStructure y
a1 Double
a2 [Day]
a3 [Double]
a4 OptionletVolatilityStructure
a5 [Day]
a6 GenIborIndex ibor
a7 Word
a8 =
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> (Ptr CYieldTermStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' ->
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
[Day]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a3 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CInt
a3'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a4 (((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> ((CUInt, Ptr CDouble) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr CDouble
a4'2) ->
OptionletVolatilityStructure
-> (Ptr COptionletVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall ov b.
GenOptionletVolatilityStructure ov
-> (Ptr COptionletVolatilityStructure' -> IO b) -> IO b
withOptionletVolatilityStructure OptionletVolatilityStructure
a5 ((Ptr COptionletVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional)
-> (Ptr COptionletVolatilityStructure' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr COptionletVolatilityStructure'
a5' ->
[Day]
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a6 (((CUInt, Ptr CInt) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> ((CUInt, Ptr CInt) -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \(CUInt
a6'1, Ptr CInt
a6'2) ->
GenIborIndex ibor
-> (Ptr CIborIndex' -> IO MarkovFunctional) -> IO MarkovFunctional
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a7 ((Ptr CIborIndex' -> IO MarkovFunctional) -> IO MarkovFunctional)
-> (Ptr CIborIndex' -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a7' ->
let {a8' :: CUInt
a8' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a8} in
(Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional)
-> (Ptr (Ptr CChar) -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' ->
Ptr CYieldTermStructure'
-> CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> Ptr COptionletVolatilityStructure'
-> CUInt
-> Ptr CInt
-> Ptr CIborIndex'
-> CUInt
-> Ptr (Ptr CChar)
-> IO (Ptr CMarkovFunctional')
qlMarkovFunctionalCaplet'_ Ptr CYieldTermStructure'
a1' CDouble
a2' CUInt
a3'1 Ptr CInt
a3'2 CUInt
a4'1 Ptr CDouble
a4'2 Ptr COptionletVolatilityStructure'
a5' CUInt
a6'1 Ptr CInt
a6'2 Ptr CIborIndex'
a7' CUInt
a8' Ptr (Ptr CChar)
a9' IO (Ptr CMarkovFunctional')
-> (Ptr CMarkovFunctional' -> IO MarkovFunctional)
-> IO MarkovFunctional
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CMarkovFunctional'
res ->
Ptr CMarkovFunctional' -> IO MarkovFunctional
peekMarkovFunctional Ptr CMarkovFunctional'
res IO MarkovFunctional
-> (MarkovFunctional -> IO MarkovFunctional) -> IO MarkovFunctional
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \MarkovFunctional
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a9'IO () -> IO MarkovFunctional -> IO MarkovFunctional
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
MarkovFunctional -> IO MarkovFunctional
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (MarkovFunctional
res')
{-# LINE 504 "./QuantLib/Model.chs" #-}
qlMarkovFunctionalVolatility :: (MarkovFunctional) -> IO (([Double]))
qlMarkovFunctionalVolatility a1 =
withGenCalibratedModel a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
qlMarkovFunctionalVolatility'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 507 "./QuantLib/Model.chs" #-}
discount :: (AffineModel) -> (Double)
-> IO ((Double))
discount a1 a2 =
withStandalone a1 $ \a1' ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
discount'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 514 "./QuantLib/Model.chs" #-}
discountBond :: (AffineModel) -> (Double)
-> (Double)
-> ([Double])
-> IO ((Double))
discountBond :: AffineModel -> Double -> Double -> [Double] -> IO Double
discountBond AffineModel
a1 Double
a2 Double
a3 [Double]
a4 =
AffineModel -> (Ptr CAffineModel' -> IO Double) -> IO Double
forall a b. Standalone a -> (Ptr a -> IO b) -> IO b
withStandalone AffineModel
a1 ((Ptr CAffineModel' -> IO Double) -> IO Double)
-> (Ptr CAffineModel' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CAffineModel'
a1' ->
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
[Double] -> ((CUInt, Ptr CDouble) -> IO Double) -> IO Double
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a4 (((CUInt, Ptr CDouble) -> IO Double) -> IO Double)
-> ((CUInt, Ptr CDouble) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr CDouble
a4'2) ->
(Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a5' ->
Ptr CAffineModel'
-> CDouble
-> CDouble
-> CUInt
-> Ptr CDouble
-> Ptr (Ptr CChar)
-> IO CDouble
discountBond'_ Ptr CAffineModel'
a1' CDouble
a2' CDouble
a3' CUInt
a4'1 Ptr CDouble
a4'2 Ptr (Ptr CChar)
a5' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a5'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 525 "./QuantLib/Model.chs" #-}
discountBondOption_ :: (AffineModel) -> (OptionType)
-> (Double)
-> (Double)
-> (Bool)
-> (Double)
-> (Double)
-> IO ((Double))
discountBondOption_ a1 a2 a3 a4 a5 a6 a7 =
withStandalone a1 $ \a1' ->
let {a2' = fromEnumC a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
let {a5' = C2HSImp.fromBool a5} in
let {a6' = realToFrac a6} in
let {a7' = realToFrac a7} in
preErrorCheck $ \a8' ->
discountBondOption_'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
let {res' = realToFrac res} in
errorCheck a8'>>
return (res')
{-# LINE 534 "./QuantLib/Model.chs" #-}
discountBondOption :: AffineModel -> OptionType -> Double -> Double -> Maybe Double -> Double -> IO Double
discountBondOption model typ strike maturity bondStart bondMaturity =
discountBondOption_ model typ strike maturity (maybe False (const True) bondStart) (fromMaybe 0 bondStart) bondMaturity
numeraire :: (Gaussian1dModel) -> (Day)
-> (Double)
-> (Maybe (GenYieldTermStructure y))
-> IO ((Double))
numeraire :: forall y.
Gaussian1dModel
-> Day -> Double -> Maybe (GenYieldTermStructure y) -> IO Double
numeraire Gaussian1dModel
a1 Day
a2 Double
a3 Maybe (GenYieldTermStructure y)
a4 =
Gaussian1dModel
-> (Ptr CGaussian1dModel' -> IO Double) -> IO Double
forall a b. Standalone a -> (Ptr a -> IO b) -> IO b
withStandalone Gaussian1dModel
a1 ((Ptr CGaussian1dModel' -> IO Double) -> IO Double)
-> (Ptr CGaussian1dModel' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CGaussian1dModel'
a1' ->
Day -> (CInt -> IO Double) -> IO Double
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a2 ((CInt -> IO Double) -> IO Double)
-> (CInt -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \CInt
a2' ->
let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO Double) -> IO Double
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (GenYieldTermStructure y)
a4 ((Ptr CYieldTermStructure' -> IO Double) -> IO Double)
-> (Ptr CYieldTermStructure' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a4' ->
(Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a5' ->
Ptr CGaussian1dModel'
-> CInt
-> CDouble
-> Ptr CYieldTermStructure'
-> Ptr (Ptr CChar)
-> IO CDouble
numeraire'_ Ptr CGaussian1dModel'
a1' CInt
a2' CDouble
a3' Ptr CYieldTermStructure'
a4' Ptr (Ptr CChar)
a5' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a5'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 550 "./QuantLib/Model.chs" #-}
gaussian1dZerobond :: (Gaussian1dModel) -> (Day)
-> (Maybe Day)
-> (Double)
-> (Maybe (GenYieldTermStructure y))
-> IO ((Double))
gaussian1dZerobond a1 a2 a3 a4 a5 =
withStandalone a1 $ \a1' ->
withDay a2 $ \a2' ->
withMaybeDay a3 $ \a3' ->
let {a4' = realToFrac a4} in
withMaybeYieldTermStructure a5 $ \a5' ->
preErrorCheck $ \a6' ->
gaussian1dZerobond'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 560 "./QuantLib/Model.chs" #-}
gaussian1dZerobondOption :: (Gaussian1dModel) -> (OptionType)
-> (Day)
-> (Day)
-> (Day)
-> (Double)
-> (Maybe Day)
-> (Double)
-> (Maybe (GenYieldTermStructure y))
-> (Double)
-> (Word)
-> (Bool)
-> (Bool)
-> IO ((Double))
gaussian1dZerobondOption :: forall y.
Gaussian1dModel
-> OptionType
-> Day
-> Day
-> Day
-> Double
-> Maybe Day
-> Double
-> Maybe (GenYieldTermStructure y)
-> Double
-> Word
-> Bool
-> Bool
-> IO Double
gaussian1dZerobondOption Gaussian1dModel
a1 OptionType
a2 Day
a3 Day
a4 Day
a5 Double
a6 Maybe Day
a7 Double
a8 Maybe (GenYieldTermStructure y)
a9 Double
a10 Word
a11 Bool
a12 Bool
a13 =
Gaussian1dModel
-> (Ptr CGaussian1dModel' -> IO Double) -> IO Double
forall a b. Standalone a -> (Ptr a -> IO b) -> IO b
withStandalone Gaussian1dModel
a1 ((Ptr CGaussian1dModel' -> IO Double) -> IO Double)
-> (Ptr CGaussian1dModel' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CGaussian1dModel'
a1' ->
let {a2' :: CInt
a2' = OptionType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC OptionType
a2} in
Day -> (CInt -> IO Double) -> IO Double
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a3 ((CInt -> IO Double) -> IO Double)
-> (CInt -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \CInt
a3' ->
Day -> (CInt -> IO Double) -> IO Double
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a4 ((CInt -> IO Double) -> IO Double)
-> (CInt -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \CInt
a4' ->
Day -> (CInt -> IO Double) -> IO Double
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a5 ((CInt -> IO Double) -> IO Double)
-> (CInt -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \CInt
a5' ->
let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in
Maybe Day -> (CInt -> IO Double) -> IO Double
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a7 ((CInt -> IO Double) -> IO Double)
-> (CInt -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \CInt
a7' ->
let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO Double) -> IO Double
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (GenYieldTermStructure y)
a9 ((Ptr CYieldTermStructure' -> IO Double) -> IO Double)
-> (Ptr CYieldTermStructure' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a9' ->
let {a10' :: CDouble
a10' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a10} in
let {a11' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a11} in
let {a12' :: CInt
a12' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a12} in
let {a13' :: CInt
a13' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a13} in
(Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a14' ->
Ptr CGaussian1dModel'
-> CInt
-> CInt
-> CInt
-> CInt
-> CDouble
-> CInt
-> CDouble
-> Ptr CYieldTermStructure'
-> CDouble
-> CUInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO CDouble
gaussian1dZerobondOption'_ Ptr CGaussian1dModel'
a1' CInt
a2' CInt
a3' CInt
a4' CInt
a5' CDouble
a6' CInt
a7' CDouble
a8' Ptr CYieldTermStructure'
a9' CDouble
a10' CUInt
a11' CInt
a12' CInt
a13' Ptr (Ptr CChar)
a14' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a14'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 581 "./QuantLib/Model.chs" #-}
gaussian1dForwardRate :: (Gaussian1dModel) -> (Day)
-> (Maybe Day)
-> (Double)
-> (Maybe (GenIborIndex ibor))
-> IO ((Double))
gaussian1dForwardRate a1 a2 a3 a4 a5 =
withStandalone a1 $ \a1' ->
withDay a2 $ \a2' ->
withMaybeDay a3 $ \a3' ->
let {a4' = realToFrac a4} in
withMaybeIborIndex a5 $ \a5' ->
preErrorCheck $ \a6' ->
gaussian1dForwardRate'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = realToFrac res} in
errorCheck a6'>>
return (res')
{-# LINE 591 "./QuantLib/Model.chs" #-}
gaussian1dSwapRate :: (Gaussian1dModel) -> (Day)
-> ((Int,TimeUnit))
-> (Maybe Day)
-> (Double)
-> (Maybe (GenSwapIndex sidx))
-> IO ((Double))
gaussian1dSwapRate a1 a2 a3 a4 a5 a6 =
withStandalone a1 $ \a1' ->
withDay a2 $ \a2' ->
let {(a3'1, a3'2) = fromEnumQuantity a3} in
withMaybeDay a4 $ \a4' ->
let {a5' = realToFrac a5} in
withMaybeSwapIndex a6 $ \a6' ->
preErrorCheck $ \a7' ->
gaussian1dSwapRate'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' >>= \res ->
let {res' = realToFrac res} in
errorCheck a7'>>
return (res')
{-# LINE 601 "./QuantLib/Model.chs" #-}
gaussian1dSwapAnnuity :: (Gaussian1dModel) -> (Day)
-> ((Int,TimeUnit))
-> (Maybe Day)
-> (Double)
-> (Maybe (GenSwapIndex sidx))
-> IO ((Double))
gaussian1dSwapAnnuity a1 a2 a3 a4 a5 a6 =
withStandalone a1 $ \a1' ->
withDay a2 $ \a2' ->
let {(a3'1, a3'2) = fromEnumQuantity a3} in
withMaybeDay a4 $ \a4' ->
let {a5' = realToFrac a5} in
withMaybeSwapIndex a6 $ \a6' ->
preErrorCheck $ \a7' ->
gaussian1dSwapAnnuity'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' >>= \res ->
let {res' = realToFrac res} in
errorCheck a7'>>
return (res')
{-# LINE 612 "./QuantLib/Model.chs" #-}
gaussian1dYGrid :: (Gaussian1dModel) -> (Double)
-> (Int)
-> (Double)
-> (Double)
-> (Double)
-> IO ((RealVector))
gaussian1dYGrid a1 a2 a3 a4 a5 a6 =
withStandalone a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = fromIntegral a3} in
let {a4' = realToFrac a4} in
let {a5' = realToFrac a5} in
let {a6' = realToFrac a6} in
preArray $ \(a7'1, a7'2) ->
preErrorCheck $ \a8' ->
gaussian1dYGrid'_ a1' a2' a3' a4' a5' a6' a7'1 a7'2 a8' >>
peekRealVector a7'1 a7'2>>= \a7'' ->
errorCheck a8'>>
return (a7'')
{-# LINE 624 "./QuantLib/Model.chs" #-}
stateProcess :: (Gaussian1dModel) -> IO ((StochasticProcess1D))
stateProcess a1 =
withStandalone a1 $ \a1' ->
preErrorCheck $ \a2' ->
stateProcess'_ a1' a2' >>= \res ->
peekStochasticProcess1D res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 627 "./QuantLib/Model.chs" #-}
class HasLeverageFunction a where
leverageFunction :: a -> IO LocalVolTermStructure
instance HasLeverageFunction HestonSLVMCModel where
leverageFunction = qlHestonSLVMCModelLeverageFunction
instance HasLeverageFunction HestonSLVFDMModel where
leverageFunction = qlHestonSLVFDMModelLeverageFunction
class HasVolatilities a where
volatilities :: a -> IO [Double]
instance HasVolatilities Gsr where
volatilities :: Gsr -> IO [Double]
volatilities = Gsr -> IO [Double]
qlGsrVolatility
instance HasVolatilities MarkovFunctional where
volatilities :: MarkovFunctional -> IO [Double]
volatilities = MarkovFunctional -> IO [Double]
qlMarkovFunctionalVolatility
varianceGammaModel :: (VarianceGammaProcess) -> IO ((CalibratedModel))
varianceGammaModel :: VarianceGammaProcess -> IO CalibratedModel
varianceGammaModel VarianceGammaProcess
a1 =
VarianceGammaProcess
-> (Ptr CVarianceGammaProcess' -> IO CalibratedModel)
-> IO CalibratedModel
forall p1d b.
GenStochasticProcess1D (ForeignPtr p1d)
-> (Ptr p1d -> IO b) -> IO b
withGenStochasticProcess1D VarianceGammaProcess
a1 ((Ptr CVarianceGammaProcess' -> IO CalibratedModel)
-> IO CalibratedModel)
-> (Ptr CVarianceGammaProcess' -> IO CalibratedModel)
-> IO CalibratedModel
forall a b. (a -> b) -> a -> b
$ \Ptr CVarianceGammaProcess'
a1' ->
(Ptr (Ptr CChar) -> IO CalibratedModel) -> IO CalibratedModel
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO CalibratedModel) -> IO CalibratedModel)
-> (Ptr (Ptr CChar) -> IO CalibratedModel) -> IO CalibratedModel
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' ->
Ptr CVarianceGammaProcess'
-> Ptr (Ptr CChar) -> IO (Ptr CCalibratedModel')
varianceGammaModel'_ Ptr CVarianceGammaProcess'
a1' Ptr (Ptr CChar)
a2' IO (Ptr CCalibratedModel')
-> (Ptr CCalibratedModel' -> IO CalibratedModel)
-> IO CalibratedModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CCalibratedModel'
res ->
Ptr CCalibratedModel' -> IO CalibratedModel
peekCalibratedModel Ptr CCalibratedModel'
res IO CalibratedModel
-> (CalibratedModel -> IO CalibratedModel) -> IO CalibratedModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CalibratedModel
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a2'IO () -> IO CalibratedModel -> IO CalibratedModel
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
CalibratedModel -> IO CalibratedModel
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CalibratedModel
res')
{-# LINE 646 "./QuantLib/Model.chs" #-}
vasicek :: (Double)
-> (Double)
-> (Double)
-> (Double)
-> (Double)
-> IO ((OneFactorAffineModel))
vasicek :: Double
-> Double -> Double -> Double -> Double -> IO OneFactorAffineModel
vasicek Double
a1 Double
a2 Double
a3 Double
a4 Double
a5 =
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 {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in
let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in
let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in
(Ptr (Ptr CChar) -> IO OneFactorAffineModel)
-> IO OneFactorAffineModel
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO OneFactorAffineModel)
-> IO OneFactorAffineModel)
-> (Ptr (Ptr CChar) -> IO OneFactorAffineModel)
-> IO OneFactorAffineModel
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' ->
CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> Ptr (Ptr CChar)
-> IO (Ptr COneFactorAffineModel')
vasicek'_ CDouble
a1' CDouble
a2' CDouble
a3' CDouble
a4' CDouble
a5' Ptr (Ptr CChar)
a6' IO (Ptr COneFactorAffineModel')
-> (Ptr COneFactorAffineModel' -> IO OneFactorAffineModel)
-> IO OneFactorAffineModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr COneFactorAffineModel'
res ->
Ptr COneFactorAffineModel' -> IO OneFactorAffineModel
peekOneFactorAffineModel Ptr COneFactorAffineModel'
res IO OneFactorAffineModel
-> (OneFactorAffineModel -> IO OneFactorAffineModel)
-> IO OneFactorAffineModel
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \OneFactorAffineModel
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a6'IO () -> IO OneFactorAffineModel -> IO OneFactorAffineModel
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
OneFactorAffineModel -> IO OneFactorAffineModel
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (OneFactorAffineModel
res')
{-# LINE 654 "./QuantLib/Model.chs" #-}
liborForwardModel :: (LiborForwardModelProcess) -> (LmVolatilityModel) -> (LmCorrelationModel) -> IO ((LiborForwardModel))
liborForwardModel a1 a2 a3 =
withGenStochasticProcess a1 $ \a1' ->
withLmVolatilityModel a2 $ \a2' ->
withLmCorrelationModel a3 $ \a3' ->
preErrorCheck $ \a4' ->
liborForwardModel'_ a1' a2' a3' a4' >>= \res ->
peekLiborForwardModel res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 657 "./QuantLib/Model.chs" #-}
liborForwardModelS0 :: (LiborForwardModel) -> (Word)
-> (Word)
-> IO ((Double))
liborForwardModelS0 a1 a2 a3 =
withGenCalibratedModel a1 $ \a1' ->
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
preErrorCheck $ \a4' ->
liborForwardModelS0'_ a1' a2' a3' a4' >>= \res ->
let {res' = realToFrac res} in
errorCheck a4'>>
return (res')
{-# LINE 664 "./QuantLib/Model.chs" #-}
lfmHullWhiteParameterization :: LiborForwardModelProcess -> GenOptionletVolatilityStructure ov
-> Matrix Double
-> Word
-> IO LfmHullWhiteParameterization
lfmHullWhiteParameterization process capletVol (Matrix rows cols values) factors = qlLfmHullWhiteParameterization process capletVol rows cols values factors
qlLfmHullWhiteParameterization :: (LiborForwardModelProcess)
-> (GenOptionletVolatilityStructure ov)
-> (Word)
-> (Word)
-> ([Double])
-> (Word)
-> IO ((LfmHullWhiteParameterization))
qlLfmHullWhiteParameterization :: forall ov.
LiborForwardModelProcess
-> GenOptionletVolatilityStructure ov
-> Word
-> Word
-> [Double]
-> Word
-> IO LfmHullWhiteParameterization
qlLfmHullWhiteParameterization LiborForwardModelProcess
a1 GenOptionletVolatilityStructure ov
a2 Word
a3 Word
a4 [Double]
a5 Word
a6 =
LiborForwardModelProcess
-> (Ptr CLiborForwardModelProcess'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall p b.
GenStochasticProcess (ForeignPtr p) -> (Ptr p -> IO b) -> IO b
withGenStochasticProcess LiborForwardModelProcess
a1 ((Ptr CLiborForwardModelProcess'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization)
-> (Ptr CLiborForwardModelProcess'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. (a -> b) -> a -> b
$ \Ptr CLiborForwardModelProcess'
a1' ->
GenOptionletVolatilityStructure ov
-> (Ptr COptionletVolatilityStructure'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall ov b.
GenOptionletVolatilityStructure ov
-> (Ptr COptionletVolatilityStructure' -> IO b) -> IO b
withOptionletVolatilityStructure GenOptionletVolatilityStructure ov
a2 ((Ptr COptionletVolatilityStructure'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization)
-> (Ptr COptionletVolatilityStructure'
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. (a -> b) -> a -> b
$ \Ptr COptionletVolatilityStructure'
a2' ->
let {a3' :: CUInt
a3' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a3} in
let {a4' :: CUInt
a4' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a4} in
[Double]
-> (Ptr CDouble -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall b. [Double] -> (Ptr CDouble -> IO b) -> IO b
withDoubleArrayRaw [Double]
a5 ((Ptr CDouble -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization)
-> (Ptr CDouble -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. (a -> b) -> a -> b
$ \Ptr CDouble
a5' ->
let {a6' :: CUInt
a6' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a6} in
(Ptr (Ptr CChar) -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization)
-> (Ptr (Ptr CChar) -> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a7' ->
Ptr CLiborForwardModelProcess'
-> Ptr COptionletVolatilityStructure'
-> CUInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr (Ptr CChar)
-> IO (Ptr CLfmHullWhiteParameterization)
qlLfmHullWhiteParameterization'_ Ptr CLiborForwardModelProcess'
a1' Ptr COptionletVolatilityStructure'
a2' CUInt
a3' CUInt
a4' Ptr CDouble
a5' CUInt
a6' Ptr (Ptr CChar)
a7' IO (Ptr CLfmHullWhiteParameterization)
-> (Ptr CLfmHullWhiteParameterization
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CLfmHullWhiteParameterization
res ->
Ptr CLfmHullWhiteParameterization
-> IO LfmHullWhiteParameterization
peekLfmHullWhiteParameterization Ptr CLfmHullWhiteParameterization
res IO LfmHullWhiteParameterization
-> (LfmHullWhiteParameterization
-> IO LfmHullWhiteParameterization)
-> IO LfmHullWhiteParameterization
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \LfmHullWhiteParameterization
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a7'IO ()
-> IO LfmHullWhiteParameterization
-> IO LfmHullWhiteParameterization
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
LfmHullWhiteParameterization -> IO LfmHullWhiteParameterization
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (LfmHullWhiteParameterization
res')
{-# LINE 680 "./QuantLib/Model.chs" #-}
setCovarParam :: (LiborForwardModelProcess)
-> (LfmHullWhiteParameterization)
-> IO ()
setCovarParam a1 a2 =
withGenStochasticProcess a1 $ \a1' ->
withStandalone a2 $ \a2' ->
preErrorCheck $ \a3' ->
setCovarParam'_ a1' a2' a3' >>
errorCheck a3'>>
return ()
{-# LINE 692 "./QuantLib/Model.chs" #-}
lfmHullWhiteCovariance :: LfmHullWhiteParameterization -> Double -> [Double] -> IO (Matrix Double)
lfmHullWhiteCovariance p t x = toMatrixDouble <$> qlLfmHullWhiteCovariance p t x
where toMatrixDouble (r, c, d) = Matrix r c d
qlLfmHullWhiteCovariance :: (LfmHullWhiteParameterization)
-> (Double)
-> ([Double])
-> IO ((Word), (Word), ([Double]))
qlLfmHullWhiteCovariance :: LfmHullWhiteParameterization
-> Double -> [Double] -> IO (Word, Word, [Double])
qlLfmHullWhiteCovariance LfmHullWhiteParameterization
a1 Double
a2 [Double]
a3 =
LfmHullWhiteParameterization
-> (Ptr CLfmHullWhiteParameterization -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Standalone a -> (Ptr a -> IO b) -> IO b
withStandalone LfmHullWhiteParameterization
a1 ((Ptr CLfmHullWhiteParameterization -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> (Ptr CLfmHullWhiteParameterization -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CLfmHullWhiteParameterization
a1' ->
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
[Double]
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) ->
(Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a4' ->
(Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a5' ->
((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a6'1, Ptr (Ptr CDouble)
a6'2) ->
(Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double]))
-> (Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a7' ->
Ptr CLfmHullWhiteParameterization
-> CDouble
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr CUInt
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlLfmHullWhiteCovariance'_ Ptr CLfmHullWhiteParameterization
a1' CDouble
a2' CUInt
a3'1 Ptr CDouble
a3'2 Ptr CUInt
a4' Ptr CUInt
a5' Ptr CUInt
a6'1 Ptr (Ptr CDouble)
a6'2 Ptr (Ptr CChar)
a7' IO () -> IO Word -> IO Word
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> IO Word
peekWord Ptr CUInt
a4'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a4'' ->
Ptr CUInt -> IO Word
peekWord Ptr CUInt
a5'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a5'' ->
Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray Ptr CUInt
a6'1 Ptr (Ptr CDouble)
a6'2IO [Double]
-> ([Double] -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a6'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a7'IO () -> IO (Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
(Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Word
a4'', Word
a5'', [Double]
a6'')
{-# LINE 702 "./QuantLib/Model.chs" #-}
calibrate :: GenCalibratedModel m -> NonEmpty (GenCalibrationHelper ch, Double)
-> OptimizationMethod -> EndCriteria -> Maybe Constraint
-> [Bool]
-> IO ()
calibrate m h o e c fp = qlCalibratedModelCalibrate m hh hw o e c fp where (hh, hw) = unzip (toList h)
qlCalibratedModelCalibrate :: (GenCalibratedModel m) -> ([GenCalibrationHelper ch]) -> ([Double]) -> (OptimizationMethod) -> (EndCriteria) -> (Maybe Constraint) -> ([Bool]) -> IO ()
qlCalibratedModelCalibrate a1 a2 a3 a4 a5 a6 a7 =
withCalibratedModel a1 $ \a1' ->
withCalibrationHelperArray a2 $ \(a2'1, a2'2) ->
withDoubleArray a3 $ \(a3'1, a3'2) ->
withOptimizationMethod a4 $ \a4' ->
withEndCriteria a5 $ \a5' ->
withMaybeConstraint a6 $ \a6' ->
withBoolArray a7 $ \(a7'1, a7'2) ->
preErrorCheck $ \a8' ->
qlCalibratedModelCalibrate'_ a1' a2'1 a2'2 a3'1 a3'2 a4' a5' a6' a7'1 a7'2 a8' >>
errorCheck a8'>>
return ()
{-# LINE 712 "./QuantLib/Model.chs" #-}
value :: (GenCalibratedModel m) -> ([Double]) -> ([GenCalibrationHelper ch]) -> IO ((Double))
value a1 a2 a3 =
withCalibratedModel a1 $ \a1' ->
withDoubleArray a2 $ \(a2'1, a2'2) ->
withCalibrationHelperArray a3 $ \(a3'1, a3'2) ->
preErrorCheck $ \a4' ->
value'_ a1' a2'1 a2'2 a3'1 a3'2 a4' >>= \res ->
let {res' = realToFrac res} in
errorCheck a4'>>
return (res')
{-# LINE 715 "./QuantLib/Model.chs" #-}
capHelper :: ((Word,TimeUnit))
-> (GenQuote q)
-> (GenIborIndex ibor) -> (Frequency)
-> (DayCounter) -> (Bool)
-> (GenYieldTermStructure y) -> (CalibrationErrorType) -> (VolatilityType)
-> (Double)
-> IO ((BlackCalibrationHelper))
capHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
let {(a1'1, a1'2) = fromEnumQuantity a1} in
withQuote a2 $ \a2' ->
withIborIndex a3 $ \a3' ->
let {a4' = (fromIntegral . fromEnum) a4} in
withDayCounter a5 $ \a5' ->
let {a6' = C2HSImp.fromBool a6} in
withYieldTermStructure a7 $ \a7' ->
let {a8' = (fromIntegral . fromEnum) a8} in
let {a9' = (fromIntegral . fromEnum) a9} in
let {a10' = realToFrac a10} in
preErrorCheck $ \a11' ->
capHelper'_ a1'1 a1'2 a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
peekBlackCalibrationHelper res >>= \res' ->
errorCheck a11'>>
return (res')
{-# LINE 725 "./QuantLib/Model.chs" #-}
hestonModelHelper :: ((Word,TimeUnit))
-> (Calendar) -> (GenQuote q1)
-> (Double)
-> (GenQuote q2)
-> (GenYieldTermStructure y1)
-> (GenYieldTermStructure y2)
-> (CalibrationErrorType) -> IO ((BlackCalibrationHelper))
hestonModelHelper a1 a2 a3 a4 a5 a6 a7 a8 =
let {(a1'1, a1'2) = fromEnumQuantity a1} in
withCalendar a2 $ \a2' ->
withQuote a3 $ \a3' ->
let {a4' = realToFrac a4} in
withQuote a5 $ \a5' ->
withYieldTermStructure a6 $ \a6' ->
withYieldTermStructure a7 $ \a7' ->
let {a8' = (fromIntegral . fromEnum) a8} in
preErrorCheck $ \a9' ->
hestonModelHelper'_ a1'1 a1'2 a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
peekBlackCalibrationHelper res >>= \res' ->
errorCheck a9'>>
return (res')
{-# LINE 734 "./QuantLib/Model.chs" #-}
data SwaptionSpan
= SpanTenors !(Word, TimeUnit) !(Word, TimeUnit)
| SpanFromDate !Day !(Word, TimeUnit)
| SpanDates !Day !Day
deriving (Eq, Show)
swaptionHelper :: SwaptionSpan -> GenQuote q -> GenIborIndex ibor -> (Word, TimeUnit)
-> DayCounter -> DayCounter -> GenYieldTermStructure y -> CalibrationErrorType
-> Maybe Double -> Double -> VolatilityType -> Double -> Maybe Word -> RateAveragingType
-> IO SwaptionHelper
swaptionHelper span' = case span' of
SpanTenors m l -> swaptionHelperTenorsRaw m l
SpanFromDate d l -> swaptionHelperFromDateRaw d l
SpanDates d e -> swaptionHelperFromDatesRaw d e
swaptionHelperTenorsRaw :: ((Word,TimeUnit))
-> ((Word,TimeUnit))
-> (GenQuote q)
-> (GenIborIndex ibor) -> ((Word,TimeUnit))
-> (DayCounter)
-> (DayCounter)
-> (GenYieldTermStructure y) -> (CalibrationErrorType) -> (Maybe Double)
-> (Double)
-> (VolatilityType)
-> (Double)
-> (Maybe Word)
-> (RateAveragingType)
-> IO ((SwaptionHelper))
swaptionHelperTenorsRaw :: forall q ibor y.
(Word, TimeUnit)
-> (Word, TimeUnit)
-> GenQuote q
-> GenIborIndex ibor
-> (Word, TimeUnit)
-> DayCounter
-> DayCounter
-> GenYieldTermStructure y
-> CalibrationErrorType
-> Maybe Double
-> Double
-> VolatilityType
-> Double
-> Maybe Word
-> RateAveragingType
-> IO SwaptionHelper
swaptionHelperTenorsRaw (Word, TimeUnit)
a1 (Word, TimeUnit)
a2 GenQuote q
a3 GenIborIndex ibor
a4 (Word, TimeUnit)
a5 DayCounter
a6 DayCounter
a7 GenYieldTermStructure y
a8 CalibrationErrorType
a9 Maybe Double
a10 Double
a11 VolatilityType
a12 Double
a13 Maybe Word
a14 RateAveragingType
a15 =
let {(CInt
a1'1, CInt
a1'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
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
GenQuote q
-> (Ptr CQuote' -> IO SwaptionHelper) -> IO SwaptionHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a3 ((Ptr CQuote' -> IO SwaptionHelper) -> IO SwaptionHelper)
-> (Ptr CQuote' -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a3' ->
GenIborIndex ibor
-> (Ptr CIborIndex' -> IO SwaptionHelper) -> IO SwaptionHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a4 ((Ptr CIborIndex' -> IO SwaptionHelper) -> IO SwaptionHelper)
-> (Ptr CIborIndex' -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a4' ->
let {(CInt
a5'1, CInt
a5'2) = (Word, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Word, TimeUnit)
a5} in
DayCounter
-> (Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a6 ((Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper)
-> (Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a6' ->
DayCounter
-> (Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a7 ((Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper)
-> (Ptr CDayCounter -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a7' ->
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO SwaptionHelper)
-> IO SwaptionHelper
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a8 ((Ptr CYieldTermStructure' -> IO SwaptionHelper)
-> IO SwaptionHelper)
-> (Ptr CYieldTermStructure' -> IO SwaptionHelper)
-> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a8' ->
let {a9' :: CInt
a9' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (CalibrationErrorType -> Int) -> CalibrationErrorType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CalibrationErrorType -> Int
forall a. Enum a => a -> Int
fromEnum) CalibrationErrorType
a9} in
let {a10' :: CDouble
a10' = Maybe Double -> CDouble
fromMaybeDouble Maybe Double
a10} in
let {a11' :: CDouble
a11' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a11} in
let {a12' :: CInt
a12' = (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
a12} in
let {a13' :: CDouble
a13' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a13} in
let {a14' :: CUInt
a14' = Maybe Word -> CUInt
forall a b. (Integral a, Integral b) => Maybe a -> b
fromMaybeInt Maybe Word
a14} in
let {a15' :: CInt
a15' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (RateAveragingType -> Int) -> RateAveragingType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RateAveragingType -> Int
forall a. Enum a => a -> Int
fromEnum) RateAveragingType
a15} in
(Ptr (Ptr CChar) -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO SwaptionHelper) -> IO SwaptionHelper)
-> (Ptr (Ptr CChar) -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a16' ->
CInt
-> CInt
-> CInt
-> CInt
-> Ptr CQuote'
-> Ptr CIborIndex'
-> CInt
-> CInt
-> Ptr CDayCounter
-> Ptr CDayCounter
-> Ptr CYieldTermStructure'
-> CInt
-> CDouble
-> CDouble
-> CInt
-> CDouble
-> CUInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CSwaptionHelper')
swaptionHelperTenorsRaw'_ CInt
a1'1 CInt
a1'2 CInt
a2'1 CInt
a2'2 Ptr CQuote'
a3' Ptr CIborIndex'
a4' CInt
a5'1 CInt
a5'2 Ptr CDayCounter
a6' Ptr CDayCounter
a7' Ptr CYieldTermStructure'
a8' CInt
a9' CDouble
a10' CDouble
a11' CInt
a12' CDouble
a13' CUInt
a14' CInt
a15' Ptr (Ptr CChar)
a16' IO (Ptr CSwaptionHelper')
-> (Ptr CSwaptionHelper' -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CSwaptionHelper'
res ->
Ptr CSwaptionHelper' -> IO SwaptionHelper
peekSwaptionHelper Ptr CSwaptionHelper'
res IO SwaptionHelper
-> (SwaptionHelper -> IO SwaptionHelper) -> IO SwaptionHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SwaptionHelper
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a16'IO () -> IO SwaptionHelper -> IO SwaptionHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
SwaptionHelper -> IO SwaptionHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (SwaptionHelper
res')
{-# LINE 766 "./QuantLib/Model.chs" #-}
swaptionHelperFromDateRaw :: (Day)
-> ((Word,TimeUnit))
-> (GenQuote q)
-> (GenIborIndex ibor) -> ((Word,TimeUnit))
-> (DayCounter)
-> (DayCounter)
-> (GenYieldTermStructure y) -> (CalibrationErrorType) -> (Maybe Double)
-> (Double)
-> (VolatilityType)
-> (Double)
-> (Maybe Word)
-> (RateAveragingType)
-> IO ((SwaptionHelper))
swaptionHelperFromDateRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
withDay a1 $ \a1' ->
let {(a2'1, a2'2) = fromEnumQuantity a2} in
withQuote a3 $ \a3' ->
withIborIndex a4 $ \a4' ->
let {(a5'1, a5'2) = fromEnumQuantity a5} in
withDayCounter a6 $ \a6' ->
withDayCounter a7 $ \a7' ->
withYieldTermStructure a8 $ \a8' ->
let {a9' = (fromIntegral . fromEnum) a9} in
let {a10' = fromMaybeDouble a10} in
let {a11' = realToFrac a11} in
let {a12' = (fromIntegral . fromEnum) a12} in
let {a13' = realToFrac a13} in
let {a14' = fromMaybeInt a14} in
let {a15' = (fromIntegral . fromEnum) a15} in
preErrorCheck $ \a16' ->
swaptionHelperFromDateRaw'_ a1' a2'1 a2'2 a3' a4' a5'1 a5'2 a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
peekSwaptionHelper res >>= \res' ->
errorCheck a16'>>
return (res')
{-# LINE 782 "./QuantLib/Model.chs" #-}
swaptionHelperFromDatesRaw :: (Day)
-> (Day)
-> (GenQuote q)
-> (GenIborIndex ibor) -> ((Word,TimeUnit))
-> (DayCounter)
-> (DayCounter)
-> (GenYieldTermStructure y) -> (CalibrationErrorType) -> (Maybe Double)
-> (Double)
-> (VolatilityType)
-> (Double)
-> (Maybe Word)
-> (RateAveragingType)
-> IO ((SwaptionHelper))
swaptionHelperFromDatesRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
withDay a1 $ \a1' ->
withDay a2 $ \a2' ->
withQuote a3 $ \a3' ->
withIborIndex a4 $ \a4' ->
let {(a5'1, a5'2) = fromEnumQuantity a5} in
withDayCounter a6 $ \a6' ->
withDayCounter a7 $ \a7' ->
withYieldTermStructure a8 $ \a8' ->
let {a9' = (fromIntegral . fromEnum) a9} in
let {a10' = fromMaybeDouble a10} in
let {a11' = realToFrac a11} in
let {a12' = (fromIntegral . fromEnum) a12} in
let {a13' = realToFrac a13} in
let {a14' = fromMaybeInt a14} in
let {a15' = (fromIntegral . fromEnum) a15} in
preErrorCheck $ \a16' ->
swaptionHelperFromDatesRaw'_ a1' a2' a3' a4' a5'1 a5'2 a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
peekSwaptionHelper res >>= \res' ->
errorCheck a16'>>
return (res')
{-# LINE 798 "./QuantLib/Model.chs" #-}
helperSwaption :: (SwaptionHelper) -> IO ((Swaption))
helperSwaption a1 =
withSwaptionHelper a1 $ \a1' ->
preErrorCheck $ \a2' ->
helperSwaption'_ a1' a2' >>= \res ->
peekSwaption res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 801 "./QuantLib/Model.chs" #-}
times :: (GenBlackCalibrationHelper bch) -> IO (([Double]))
times a1 =
withBlackCalibrationHelper a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
times'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 804 "./QuantLib/Model.chs" #-}
params :: (GenCalibratedModel m) -> IO (([Double]))
params a1 =
withCalibratedModel a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
params'_ a1' a2'1 a2'2 a3' >>
peekDoubleArray a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 807 "./QuantLib/Model.chs" #-}
blackPrice :: (GenBlackCalibrationHelper bch) -> (Double)
-> IO ((Double))
blackPrice a1 a2 =
withBlackCalibrationHelper a1 $ \a1' ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
blackPrice'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 811 "./QuantLib/Model.chs" #-}
calibrationError :: (GenBlackCalibrationHelper bch) -> IO ((Double))
calibrationError a1 =
withBlackCalibrationHelper a1 $ \a1' ->
preErrorCheck $ \a2' ->
calibrationError'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 814 "./QuantLib/Model.chs" #-}
impliedVolatility :: (GenBlackCalibrationHelper bch) -> (Double)
-> (Double)
-> (Word)
-> (Double)
-> (Double)
-> IO ((Double))
impliedVolatility :: forall bch.
GenBlackCalibrationHelper bch
-> Double -> Double -> Word -> Double -> Double -> IO Double
impliedVolatility GenBlackCalibrationHelper bch
a1 Double
a2 Double
a3 Word
a4 Double
a5 Double
a6 =
GenBlackCalibrationHelper bch
-> (Ptr CBlackCalibrationHelper' -> IO Double) -> IO Double
forall bch b.
GenBlackCalibrationHelper bch
-> (Ptr CBlackCalibrationHelper' -> IO b) -> IO b
withBlackCalibrationHelper GenBlackCalibrationHelper bch
a1 ((Ptr CBlackCalibrationHelper' -> IO Double) -> IO Double)
-> (Ptr CBlackCalibrationHelper' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackCalibrationHelper'
a1' ->
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
let {a3' = realToFrac a3} in
let {a4' = fromIntegral a4} in
let {a5' = realToFrac a5} in
let {a6' = realToFrac a6} in
preErrorCheck $ \a7' ->
impliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
let {res' = realToFrac res} in
errorCheck a7'>>
return (res')
{-# LINE 822 "./QuantLib/Model.chs" #-}
marketValue :: (GenBlackCalibrationHelper bch) -> IO ((Double))
marketValue a1 =
withBlackCalibrationHelper a1 $ \a1' ->
preErrorCheck $ \a2' ->
marketValue'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 825 "./QuantLib/Model.chs" #-}
modelValue :: (GenBlackCalibrationHelper bch) -> IO ((Double))
modelValue a1 =
withBlackCalibrationHelper a1 $ \a1' ->
preErrorCheck $ \a2' ->
modelValue'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 828 "./QuantLib/Model.chs" #-}
volatility :: (GenBlackCalibrationHelper bch) -> IO ((Quote))
volatility a1 =
withBlackCalibrationHelper a1 $ \a1' ->
preErrorCheck $ \a2' ->
volatility'_ a1' a2' >>= \res ->
peekQuote res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 831 "./QuantLib/Model.chs" #-}
setPricingEngine :: (GenBlackCalibrationHelper bch) -> (PricingEngine) -> IO ()
setPricingEngine a1 a2 =
withBlackCalibrationHelper a1 $ \a1' ->
withPricingEngine a2 $ \a2' ->
preErrorCheck $ \a3' ->
setPricingEngine'_ a1' a2' a3' >>
errorCheck a3'>>
return ()
{-# LINE 834 "./QuantLib/Model.chs" #-}
garch11 :: (Double)
-> (Double)
-> (Double)
-> IO ((Garch11))
garch11 a1 a2 a3 =
let {a1' = realToFrac a1} in
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
preErrorCheck $ \a4' ->
garch11'_ a1' a2' a3' a4' >>= \res ->
peekGarch11 res >>= \res' ->
errorCheck a4'>>
return (res')
{-# LINE 843 "./QuantLib/Model.chs" #-}
garch11Calibrated :: NonEmpty (Day, Double)
-> Garch11Mode -> IO Garch11
garch11Calibrated :: NonEmpty (Day, Double) -> Garch11Mode -> IO Garch11
garch11Calibrated NonEmpty (Day, Double)
series = [Day] -> [Double] -> Garch11Mode -> IO Garch11
qlGarch11Calibrated [Day]
dates [Double]
vals
where ([Day]
dates, [Double]
vals) = [(Day, Double)] -> ([Day], [Double])
forall a b. [(a, b)] -> ([a], [b])
unzip (NonEmpty (Day, Double) -> [(Day, Double)]
forall a. NonEmpty a -> [a]
toList NonEmpty (Day, Double)
series)
qlGarch11Calibrated :: ([Day]) -> ([Double]) -> (Garch11Mode) -> IO ((Garch11))
qlGarch11Calibrated :: [Day] -> [Double] -> Garch11Mode -> IO Garch11
qlGarch11Calibrated [Day]
a1 [Double]
a2 Garch11Mode
a3 =
[Day] -> ((CUInt, Ptr CInt) -> IO Garch11) -> IO Garch11
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a1 (((CUInt, Ptr CInt) -> IO Garch11) -> IO Garch11)
-> ((CUInt, Ptr CInt) -> IO Garch11) -> IO Garch11
forall a b. (a -> b) -> a -> b
$ \(CUInt
a1'1, Ptr CInt
a1'2) ->
[Double] -> ((CUInt, Ptr CDouble) -> IO Garch11) -> IO Garch11
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a2 (((CUInt, Ptr CDouble) -> IO Garch11) -> IO Garch11)
-> ((CUInt, Ptr CDouble) -> IO Garch11) -> IO Garch11
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr CDouble
a2'2) ->
let {a3' :: CInt
a3' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Garch11Mode -> Int) -> Garch11Mode -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Garch11Mode -> Int
forall a. Enum a => a -> Int
fromEnum) Garch11Mode
a3} in
(Ptr (Ptr CChar) -> IO Garch11) -> IO Garch11
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Garch11) -> IO Garch11)
-> (Ptr (Ptr CChar) -> IO Garch11) -> IO Garch11
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a4' ->
CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CGarch11)
qlGarch11Calibrated'_ CUInt
a1'1 Ptr CInt
a1'2 CUInt
a2'1 Ptr CDouble
a2'2 CInt
a3' Ptr (Ptr CChar)
a4' IO (Ptr CGarch11) -> (Ptr CGarch11 -> IO Garch11) -> IO Garch11
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CGarch11
res ->
Ptr CGarch11 -> IO Garch11
peekGarch11 Ptr CGarch11
res IO Garch11 -> (Garch11 -> IO Garch11) -> IO Garch11
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Garch11
res' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
IO CDouble -> (CDouble -> IO Double) -> IO Double
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' :: Ptr (Ptr CChar)
a4'IO () -> IO Garch11 -> IO Garch11
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Garch11 -> IO Garch11
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Garch11
res')
{-# LINE 858 "./QuantLib/Model.chs" #-}
alpha :: (Garch11) -> (Double)
alpha a1 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
alpha'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 861 "./QuantLib/Model.chs" #-}
beta :: (Garch11) -> (Double)
beta a1 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
beta'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 864 "./QuantLib/Model.chs" #-}
omega :: (Garch11) -> (Double)
omega a1 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
omega'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 867 "./QuantLib/Model.chs" #-}
longTermVolatility :: (Garch11) -> (Double)
longTermVolatility a1 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
longTermVolatility'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 870 "./QuantLib/Model.chs" #-}
logLikelihood :: (Garch11) -> (Double)
logLikelihood a1 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
logLikelihood'_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 873 "./QuantLib/Model.chs" #-}
forecast :: (Garch11) -> (Double)
-> (Double)
-> (Double)
forecast a1 a2 a3 =
C2HSImp.unsafePerformIO $
withGarch11 a1 $ \a1' ->
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
forecast'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 880 "./QuantLib/Model.chs" #-}
calculate :: Garch11 -> NonEmpty (Day, Double)
-> IO [(Day, Double)]
calculate g series = do
(ds, vs) <- qlGarch11Calculate g dates vals
return $ zip ds vs
where (dates, vals) = unzip (toList series)
qlGarch11Calculate :: (Garch11) -> ([Day]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarch11Calculate :: Garch11 -> [Day] -> [Double] -> IO ([Day], [Double])
qlGarch11Calculate Garch11
a1 [Day]
a2 [Double]
a3 =
Garch11
-> (Ptr CGarch11 -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall b. Garch11 -> (Ptr CGarch11 -> IO b) -> IO b
withGarch11 Garch11
a1 ((Ptr CGarch11 -> IO ([Day], [Double])) -> IO ([Day], [Double]))
-> (Ptr CGarch11 -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CGarch11
a1' ->
[Day]
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a2 (((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr CInt
a2'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) ->
((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a4'1, Ptr (Ptr CInt)
a4'2) ->
((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a5'1, Ptr (Ptr CDouble)
a5'2) ->
(Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double]))
-> (Ptr (Ptr CChar) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' ->
Ptr CGarch11
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlGarch11Calculate'_ Ptr CGarch11
a1' CUInt
a2'1 Ptr CInt
a2'2 CUInt
a3'1 Ptr CDouble
a3'2 Ptr CUInt
a4'1 Ptr (Ptr CInt)
a4'2 Ptr CUInt
a5'1 Ptr (Ptr CDouble)
a5'2 Ptr (Ptr CChar)
a6' IO () -> IO [Day] -> IO [Day]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> Ptr (Ptr CInt) -> IO [Day]
peekDayArray Ptr CUInt
a4'1 Ptr (Ptr CInt)
a4'2IO [Day] -> ([Day] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Day]
a4'' ->
Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray Ptr CUInt
a5'1 Ptr (Ptr CDouble)
a5'2IO [Double]
-> ([Double] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a5'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a6'IO () -> IO ([Day], [Double]) -> IO ([Day], [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
([Day], [Double]) -> IO ([Day], [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Day]
a4'', [Double]
a5'')
{-# LINE 895 "./QuantLib/Model.chs" #-}
garmanKlassSimpleSigma :: Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSimpleSigma yearFraction bars = do
(ds, vs) <- qlGarmanKlassSimpleSigma yearFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSimpleSigma :: (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSimpleSigma :: Double
-> [Day]
-> [Double]
-> [Double]
-> [Double]
-> [Double]
-> IO ([Day], [Double])
qlGarmanKlassSimpleSigma Double
a1 [Day]
a2 [Double]
a3 [Double]
a4 [Double]
a5 [Double]
a6 =
let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in
[Day]
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a2 (((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr CInt
a2'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a4 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr CDouble
a4'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a5 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a5'1, Ptr CDouble
a5'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a6 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a6'1, Ptr CDouble
a6'2) ->
((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a7'1, Ptr (Ptr CInt)
a7'2) ->
((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a8'1, Ptr (Ptr CDouble)
a8'2) ->
(Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double]))
-> (Ptr (Ptr CChar) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' ->
CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlGarmanKlassSimpleSigma'_ CDouble
a1' CUInt
a2'1 Ptr CInt
a2'2 CUInt
a3'1 Ptr CDouble
a3'2 CUInt
a4'1 Ptr CDouble
a4'2 CUInt
a5'1 Ptr CDouble
a5'2 CUInt
a6'1 Ptr CDouble
a6'2 Ptr CUInt
a7'1 Ptr (Ptr CInt)
a7'2 Ptr CUInt
a8'1 Ptr (Ptr CDouble)
a8'2 Ptr (Ptr CChar)
a9' IO () -> IO [Day] -> IO [Day]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> Ptr (Ptr CInt) -> IO [Day]
peekDayArray Ptr CUInt
a7'1 Ptr (Ptr CInt)
a7'2IO [Day] -> ([Day] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Day]
a7'' ->
Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray Ptr CUInt
a8'1 Ptr (Ptr CDouble)
a8'2IO [Double]
-> ([Double] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a8'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a9'IO () -> IO ([Day], [Double]) -> IO ([Day], [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
([Day], [Double]) -> IO ([Day], [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Day]
a7'', [Double]
a8'')
{-# LINE 909 "./QuantLib/Model.chs" #-}
garmanKlassSigma1 :: Double
-> Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSigma1 yearFraction marketOpenFraction bars = do
(ds, vs) <- qlGarmanKlassSigma1 yearFraction marketOpenFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSigma1 :: (Double) -> (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSigma1 :: Double
-> Double
-> [Day]
-> [Double]
-> [Double]
-> [Double]
-> [Double]
-> IO ([Day], [Double])
qlGarmanKlassSigma1 Double
a1 Double
a2 [Day]
a3 [Double]
a4 [Double]
a5 [Double]
a6 [Double]
a7 =
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
[Day]
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a3 (((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CInt
a3'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a4 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr CDouble
a4'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a5 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a5'1, Ptr CDouble
a5'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a6 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a6'1, Ptr CDouble
a6'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a7 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a7'1, Ptr CDouble
a7'2) ->
((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a8'1, Ptr (Ptr CInt)
a8'2) ->
((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a9'1, Ptr (Ptr CDouble)
a9'2) ->
(Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double]))
-> (Ptr (Ptr CChar) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a10' ->
CDouble
-> CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlGarmanKlassSigma1'_ CDouble
a1' CDouble
a2' CUInt
a3'1 Ptr CInt
a3'2 CUInt
a4'1 Ptr CDouble
a4'2 CUInt
a5'1 Ptr CDouble
a5'2 CUInt
a6'1 Ptr CDouble
a6'2 CUInt
a7'1 Ptr CDouble
a7'2 Ptr CUInt
a8'1 Ptr (Ptr CInt)
a8'2 Ptr CUInt
a9'1 Ptr (Ptr CDouble)
a9'2 Ptr (Ptr CChar)
a10' IO () -> IO [Day] -> IO [Day]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> Ptr (Ptr CInt) -> IO [Day]
peekDayArray Ptr CUInt
a8'1 Ptr (Ptr CInt)
a8'2IO [Day] -> ([Day] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Day]
a8'' ->
Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray Ptr CUInt
a9'1 Ptr (Ptr CDouble)
a9'2IO [Double]
-> ([Double] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a9'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a10'IO () -> IO ([Day], [Double]) -> IO ([Day], [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
([Day], [Double]) -> IO ([Day], [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Day]
a8'', [Double]
a9'')
{-# LINE 925 "./QuantLib/Model.chs" #-}
parkinsonSigma :: Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
parkinsonSigma yearFraction bars = do
(ds, vs) <- qlParkinsonSigma yearFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlParkinsonSigma :: (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlParkinsonSigma a1 a2 a3 a4 a5 a6 =
let {a1' = realToFrac a1} in
withDayArray a2 $ \(a2'1, a2'2) ->
withDoubleArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
preArray $ \(a7'1, a7'2) ->
preArray $ \(a8'1, a8'2) ->
preErrorCheck $ \a9' ->
qlParkinsonSigma'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9' >>
peekDayArray a7'1 a7'2>>= \a7'' ->
peekDoubleArray a8'1 a8'2>>= \a8'' ->
errorCheck a9'>>
return (a7'', a8'')
{-# LINE 939 "./QuantLib/Model.chs" #-}
garmanKlassSigma3 :: Double
-> Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSigma3 yearFraction marketOpenFraction bars = do
(ds, vs) <- qlGarmanKlassSigma3 yearFraction marketOpenFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSigma3 :: (Double) -> (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSigma3 a1 a2 a3 a4 a5 a6 a7 =
let {a1' = realToFrac a1} in
let {a2' = realToFrac a2} in
withDayArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
withDoubleArray a7 $ \(a7'1, a7'2) ->
preArray $ \(a8'1, a8'2) ->
preArray $ \(a9'1, a9'2) ->
preErrorCheck $ \a10' ->
qlGarmanKlassSigma3'_ a1' a2' a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9'1 a9'2 a10' >>
peekDayArray a8'1 a8'2>>= \a8'' ->
peekDoubleArray a9'1 a9'2>>= \a9'' ->
errorCheck a10'>>
return (a8'', a9'')
{-# LINE 954 "./QuantLib/Model.chs" #-}
garmanKlassSigma4 :: Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSigma4 yearFraction bars = do
(ds, vs) <- qlGarmanKlassSigma4 yearFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSigma4 :: (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSigma4 a1 a2 a3 a4 a5 a6 =
let {a1' = realToFrac a1} in
withDayArray a2 $ \(a2'1, a2'2) ->
withDoubleArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
preArray $ \(a7'1, a7'2) ->
preArray $ \(a8'1, a8'2) ->
preErrorCheck $ \a9' ->
qlGarmanKlassSigma4'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9' >>
peekDayArray a7'1 a7'2>>= \a7'' ->
peekDoubleArray a8'1 a8'2>>= \a8'' ->
errorCheck a9'>>
return (a7'', a8'')
{-# LINE 968 "./QuantLib/Model.chs" #-}
garmanKlassSigma5 :: Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSigma5 yearFraction bars = do
(ds, vs) <- qlGarmanKlassSigma5 yearFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSigma5 :: (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSigma5 a1 a2 a3 a4 a5 a6 =
let {a1' = realToFrac a1} in
withDayArray a2 $ \(a2'1, a2'2) ->
withDoubleArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
preArray $ \(a7'1, a7'2) ->
preArray $ \(a8'1, a8'2) ->
preErrorCheck $ \a9' ->
qlGarmanKlassSigma5'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9' >>
peekDayArray a7'1 a7'2>>= \a7'' ->
peekDoubleArray a8'1 a8'2>>= \a8'' ->
errorCheck a9'>>
return (a7'', a8'')
{-# LINE 982 "./QuantLib/Model.chs" #-}
garmanKlassSigma6 :: Double
-> Double
-> NonEmpty (Day, Double, Double, Double, Double)
-> IO [(Day, Double)]
garmanKlassSigma6 yearFraction marketOpenFraction bars = do
(ds, vs) <- qlGarmanKlassSigma6 yearFraction marketOpenFraction dates opens closes highs lows
return $ zip ds vs
where (dates, opens, closes, highs, lows) = unzipBars bars
qlGarmanKlassSigma6 :: (Double) -> (Double) -> ([Day]) -> ([Double]) -> ([Double]) -> ([Double]) -> ([Double]) -> IO (([Day]), ([Double]))
qlGarmanKlassSigma6 a1 a2 a3 a4 a5 a6 a7 =
let {a1' = realToFrac a1} in
let {a2' = realToFrac a2} in
withDayArray a3 $ \(a3'1, a3'2) ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
withDoubleArray a5 $ \(a5'1, a5'2) ->
withDoubleArray a6 $ \(a6'1, a6'2) ->
withDoubleArray a7 $ \(a7'1, a7'2) ->
preArray $ \(a8'1, a8'2) ->
preArray $ \(a9'1, a9'2) ->
preErrorCheck $ \a10' ->
qlGarmanKlassSigma6'_ a1' a2' a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9'1 a9'2 a10' >>
peekDayArray a8'1 a8'2>>= \a8'' ->
peekDoubleArray a9'1 a9'2>>= \a9'' ->
errorCheck a10'>>
return (a8'', a9'')
{-# LINE 997 "./QuantLib/Model.chs" #-}
constantVolatilityEstimator :: Word
-> NonEmpty (Day, Double)
-> IO [(Day, Double)]
constantVolatilityEstimator windowSize series = do
(ds, vs) <- qlConstantVolatilityEstimator windowSize dates vals
return $ zip ds vs
where (dates, vals) = unzip (toList series)
qlConstantVolatilityEstimator :: (Word) -> ([Day]) -> ([Double]) -> IO (([Day]), ([Double]))
qlConstantVolatilityEstimator a1 a2 a3 =
let {a1' = fromIntegral a1} in
withDayArray a2 $ \(a2'1, a2'2) ->
withDoubleArray a3 $ \(a3'1, a3'2) ->
preArray $ \(a4'1, a4'2) ->
preArray $ \(a5'1, a5'2) ->
preErrorCheck $ \a6' ->
qlConstantVolatilityEstimator'_ a1' a2'1 a2'2 a3'1 a3'2 a4'1 a4'2 a5'1 a5'2 a6' >>
peekDayArray a4'1 a4'2>>= \a4'' ->
peekDoubleArray a5'1 a5'2>>= \a5'' ->
errorCheck a6'>>
return (a4'', a5'')
{-# LINE 1010 "./QuantLib/Model.chs" #-}
simpleLocalVolatilityEstimator :: Double
-> NonEmpty (Day, Double)
-> IO [(Day, Double)]
simpleLocalVolatilityEstimator yearFraction series = do
(ds, vs) <- qlSimpleLocalVolatilityEstimator yearFraction dates vals
return $ zip ds vs
where (dates, vals) = unzip (toList series)
qlSimpleLocalVolatilityEstimator :: (Double) -> ([Day]) -> ([Double]) -> IO (([Day]), ([Double]))
qlSimpleLocalVolatilityEstimator :: Double -> [Day] -> [Double] -> IO ([Day], [Double])
qlSimpleLocalVolatilityEstimator Double
a1 [Day]
a2 [Double]
a3 =
let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in
[Day]
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a2 (((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CInt) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr CInt
a2'2) ->
[Double]
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((CUInt, Ptr CDouble) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) ->
((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a4'1, Ptr (Ptr CInt)
a4'2) ->
((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a5'1, Ptr (Ptr CDouble)
a5'2) ->
(Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([Day], [Double])) -> IO ([Day], [Double]))
-> (Ptr (Ptr CChar) -> IO ([Day], [Double]))
-> IO ([Day], [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' ->
CDouble
-> CUInt
-> Ptr CInt
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlSimpleLocalVolatilityEstimator'_ CDouble
a1' CUInt
a2'1 Ptr CInt
a2'2 CUInt
a3'1 Ptr CDouble
a3'2 Ptr CUInt
a4'1 Ptr (Ptr CInt)
a4'2 Ptr CUInt
a5'1 Ptr (Ptr CDouble)
a5'2 Ptr (Ptr CChar)
a6' IO () -> IO [Day] -> IO [Day]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr CUInt -> Ptr (Ptr CInt) -> IO [Day]
peekDayArray Ptr CUInt
a4'1 Ptr (Ptr CInt)
a4'2IO [Day] -> ([Day] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Day]
a4'' ->
Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray Ptr CUInt
a5'1 Ptr (Ptr CDouble)
a5'2IO [Double]
-> ([Double] -> IO ([Day], [Double])) -> IO ([Day], [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a5'' ->
Ptr (Ptr CChar) -> IO ()
errorCheck Ptr (Ptr CChar)
a6'IO () -> IO ([Day], [Double]) -> IO ([Day], [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
([Day], [Double]) -> IO ([Day], [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Day]
a4'', [Double]
a5'')
{-# LINE 1024 "./QuantLib/Model.chs" #-}
unzipBars :: NonEmpty (Day, Double, Double, Double, Double) -> ([Day], [Double], [Double], [Double], [Double])
unzipBars bars = (map d5 xs, map o5 xs, map c5 xs, map h5 xs, map l5 xs)
where
xs = toList bars
d5 (d,_,_,_,_) = d
o5 (_,o,_,_,_) = o
c5 (_,_,c,_,_) = c
h5 (_,_,_,h,_) = h
l5 (_,_,_,_,l) = l
foreign import ccall safe "QuantLib/Model.chs.h qlBatesModel"
batesModel'_ :: ((C2HSImp.Ptr (CBatesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBatesModel')))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackKarasinski"
blackKarasinski'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CShortRateModel')))))))
foreign import ccall safe "QuantLib/Model.chs.h qlCoxIngersollRoss"
coxIngersollRoss'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneFactorAffineModel')))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlExtendedCoxIngersollRoss"
extendedCoxIngersollRoss'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneFactorAffineModel'))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlG2"
g2'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CG2'))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlG2Dynamics"
g2Dynamics'_ :: ((C2HSImp.Ptr (CG2')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CShortRateDynamics')))))
foreign import ccall safe "QuantLib/Model.chs.h qlShortRateDynamicsShortRate"
shortRate'_ :: ((C2HSImp.Ptr (CShortRateDynamics')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGeneralizedHullWhite"
qlGeneralizedHullWhite'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CShortRateModel')))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGJRGARCHModel"
gjrGarchModel'_ :: ((C2HSImp.Ptr (CGJRGARCHProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGJRGARCHModel')))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonModel"
hestonModel'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonModel')))))
foreign import ccall safe "QuantLib/Model.chs.h qlMTBrownianGeneratorFactory"
mtBrownianGeneratorFactory'_ :: (C2HSImp.CULong -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBrownianGeneratorFactory')))))
foreign import ccall safe "QuantLib/Model.chs.h qlSobolBrownianGeneratorFactory"
sobolBrownianGeneratorFactory'_ :: (C2HSImp.CInt -> (C2HSImp.CULong -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBrownianGeneratorFactory')))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVMCModel"
hestonSlvMcModel'_ :: ((C2HSImp.Ptr (CLocalVolTermStructure')) -> ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CBrownianGeneratorFactory')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonSLVMCModel'))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVMCModelLeverageFunction"
qlHestonSLVMCModelLeverageFunction'_ :: ((C2HSImp.Ptr (CHestonSLVMCModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLocalVolTermStructure')))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMModel"
hestonSlvFdmModelRaw'_ :: ((C2HSImp.Ptr (CLocalVolTermStructure')) -> ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonSLVFDMModel')))))))))))))))))))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMModelLeverageFunction"
qlHestonSLVFDMModelLeverageFunction'_ :: ((C2HSImp.Ptr (CHestonSLVFDMModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLocalVolTermStructure')))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMModelLogEntries"
hestonSlvFdmLogEntriesSnapshot'_ :: ((C2HSImp.Ptr (CHestonSLVFDMModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonSLVFDMLogEntries)))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMLogEntriesSize"
hestonSlvFdmLogEntriesSize'_ :: ((C2HSImp.Ptr (CHestonSLVFDMLogEntries)) -> (IO C2HSImp.CUInt))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMLogEntriesTime"
hestonSlvFdmLogEntriesTime'_ :: ((C2HSImp.Ptr (CHestonSLVFDMLogEntries)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMLogEntriesSpotGrid"
hestonSlvFdmLogEntriesSpotGrid'_ :: ((C2HSImp.Ptr (CHestonSLVFDMLogEntries)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMLogEntriesVarianceGrid"
hestonSlvFdmLogEntriesVarianceGrid'_ :: ((C2HSImp.Ptr (CHestonSLVFDMLogEntries)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonSLVFDMLogEntriesDensity"
hestonSlvFdmLogEntriesDensity'_ :: ((C2HSImp.Ptr (CHestonSLVFDMLogEntries)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHullWhite"
hullWhite'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHullWhite')))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHullWhiteConvexityBias"
convexityBias'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGsr"
qlGsr'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGsr')))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGsrVolatility"
qlGsrVolatility'_ :: ((C2HSImp.Ptr (CGsr')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Model.chs.h qlGsrMoveVolatility"
moveVolatility'_ :: ((C2HSImp.Ptr (CGsr')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGsrMoveReversion"
moveReversion'_ :: ((C2HSImp.Ptr (CGsr')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGsrCalibrateVolatilitiesIterative"
calibrateVolatilitiesIterative'_ :: ((C2HSImp.Ptr (CGsr')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBlackCalibrationHelper'))) -> ((C2HSImp.Ptr (COptimizationMethod)) -> ((C2HSImp.Ptr (CEndCriteria)) -> ((C2HSImp.Ptr (CConstraint)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlMarkovFunctional"
qlMarkovFunctional'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CSwaptionVolatilityStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CSwapIndex')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMarkovFunctional')))))))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlMarkovFunctionalCaplet"
qlMarkovFunctionalCaplet'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (COptionletVolatilityStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMarkovFunctional')))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlMarkovFunctionalVolatility"
qlMarkovFunctionalVolatility'_ :: ((C2HSImp.Ptr (CMarkovFunctional')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Model.chs.h qlAffineModelDiscount"
discount'_ :: ((C2HSImp.Ptr (CAffineModel')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Model.chs.h qlAffineModelDiscountBond"
discountBond'_ :: ((C2HSImp.Ptr (CAffineModel')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlAffineModelDiscountBondOption"
discountBondOption_'_ :: ((C2HSImp.Ptr (CAffineModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelNumeraire"
numeraire'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelZerobond"
gaussian1dZerobond'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelZerobondOption"
gaussian1dZerobondOption'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelForwardRate"
gaussian1dForwardRate'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelSwapRate"
gaussian1dSwapRate'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelSwapAnnuity"
gaussian1dSwapAnnuity'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelYGrid"
gaussian1dYGrid'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGaussian1dModelStateProcess"
stateProcess'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))
foreign import ccall safe "QuantLib/Model.chs.h qlVarianceGammaModel"
varianceGammaModel'_ :: ((C2HSImp.Ptr (CVarianceGammaProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CCalibratedModel')))))
foreign import ccall safe "QuantLib/Model.chs.h qlVasicek"
vasicek'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneFactorAffineModel')))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlLiborForwardModel"
liborForwardModel'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr (CLmVolatilityModel)) -> ((C2HSImp.Ptr (CLmCorrelationModel)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLiborForwardModel')))))))
foreign import ccall safe "QuantLib/Model.chs.h qlLiborForwardModelS0"
liborForwardModelS0'_ :: ((C2HSImp.Ptr (CLiborForwardModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Model.chs.h qlLfmHullWhiteParameterization"
qlLfmHullWhiteParameterization'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr (COptionletVolatilityStructure')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLfmHullWhiteParameterization))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlLiborForwardModelProcessSetCovarParam"
setCovarParam'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr (CLfmHullWhiteParameterization)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))
foreign import ccall safe "QuantLib/Model.chs.h qlLfmHullWhiteCovariance"
qlLfmHullWhiteCovariance'_ :: ((C2HSImp.Ptr (CLfmHullWhiteParameterization)) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlCalibratedModelCalibrate"
qlCalibratedModelCalibrate'_ :: ((C2HSImp.Ptr (CCalibratedModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCalibrationHelper'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (COptimizationMethod)) -> ((C2HSImp.Ptr (CEndCriteria)) -> ((C2HSImp.Ptr (CConstraint)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlCalibratedModelValue"
value'_ :: ((C2HSImp.Ptr (CCalibratedModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCalibrationHelper'))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlCapHelper"
capHelper'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBlackCalibrationHelper')))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlHestonModelHelper"
hestonModelHelper'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBlackCalibrationHelper')))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlSwaptionHelper"
swaptionHelperTenorsRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwaptionHelper'))))))))))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlSwaptionHelperFromDate"
swaptionHelperFromDateRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwaptionHelper')))))))))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlSwaptionHelperFromDates"
swaptionHelperFromDatesRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwaptionHelper'))))))))))))))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlSwaptionHelperSwaption"
helperSwaption'_ :: ((C2HSImp.Ptr (CSwaptionHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwaption')))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperTimes"
times'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Model.chs.h qlCalibratedModelParams"
params'_ :: ((C2HSImp.Ptr (CCalibratedModel')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperBlackPrice"
blackPrice'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperCalibrationError"
calibrationError'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperImpliedVolatility"
impliedVolatility'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperMarketValue"
marketValue'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperModelValue"
modelValue'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperVolatility"
volatility'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuote')))))
foreign import ccall safe "QuantLib/Model.chs.h qlBlackCalibrationHelperSetPricingEngine"
setPricingEngine'_ :: ((C2HSImp.Ptr (CBlackCalibrationHelper')) -> ((C2HSImp.Ptr (CPricingEngine)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11"
garch11'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGarch11)))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Calibrated"
qlGarch11Calibrated'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGarch11)))))))))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Alpha"
alpha'_ :: ((C2HSImp.Ptr (CGarch11)) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Beta"
beta'_ :: ((C2HSImp.Ptr (CGarch11)) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Omega"
omega'_ :: ((C2HSImp.Ptr (CGarch11)) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11LtVol"
longTermVolatility'_ :: ((C2HSImp.Ptr (CGarch11)) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11LogLikelihood"
logLikelihood'_ :: ((C2HSImp.Ptr (CGarch11)) -> (IO C2HSImp.CDouble))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Forecast"
forecast'_ :: ((C2HSImp.Ptr (CGarch11)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Model.chs.h qlGarch11Calculate"
qlGarch11Calculate'_ :: ((C2HSImp.Ptr (CGarch11)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSimpleSigma"
qlGarmanKlassSimpleSigma'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSigma1"
qlGarmanKlassSigma1'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlParkinsonSigma"
qlParkinsonSigma'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSigma3"
qlGarmanKlassSigma3'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSigma4"
qlGarmanKlassSigma4'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSigma5"
qlGarmanKlassSigma5'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlGarmanKlassSigma6"
qlGarmanKlassSigma6'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlConstantVolatilityEstimator"
qlConstantVolatilityEstimator'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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/Model.chs.h qlSimpleLocalVolatilityEstimator"
qlSimpleLocalVolatilityEstimator'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((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 ())))))))))))