never executed always true always false
    1 -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
    2 -- Edit the ORIGNAL .chs file instead!
    3 
    4 
    5 {-# LANGUAGE FlexibleInstances #-}
    6 module QuantLib.PricingEngine
    7   (
    8     -- * Types
    9     -- ** Engines
   10     GenPricingEngine
   11   , PricingEngine
   12   , AnalyticRoughHestonEngine
   13   , FdmQuantoHelper
   14 
   15     -- ** Option calculators
   16   , GenBlackCalculator
   17   , BlackCalculator
   18   , BlackScholesCalculator
   19   , BachelierCalculator
   20   , BlackDeltaCalculator
   21 
   22     -- ** Configuration
   23   , CashAnnuityModel(..)
   24   , Probabilities(..)
   25   , CashDividendModel(..)
   26   , NumericalFix(..)
   27   , AccrualBias(..)
   28   , ForwardsInCouponPeriod(..)
   29   , SolverType(..)
   30   , FixedPointEquation(..)
   31   , QdFpScheme(..)
   32   , IntegrationControl(..)
   33   , RoughHestonApproximation(..)
   34   , FourierIntegration(..)
   35   , H1HwMean(..)
   36   , LatticeTime(..)
   37   , FdmGrid(..)
   38   , OperatorSplittingOrder(..)
   39   , PerpetualFuturesInterpolationType(..)
   40   , StrikeSpec(..)
   41 
   42     -- * Constructors
   43   , asPricingEngine
   44     -- ** Discounting and counterparty engines
   45   , discountingBondEngine
   46   , riskyBondEngine
   47   , discountingSwapEngine
   48   , discountingFxForwardEngine
   49   , discountingConstNotionalCrossCurrencySwapEngine
   50   , discountingMtmCrossCurrencyBasisSwapEngine
   51   , counterpartyAdjSwapEngine
   52   , discountingPerpetualFuturesEngine
   53 
   54     -- ** Analytic, lattice and Monte Carlo engines
   55   , analyticBarrierEngine
   56   , analyticTwoAssetBarrierEngine
   57   , analyticSoftBarrierEngine
   58   , analyticPartialTimeBarrierOptionEngine
   59   , analyticBinaryBarrierEngine
   60   , analyticSimpleChooserEngine
   61   , analyticComplexChooserEngine
   62   , analyticTwoAssetCorrelationEngine
   63   , analyticEuropeanMargrabeEngine
   64   , analyticAmericanMargrabeEngine
   65   , analyticWriterExtensibleOptionEngine
   66   , analyticHolderExtensibleOptionEngine
   67   , fdBlackScholesBarrierEngine
   68   , fdHestonBarrierEngine
   69   , binomialBarrierEngine
   70   , vannaVolgaBarrierEngine
   71   , analyticDoubleBarrierEngine
   72   , fdHestonDoubleBarrierEngine
   73   , vannaVolgaDoubleBarrierEngine
   74   , binomialDoubleBarrierEngine
   75   , mcDoubleBarrierEngine
   76   , analyticCliquetEngine
   77   , analyticCompoundOptionEngine
   78   , analyticContinuousFixedLookbackEngine
   79   , analyticContinuousFloatingLookbackEngine
   80   , analyticContinuousPartialFloatingLookbackEngine
   81   , analyticContinuousPartialFixedLookbackEngine
   82   , analyticContinuousGeometricAveragePriceAsianEngine
   83   , analyticContinuousGeometricAveragePriceAsianHestonEngine
   84   , analyticDiscreteGeometricAveragePriceAsianHestonEngine
   85   , mcLookbackFixedEngine
   86   , mcLookbackFloatingEngine
   87   , mcLookbackPartialFixedEngine
   88   , mcLookbackPartialFloatingEngine
   89   , analyticDigitalAmericanEngine
   90   , analyticDigitalAmericanKoEngine
   91   , analyticDiscreteGeometricAveragePriceAsianEngine
   92   , analyticDiscreteGeometricAverageStrikeAsianEngine
   93   , turnbullWakemanAsianEngine
   94   , fdBlackScholesAsianEngine
   95   , analyticDividendEuropeanEngine
   96   , analyticEuropeanEngine
   97   , analyticPerformanceEngine
   98   , forwardEuropeanEngine
   99   , forwardBaroneAdesiWhaleyEngine
  100   , forwardBjerksundStenslandEngine
  101   , forwardFdBlackScholesVanillaEngine
  102   , mcForwardEuropeanBsEngine
  103   , mcForwardEuropeanHestonEngine
  104   , analyticHestonForwardEuropeanEngine
  105   , quantoEuropeanEngine
  106   , quantoForwardEuropeanEngine
  107   , quantoForwardPerformanceEuropeanEngine
  108   , quantoBarrierEngine
  109   , quantoDoubleBarrierEngine
  110     -- ** Rates and inflation
  111   , blackCapFloorEngineFromVolatilityStructure
  112   , blackCapFloorEngine
  113   , blackSwaptionEngine
  114   , haganIrregularSwaptionEngine
  115   , blackSwaptionEngineFromVolatilityStructure
  116   , bachelierCapFloorEngineFromVolatilityStructure
  117   , bachelierCapFloorEngine
  118   , yoyInflationBlackCapFloorEngine
  119   , yoyInflationUnitDisplacedBlackCapFloorEngine
  120   , yoyInflationBachelierCapFloorEngine
  121   , interpolatingCpiCapFloorEngine
  122   , bachelierSwaptionEngine
  123   , bachelierSwaptionEngineFromVolatilityStructure
  124   , analyticBsmHullWhiteEngine
  125   , analyticCapFloorEngine
  126   , gaussian1dCapFloorEngine
  127     -- ** Equity, stochastic-volatility and exotic products
  128   , analyticGjrGarchEngine
  129   , analyticHestonEngine
  130   , analyticRoughHestonEngine
  131   , analyticRoughHestonEngineWithIntegration
  132   , analyticH1HwEngine
  133   , analyticHestonHullWhiteEngine
  134   , batesEngine
  135   , fftVanillaEngine
  136   , g2SwaptionEngine
  137   , jumpDiffusionEngine
  138   , treeCapFloorEngine
  139   , treeSwaptionEngine
  140   , treeVanillaSwapEngine
  141   , varianceGammaEngine
  142   , analyticHestonEngineOptimalControlVariate
  143   , mcHestonHullWhiteEngine
  144   , mcAmericanEngine
  145   , mcBarrierEngine
  146   , mcDigitalEngine
  147   , mcDiscreteArithmeticApEngine
  148   , mcDiscreteArithmeticAsEngine
  149   , mcDiscreteGeometricApEngine
  150   , mcDiscreteArithmeticApHestonEngine
  151   , mcDiscreteGeometricApHestonEngine
  152   , mcEuropeanEngine
  153   , mcEuropeanGjrGarchEngine
  154   , mcEuropeanHestonEngine
  155   , integralHestonVarianceOptionEngine
  156   , mcHullWhiteCapFloorEngine
  157   , mcHimalayaEngine
  158   , mcPagodaEngine
  159   , mcEuropeanBasketEngine
  160   , mcEverestEngine
  161   , mcAmericanBasketEngine
  162   , mcPerformanceEngine
  163   , mcVarianceSwapEngine
  164   , baroneAdesiWhaleyApproximationEngine
  165   , batesDetJumpEngine
  166   , batesDoubleExpDetJumpEngine
  167   , batesDoubleExpEngine
  168   , bjerksundStenslandApproximationEngine
  169   , qdPlusAmericanEngine
  170   , qdFpAmericanEngine
  171   , continuousArithmeticAsianVecerEngine
  172     -- ** Credit and spread products
  173   , blackCdsOptionEngine
  174   , integralCdsEngine
  175   , integralEngine
  176   , isdaCdsEngine
  177   , jamshidianSwaptionEngine
  178   , gaussian1dSwaptionEngine
  179   , gaussian1dNonstandardSwaptionEngine
  180   , gaussian1dFloatFloatSwaptionEngine
  181   , gaussian1dJamshidianSwaptionEngine
  182   , juQuadraticApproximationEngine
  183   , kirkEngine
  184   , midPointCdsEngine
  185   , midPointCdoEngine
  186   , integralCdoEngine
  187   , integralNtdEngine
  188   , replicatingVarianceSwapEngine
  189   , stulzEngine
  190   , bjerksundStenslandSpreadEngine
  191   , operatorSplittingSpreadEngine
  192   , pearsonSpreadEngine
  193   , gaussianCopulaSpreadEngine
  194   , fd2dBlackScholesVanillaEngine
  195   , choiBasketEngine
  196   , dengLiZhouBasketEngine
  197   , fdndimBlackScholesVanillaEngine
  198   , singleFactorBsmBasketEngine
  199   , lfmSwaptionEngine
  200 
  201     -- ** Finite-difference engines
  202   , fdG2SwaptionEngine
  203   , fdHullWhiteSwaptionEngine
  204   , binomialVanillaEngine
  205   , fdBlackScholesVanillaEngine
  206   , fdBlackScholesVanillaEngineQuanto
  207   , fdmQuantoHelper
  208   , quantoAdjustment
  209   , fdHestonVanillaEngine
  210   , cosHestonEngine
  211   , analyticPdfHestonEngine
  212   , fdBatesVanillaEngine
  213   , fdBlackScholesShoutEngine
  214   , fdHestonVanillaEngineQuanto
  215   , fdHestonHullWhiteVanillaEngine
  216 
  217     -- ** Convertible and callable bond engines
  218   , binomialConvertibleEngine
  219   , blackCallableFixedRateBondEngineFromVolatilityStructure
  220   , blackCallableFixedRateBondEngine
  221   , blackCallableZeroCouponBondEngineFromVolatilityStructure
  222   , blackCallableZeroCouponBondEngine
  223   , treeCallableFixedRateBondEngine
  224   , treeCallableZeroCouponBondEngine
  225 
  226     -- ** Black and Bachelier calculators
  227   , asBlackCalculator
  228   , blackCalculator
  229   , blackScholesCalculator
  230   , bachelierCalculator
  231   , blackDeltaCalculator
  232 
  233     -- * Inspectors
  234   , roughHestonPriceVanillaPayoff
  235   , roughHestonCharacteristicFunction
  236   , roughHestonLogCharacteristicFunction
  237   , roughHestonRiccatiSolution
  238   , roughHestonNumberOfEvaluations
  239     -- ** Option-calculator capability
  240   , HasOptionCalculator(..)
  241 
  242     -- ** Calculator sensitivities
  243   , blackVanna
  244   , blackScholesDelta
  245   , blackScholesElasticity
  246   , blackScholesGamma
  247   , blackScholesTheta
  248   , blackScholesThetaPerDay
  249   , bachelierVanna
  250 
  251     -- ** Formulae, probabilities and SABR helpers
  252   , deltaFromStrike
  253   , strikeFromDelta
  254   , atmStrike
  255   , blackFormula
  256   , blackCashItmProbability
  257   , blackImpliedStdDev
  258   , blackImpliedStdDevApproximation
  259   , blackStdDevDerivative
  260   , blackVolDerivative
  261   , bachelierBlackFormula
  262   , blackForwardDerivative
  263   , blackImpliedStdDevChambers
  264   , blackImpliedStdDevApproximationRs
  265   , blackImpliedStdDevLiRs
  266   , blackAssetItmProbability
  267   , blackStdDevSecondDerivative
  268   , bachelierForwardDerivative
  269   , bachelierImpliedVol
  270   , bachelierImpliedVolChoi
  271   , bachelierStdDevDerivative
  272   , bachelierAssetItmProbability
  273   , defaultThetaPerDay
  274   , unsafeSabrLogNormalVolatility
  275   , unsafeShiftedSabrVolatility
  276   , unsafeSabrNormalVolatility
  277   , unsafeSabrVolatility
  278   , sabrVolatility
  279   , shiftedSabrVolatility
  280   , sabrFlochKennedyVolatility
  281   , validateSabrParameters
  282   , sabrGuess
  283   ) where
  284 import qualified Foreign.C.Types as C2HSImp
  285 import qualified Foreign.ForeignPtr as C2HSImp
  286 import qualified Foreign.Marshal.Utils as C2HSImp
  287 import qualified Foreign.Ptr as C2HSImp
  288 import qualified System.IO.Unsafe as C2HSImp
  289 
  290 
  291 
  292 
  293 
  294 
  295 
  296 
  297 import QuantLib.Internal
  298 import Data.Complex(Complex)
  299 import QuantLib.TermStructure(TermPoint(..))
  300 import QuantLib.Internal.Type
  301 import QuantLib.InterestRate(VolatilityType)
  302 import QuantLib.Math
  303 
  304 import QuantLib.Quote(DeltaType, AtmType)
  305 import QuantLib.Instrument.Option hiding(itmCashProbability, deltaForward, strikeSensitivity, dividendRho, rho, vega)
  306 import QuantLib.Internal.Common
  307 import Data.List.NonEmpty(NonEmpty, toList)
  308 
  309 data CashAnnuityModel = SwapRate
  310                       | DiscountCurve
  311   deriving (Enum,Show,Eq,Read)
  312 
  313 
  314 
  315 -- |Numerical integration control for analytic Heston-family engines.
  316 data IntegrationControl
  317   = IntegrationOrder Word
  318   | IntegrationTolerance Double Word
  319   deriving (Eq, Show)
  320 
  321 -- |How the H1-HW engine reads E[sqrt v] of the Heston variance. QuantLib fits @a + b exp(-c t)@
  322 -- at one year or @1 / kappa@, depending on its variance parameters; the fit can fail for a
  323 -- nonmonotone mean. 'ExactMean' uses Gauss-Legendre on the specified positive number of nodes,
  324 -- with an asymptotic expectation for large noncentrality. Its accuracy depends on the node count
  325 -- and model parameters; it provides no adaptive error estimate and retains the H1-HW approximation.
  326 data H1HwMean
  327   = FittedExponentialMean
  328   | ExactMean Word
  329   deriving (Eq, Show)
  330 
  331 -- |An option's type and strike, given directly or carried by a striked payoff.
  332 data StrikeSpec
  333   = Strike !OptionType !Double
  334   | StrikePayoff !StrikedPayoff
  335 
  336 -- |Time discretization for lattice pricing engines.
  337 data LatticeTime
  338   = TimeSteps Word
  339   | ExplicitTimeGrid TimeGrid
  340 
  341 -- |Spatial discretization for an n-dimensional finite-difference engine.
  342 data FdmGrid
  343   = UniformGrid Word
  344   | AxisGrids (NonEmpty Word)
  345   deriving (Eq, Show)
  346 data Probabilities = None
  347                    | Naive
  348                    | Digital
  349   deriving (Enum,Show,Eq,Read)
  350 
  351 
  352 data CashDividendModel = CashDividendSpot
  353                        | CashDividendEscrowed
  354   deriving (Enum,Show,Eq,Read)
  355 
  356 
  357 data NumericalFix = NumericalFixNone
  358                   | NumericalFixTaylor
  359   deriving (Enum,Show,Eq,Read)
  360 
  361 
  362 data AccrualBias = HalfDayBias
  363                  | NoBias
  364   deriving (Enum,Show,Eq,Read)
  365 
  366 
  367 data ForwardsInCouponPeriod = Flat
  368                             | Piecewise
  369   deriving (Enum,Show,Eq,Read)
  370 
  371 
  372 data SolverType = Brent
  373                 | Newton
  374                 | Ridder
  375                 | Halley
  376                 | SuperHalley
  377   deriving (Enum,Show,Eq,Read)
  378 
  379 
  380 data FixedPointEquation = FP_A
  381                         | FP_B
  382                         | Auto
  383   deriving (Enum,Show,Eq,Read)
  384 
  385 
  386 data QdFpScheme = FastScheme
  387                 | AccurateScheme
  388                 | HighPrecisionScheme
  389   deriving (Show,Eq,Read)
  390 instance Enum QdFpScheme where
  391   succ FastScheme = AccurateScheme
  392   succ AccurateScheme = HighPrecisionScheme
  393   succ HighPrecisionScheme = error "QdFpScheme.succ: HighPrecisionScheme has no successor"
  394 
  395   pred AccurateScheme = FastScheme
  396   pred HighPrecisionScheme = AccurateScheme
  397   pred FastScheme = error "QdFpScheme.pred: FastScheme has no predecessor"
  398 
  399   enumFromTo from to = go from
  400     where
  401       end = fromEnum to
  402       go v = case compare (fromEnum v) end of
  403                  LT -> v : go (succ v)
  404                  EQ -> [v]
  405                  GT -> []
  406 
  407   enumFrom from = enumFromTo from HighPrecisionScheme
  408 
  409   fromEnum FastScheme = 0
  410   fromEnum AccurateScheme = 1
  411   fromEnum HighPrecisionScheme = 2
  412 
  413   toEnum 0 = FastScheme
  414   toEnum 1 = AccurateScheme
  415   toEnum 2 = HighPrecisionScheme
  416   toEnum unmatched = error ("QdFpScheme.toEnum: Cannot match " ++ show unmatched)
  417 
  418 
  419 data OperatorSplittingOrder = First
  420                             | Second
  421   deriving (Enum,Show,Eq,Read)
  422 
  423 
  424 data PerpetualFuturesInterpolationType = PerpetualFuturesPiecewiseConstant
  425                                        | PerpetualFuturesLinearInterpolation
  426                                        | PerpetualFuturesCubicSpline
  427   deriving (Show,Eq,Read)
  428 instance Enum PerpetualFuturesInterpolationType where
  429   succ PerpetualFuturesPiecewiseConstant = PerpetualFuturesLinearInterpolation
  430   succ PerpetualFuturesLinearInterpolation = PerpetualFuturesCubicSpline
  431   succ PerpetualFuturesCubicSpline = error "PerpetualFuturesInterpolationType.succ: PerpetualFuturesCubicSpline has no successor"
  432 
  433   pred PerpetualFuturesLinearInterpolation = PerpetualFuturesPiecewiseConstant
  434   pred PerpetualFuturesCubicSpline = PerpetualFuturesLinearInterpolation
  435   pred PerpetualFuturesPiecewiseConstant = error "PerpetualFuturesInterpolationType.pred: PerpetualFuturesPiecewiseConstant has no predecessor"
  436 
  437   enumFromTo from to = go from
  438     where
  439       end = fromEnum to
  440       go v = case compare (fromEnum v) end of
  441                  LT -> v : go (succ v)
  442                  EQ -> [v]
  443                  GT -> []
  444 
  445   enumFrom from = enumFromTo from PerpetualFuturesCubicSpline
  446 
  447   fromEnum PerpetualFuturesPiecewiseConstant = 0
  448   fromEnum PerpetualFuturesLinearInterpolation = 1
  449   fromEnum PerpetualFuturesCubicSpline = 2
  450 
  451   toEnum 0 = PerpetualFuturesPiecewiseConstant
  452   toEnum 1 = PerpetualFuturesLinearInterpolation
  453   toEnum 2 = PerpetualFuturesCubicSpline
  454   toEnum unmatched = error ("PerpetualFuturesInterpolationType.toEnum: Cannot match " ++ show unmatched)
  455 
  456 
  457 
  458 
  459 
  460 
  461 
  462 
  463 
  464 
  465 
  466 
  467 
  468 
  469 
  470 
  471 
  472 
  473 
  474 
  475 
  476 
  477 
  478 
  479 
  480 
  481 
  482 
  483 
  484 
  485 
  486 
  487 
  488 
  489 
  490 
  491 
  492 
  493 
  494 
  495 
  496 
  497 
  498 
  499 
  500 
  501 
  502 
  503 
  504 
  505 
  506 
  507 
  508 
  509 
  510 
  511 
  512 
  513 
  514 
  515 
  516 
  517 
  518 
  519 
  520 
  521 
  522 
  523 
  524 
  525 
  526 
  527 
  528 
  529 
  530 
  531 
  532 
  533 
  534 
  535 
  536 
  537 
  538 
  539 
  540 
  541 
  542 
  543 
  544 
  545 
  546 
  547 
  548 
  549 
  550 
  551 -- |discounts a bond's cash flows off a yield term structure
  552 discountingBondEngine :: (GenYieldTermStructure y) -> (Maybe Bool) -- ^includeSettlementDateFlows
  553  -> IO ((PricingEngine))
  554 discountingBondEngine a1 a2 =
  555   withYieldTermStructure a1 $ \a1' -> 
  556   let {a2' = fromMaybeBool a2} in 
  557   preErrorCheck $ \a3' -> 
  558   discountingBondEngine'_ a1' a2' a3' >>= \res ->
  559   peekPricingEngine res >>= \res' ->
  560   errorCheck  a3'>>
  561   return (res')
  562 
  563 
  564 
  565 -- |Discounts perpetual-futures cashflows to the curves' reference date. The
  566 -- three funding vectors must be non-empty and have identical lengths. The
  567 -- engine supports only 'PerpetualFuturesLinear' and 'PerpetualFuturesInverse'
  568 -- payoffs; QuantLib rejects a Quanto payoff at pricing time.
  569 discountingPerpetualFuturesEngine
  570   :: GenYieldTermStructure y1 -> GenYieldTermStructure y2 -> GenQuote q
  571   -> NonEmpty (Double, Double, Double) -- ^@(fundingTime, fundingRate, interestRateDiff)@
  572   -> PerpetualFuturesInterpolationType -> Double -> IO PricingEngine
  573 discountingPerpetualFuturesEngine domestic foreignCurve spot funding interpolation maxT =
  574   qlDiscountingPerpetualFuturesEngine domestic foreignCurve spot times rates diffs interpolation maxT
  575   where (times, rates, diffs) = unzip3 (toList funding)
  576 
  577 qlDiscountingPerpetualFuturesEngine :: (GenYieldTermStructure y1) -- ^domesticDiscountCurve
  578  -> (GenYieldTermStructure y2) -- ^foreignDiscountCurve
  579  -> (GenQuote q) -- ^assetSpot
  580  -> ([Double]) -- ^fundingTimes
  581  -> ([Double]) -- ^fundingRates
  582  -> ([Double]) -- ^interestRateDiffs
  583  -> (PerpetualFuturesInterpolationType) -- ^fundingInterpType
  584  -> (Double) -- ^maxT
  585  -> IO ((PricingEngine))
  586 qlDiscountingPerpetualFuturesEngine a1 a2 a3 a4 a5 a6 a7 a8 =
  587   withYieldTermStructure a1 $ \a1' -> 
  588   withYieldTermStructure a2 $ \a2' -> 
  589   withQuote a3 $ \a3' -> 
  590   withDoubleArray a4 $ \(a4'1, a4'2) -> 
  591   withDoubleArray a5 $ \(a5'1, a5'2) -> 
  592   withDoubleArray a6 $ \(a6'1, a6'2) -> 
  593   let {a7' = fromEnumC a7} in 
  594   let {a8' = realToFrac a8} in 
  595   preErrorCheck $ \a9' -> 
  596   qlDiscountingPerpetualFuturesEngine'_ a1' a2' a3' a4'1  a4'2 a5'1  a5'2 a6'1  a6'2 a7' a8' a9' >>= \res ->
  597   peekPricingEngine res >>= \res' ->
  598   errorCheck  a9'>>
  599   return (res')
  600 
  601 
  602 
  603 -- |discounts a bond's cash flows off a default-risky curve and a flat recovery rate
  604 riskyBondEngine :: (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
  605  -> (GenYieldTermStructure y) -> IO ((PricingEngine))
  606 riskyBondEngine a1 a2 a3 =
  607   withDefaultProbabilityTermStructure a1 $ \a1' -> 
  608   let {a2' = realToFrac a2} in 
  609   withYieldTermStructure a3 $ \a3' -> 
  610   preErrorCheck $ \a4' -> 
  611   riskyBondEngine'_ a1' a2' a3' a4' >>= \res ->
  612   peekPricingEngine res >>= \res' ->
  613   errorCheck  a4'>>
  614   return (res')
  615 
  616 
  617 
  618 -- |discounts a swap's legs off a single discount curve
  619 discountingSwapEngine :: (GenYieldTermStructure y) -> (Maybe Bool) -- ^includeSettlementDateFlows
  620  -> (Maybe Day) -- ^settlementDate
  621  -> (Maybe Day) -- ^npvDate
  622  -> IO ((PricingEngine))
  623 discountingSwapEngine a1 a2 a3 a4 =
  624   withYieldTermStructure a1 $ \a1' -> 
  625   let {a2' = fromMaybeBool a2} in 
  626   withMaybeDay a3 $ \a3' -> 
  627   withMaybeDay a4 $ \a4' -> 
  628   preErrorCheck $ \a5' -> 
  629   discountingSwapEngine'_ a1' a2' a3' a4' a5' >>= \res ->
  630   peekPricingEngine res >>= \res' ->
  631   errorCheck  a5'>>
  632   return (res')
  633 
  634 
  635 
  636 -- |discounts an FX forward's two legs off their respective currency discount curves
  637 discountingFxForwardEngine :: (GenYieldTermStructure y1) -- ^sourceCurrencyDiscountCurve
  638  -> (GenYieldTermStructure y2) -- ^targetCurrencyDiscountCurve
  639  -> (GenQuote q) -- ^spotFx
  640  -> IO ((PricingEngine))
  641 discountingFxForwardEngine a1 a2 a3 =
  642   withYieldTermStructure a1 $ \a1' -> 
  643   withYieldTermStructure a2 $ \a2' -> 
  644   withQuote a3 $ \a3' -> 
  645   preErrorCheck $ \a4' -> 
  646   discountingFxForwardEngine'_ a1' a2' a3' a4' >>= \res ->
  647   peekPricingEngine res >>= \res' ->
  648   errorCheck  a4'>>
  649   return (res')
  650 
  651 
  652 
  653 -- |Discounts each leg of a 'QuantLib.Instrument.Swap.ConstNotionalCrossCurrencySwap' (or either
  654 -- of its two leaves) off its own currency's discount curve, converting to @domesticCcy@ via
  655 -- @spotFX@ (quoted as units of @domesticCcy@ per unit of @foreignCcy@, w.r.t. a settlement equal
  656 -- to the npv date unless @spotFXSettleDate@ says otherwise). Each leg's stored currency must equal
  657 -- @domesticCcy@ or @foreignCcy@; the two discount curves must share the same reference date.
  658 discountingConstNotionalCrossCurrencySwapEngine :: (Currency) -- ^domesticCcy
  659  -> (GenYieldTermStructure y1) -- ^domesticCcyDiscountCurve
  660  -> (Currency) -- ^foreignCcy
  661  -> (GenYieldTermStructure y2) -- ^foreignCcyDiscountCurve
  662  -> (GenQuote q) -- ^spotFX
  663  -> (Maybe Bool) -- ^includeSettlementDateFlows
  664  -> (Maybe Day) -- ^settlementDate
  665  -> (Maybe Day) -- ^npvDate
  666  -> (Maybe Day) -- ^spotFXSettleDate
  667  -> IO ((PricingEngine))
  668 discountingConstNotionalCrossCurrencySwapEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  669   withCurrency a1 $ \a1' -> 
  670   withYieldTermStructure a2 $ \a2' -> 
  671   withCurrency a3 $ \a3' -> 
  672   withYieldTermStructure a4 $ \a4' -> 
  673   withQuote a5 $ \a5' -> 
  674   let {a6' = fromMaybeBool a6} in 
  675   withMaybeDay a7 $ \a7' -> 
  676   withMaybeDay a8 $ \a8' -> 
  677   withMaybeDay a9 $ \a9' -> 
  678   preErrorCheck $ \a10' -> 
  679   discountingConstNotionalCrossCurrencySwapEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
  680   peekPricingEngine res >>= \res' ->
  681   errorCheck  a10'>>
  682   return (res')
  683 
  684 
  685 
  686 -- | CVA/DVA-adjusted swap pricing engine. @invstDTS@\/@invstRecoveryRate@ are the
  687 -- own (investor-side) default probability curve and recovery rate for bilateral
  688 -- CVA\/DVA; pass 'Nothing' for @invstDTS@ and @0.999@ for @invstRecoveryRate@ to
  689 -- match upstream's unilateral-CVA-only defaults.
  690 counterpartyAdjSwapEngine :: (GenYieldTermStructure y) -- ^discountCurve
  691  -> (GenQuote q) -- ^blackVol
  692  -> (GenDefaultProbabilityTermStructure d1) -- ^ctptyDTS
  693  -> (Double) -- ^ctptyRecoveryRate
  694  -> (Maybe (GenDefaultProbabilityTermStructure d2)) -- ^invstDTS
  695  -> (Double) -- ^invstRecoveryRate
  696  -> IO ((PricingEngine))
  697 counterpartyAdjSwapEngine a1 a2 a3 a4 a5 a6 =
  698   withYieldTermStructure a1 $ \a1' -> 
  699   withQuote a2 $ \a2' -> 
  700   withDefaultProbabilityTermStructure a3 $ \a3' -> 
  701   let {a4' = realToFrac a4} in 
  702   withMaybeDefaultProbabilityTermStructure a5 $ \a5' -> 
  703   let {a6' = realToFrac a6} in 
  704   preErrorCheck $ \a7' -> 
  705   counterpartyAdjSwapEngine'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  706   peekPricingEngine res >>= \res' ->
  707   errorCheck  a7'>>
  708   return (res')
  709 
  710 
  711 
  712 -- |analytic pricing engine for barrier options
  713 analyticBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  714 analyticBarrierEngine a1 =
  715   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  716   preErrorCheck $ \a2' -> 
  717   analyticBarrierEngine'_ a1' a2' >>= \res ->
  718   peekPricingEngine res >>= \res' ->
  719   errorCheck  a2'>>
  720   return (res')
  721 
  722 
  723 
  724 -- |analytic (Heynen and Kat) pricing engine for a barrier option on two assets, where the first asset's value is compared to the strike and the second's is monitored against the barrier
  725 analyticTwoAssetBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs1) -- ^process1
  726  -> (GenGeneralizedBlackScholesProcess gbs2) -- ^process2
  727  -> (GenQuote q) -- ^rho
  728  -> IO ((PricingEngine))
  729 analyticTwoAssetBarrierEngine a1 a2 a3 =
  730   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  731   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  732   withQuote a3 $ \a3' -> 
  733   preErrorCheck $ \a4' -> 
  734   analyticTwoAssetBarrierEngine'_ a1' a2' a3' a4' >>= \res ->
  735   peekPricingEngine res >>= \res' ->
  736   errorCheck  a4'>>
  737   return (res')
  738 
  739 
  740 
  741 -- |analytic pricing engine for soft barrier options, knocked in/out proportionally over a barrier range
  742 analyticSoftBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  743 analyticSoftBarrierEngine a1 =
  744   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  745   preErrorCheck $ \a2' -> 
  746   analyticSoftBarrierEngine'_ a1' a2' >>= \res ->
  747   peekPricingEngine res >>= \res' ->
  748   errorCheck  a2'>>
  749   return (res')
  750 
  751 
  752 
  753 -- |analytic pricing engine for simple chooser options
  754 analyticSimpleChooserEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  755 analyticSimpleChooserEngine a1 =
  756   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  757   preErrorCheck $ \a2' -> 
  758   analyticSimpleChooserEngine'_ a1' a2' >>= \res ->
  759   peekPricingEngine res >>= \res' ->
  760   errorCheck  a2'>>
  761   return (res')
  762 
  763 
  764 
  765 -- |Analytic Black-Scholes engine for a 'complexChooserOption'. Both alternatives must have European exercise.
  766 analyticComplexChooserEngine :: (GenGeneralizedBlackScholesProcess gbs) -- ^process
  767  -> IO ((PricingEngine))
  768 analyticComplexChooserEngine a1 =
  769   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  770   preErrorCheck $ \a2' -> 
  771   analyticComplexChooserEngine'_ a1' a2' >>= \res ->
  772   peekPricingEngine res >>= \res' ->
  773   errorCheck  a2'>>
  774   return (res')
  775 
  776 
  777 
  778 -- |analytic pricing engine for two-asset correlation options
  779 analyticTwoAssetCorrelationEngine :: (GenGeneralizedBlackScholesProcess gbs1) -- ^process1
  780  -> (GenGeneralizedBlackScholesProcess gbs2) -- ^process2
  781  -> (GenQuote q) -- ^correlation
  782  -> IO ((PricingEngine))
  783 analyticTwoAssetCorrelationEngine a1 a2 a3 =
  784   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  785   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  786   withQuote a3 $ \a3' -> 
  787   preErrorCheck $ \a4' -> 
  788   analyticTwoAssetCorrelationEngine'_ a1' a2' a3' a4' >>= \res ->
  789   peekPricingEngine res >>= \res' ->
  790   errorCheck  a4'>>
  791   return (res')
  792 
  793 
  794 
  795 -- |Analytic (Margrabe) engine for a European 'margrabeOption': the closed-form price of an
  796 -- option to exchange one asset for another, from W. Margrabe, \"The Value of an Option to
  797 -- Exchange One Asset for Another\", Journal of Finance 33 (March 1978), 177-186.
  798 analyticEuropeanMargrabeEngine :: (GenGeneralizedBlackScholesProcess gbs1) -- ^process1
  799  -> (GenGeneralizedBlackScholesProcess gbs2) -- ^process2
  800  -> (Double) -- ^correlation
  801  -> IO ((PricingEngine))
  802 analyticEuropeanMargrabeEngine a1 a2 a3 =
  803   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  804   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  805   let {a3' = realToFrac a3} in 
  806   preErrorCheck $ \a4' -> 
  807   analyticEuropeanMargrabeEngine'_ a1' a2' a3' a4' >>= \res ->
  808   peekPricingEngine res >>= \res' ->
  809   errorCheck  a4'>>
  810   return (res')
  811 
  812 
  813 
  814 -- |Analytic (Margrabe) engine for an American 'margrabeOption': the closed-form price of an
  815 -- option to exchange one asset for another with early exercise, from W. Margrabe, \"The Value
  816 -- of an American Option to Exchange One Asset for Another\", Journal of Finance 33, 177-86.
  817 analyticAmericanMargrabeEngine :: (GenGeneralizedBlackScholesProcess gbs1) -- ^process1
  818  -> (GenGeneralizedBlackScholesProcess gbs2) -- ^process2
  819  -> (Double) -- ^correlation
  820  -> IO ((PricingEngine))
  821 analyticAmericanMargrabeEngine a1 a2 a3 =
  822   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  823   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  824   let {a3' = realToFrac a3} in 
  825   preErrorCheck $ \a4' -> 
  826   analyticAmericanMargrabeEngine'_ a1' a2' a3' a4' >>= \res ->
  827   peekPricingEngine res >>= \res' ->
  828   errorCheck  a4'>>
  829   return (res')
  830 
  831 
  832 
  833 -- |analytic pricing engine for writer-extensible options
  834 analyticWriterExtensibleOptionEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  835 analyticWriterExtensibleOptionEngine a1 =
  836   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  837   preErrorCheck $ \a2' -> 
  838   analyticWriterExtensibleOptionEngine'_ a1' a2' >>= \res ->
  839   peekPricingEngine res >>= \res' ->
  840   errorCheck  a2'>>
  841   return (res')
  842 
  843 
  844 
  845 -- |Analytic Black-Scholes engine for a 'holderExtensibleOption'. The original option must have European exercise.
  846 analyticHolderExtensibleOptionEngine :: (GenGeneralizedBlackScholesProcess gbs) -- ^process
  847  -> IO ((PricingEngine))
  848 analyticHolderExtensibleOptionEngine a1 =
  849   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  850   preErrorCheck $ \a2' -> 
  851   analyticHolderExtensibleOptionEngine'_ a1' a2' >>= \res ->
  852   peekPricingEngine res >>= \res' ->
  853   errorCheck  a2'>>
  854   return (res')
  855 
  856 
  857 
  858 -- |analytic pricing engine for partial-time barrier options
  859 analyticPartialTimeBarrierOptionEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  860 analyticPartialTimeBarrierOptionEngine a1 =
  861   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  862   preErrorCheck $ \a2' -> 
  863   analyticPartialTimeBarrierOptionEngine'_ a1' a2' >>= \res ->
  864   peekPricingEngine res >>= \res' ->
  865   errorCheck  a2'>>
  866   return (res')
  867 
  868 
  869 
  870 -- |analytic pricing engine for American binary barrier options (cash-or-nothing/asset-or-nothing)
  871 analyticBinaryBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
  872 analyticBinaryBarrierEngine a1 =
  873   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  874   preErrorCheck $ \a2' -> 
  875   analyticBinaryBarrierEngine'_ a1' a2' >>= \res ->
  876   peekPricingEngine res >>= \res' ->
  877   errorCheck  a2'>>
  878   return (res')
  879 
  880 
  881 
  882 -- |/NB/ Timesteps for Cox-Ross-Rubinstein trees are adjusted using the Boyle-Lau algorithm;
  883 -- pass @maxTimeSteps = timeSteps@ to disable it, or @0@ to use the library's default heuristic.
  884 binomialBarrierEngine :: (BinomialTree) -> (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^timeSteps
  885  -> (Word) -- ^maxTimeSteps
  886  -> IO ((PricingEngine))
  887 binomialBarrierEngine a1 a2 a3 a4 =
  888   let {a1' = (fromIntegral . fromEnum) a1} in 
  889   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  890   let {a3' = fromIntegral a3} in 
  891   let {a4' = fromIntegral a4} in 
  892   preErrorCheck $ \a5' -> 
  893   binomialBarrierEngine'_ a1' a2' a3' a4' a5' >>= \res ->
  894   peekPricingEngine res >>= \res' ->
  895   errorCheck  a5'>>
  896   return (res')
  897 
  898 
  899 
  900 -- |FX barrier option engine using the vanna-volga method to account for the volatility smile
  901 vannaVolgaBarrierEngine :: (DeltaVolQuote) -- ^atmVol
  902  -> (DeltaVolQuote) -- ^vol25Put
  903  -> (DeltaVolQuote) -- ^vol25Call
  904  -> (GenQuote q) -- ^spotFX
  905  -> (GenYieldTermStructure y1) -- ^domesticTS
  906  -> (GenYieldTermStructure y2) -- ^foreignTS
  907  -> (Bool) -- ^adaptVanDelta
  908  -> (Double) -- ^bsPriceWithSmile
  909  -> IO ((PricingEngine))
  910 vannaVolgaBarrierEngine a1 a2 a3 a4 a5 a6 a7 a8 =
  911   withGenQuote a1 $ \a1' -> 
  912   withGenQuote a2 $ \a2' -> 
  913   withGenQuote a3 $ \a3' -> 
  914   withQuote a4 $ \a4' -> 
  915   withYieldTermStructure a5 $ \a5' -> 
  916   withYieldTermStructure a6 $ \a6' -> 
  917   let {a7' = C2HSImp.fromBool a7} in 
  918   let {a8' = realToFrac a8} in 
  919   preErrorCheck $ \a9' -> 
  920   vannaVolgaBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
  921   peekPricingEngine res >>= \res' ->
  922   errorCheck  a9'>>
  923   return (res')
  924 
  925 
  926 
  927 -- |analytic pricing engine for double-barrier European options
  928 analyticDoubleBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Int) -- ^series
  929  -> IO ((PricingEngine))
  930 analyticDoubleBarrierEngine a1 a2 =
  931   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  932   let {a2' = fromIntegral a2} in 
  933   preErrorCheck $ \a3' -> 
  934   analyticDoubleBarrierEngine'_ a1' a2' a3' >>= \res ->
  935   peekPricingEngine res >>= \res' ->
  936   errorCheck  a3'>>
  937   return (res')
  938 
  939 
  940 
  941 -- |always uses 'AnalyticDoubleBarrierEngine' as the underlying smile-free double-barrier engine
  942 vannaVolgaDoubleBarrierEngine :: (DeltaVolQuote) -- ^atmVol
  943  -> (DeltaVolQuote) -- ^vol25Put
  944  -> (DeltaVolQuote) -- ^vol25Call
  945  -> (GenQuote q) -- ^spotFX
  946  -> (GenYieldTermStructure y1) -- ^domesticTS
  947  -> (GenYieldTermStructure y2) -- ^foreignTS
  948  -> (Bool) -- ^adaptVanDelta
  949  -> (Double) -- ^bsPriceWithSmile
  950  -> (Int) -- ^series
  951  -> IO ((PricingEngine))
  952 vannaVolgaDoubleBarrierEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  953   withGenQuote a1 $ \a1' -> 
  954   withGenQuote a2 $ \a2' -> 
  955   withGenQuote a3 $ \a3' -> 
  956   withQuote a4 $ \a4' -> 
  957   withYieldTermStructure a5 $ \a5' -> 
  958   withYieldTermStructure a6 $ \a6' -> 
  959   let {a7' = C2HSImp.fromBool a7} in 
  960   let {a8' = realToFrac a8} in 
  961   let {a9' = fromIntegral a9} in 
  962   preErrorCheck $ \a10' -> 
  963   vannaVolgaDoubleBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
  964   peekPricingEngine res >>= \res' ->
  965   errorCheck  a10'>>
  966   return (res')
  967 
  968 
  969 
  970 -- |pricing engine for double-barrier options using binomial trees
  971 binomialDoubleBarrierEngine :: (BinomialTree) -> (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^timeSteps
  972  -> IO ((PricingEngine))
  973 binomialDoubleBarrierEngine a1 a2 a3 =
  974   let {a1' = (fromIntegral . fromEnum) a1} in 
  975   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
  976   let {a3' = fromIntegral a3} in 
  977   preErrorCheck $ \a4' -> 
  978   binomialDoubleBarrierEngine'_ a1' a2' a3' a4' >>= \res ->
  979   peekPricingEngine res >>= \res' ->
  980   errorCheck  a4'>>
  981   return (res')
  982 
  983 
  984 
  985 -- |Monte Carlo pricing engine for double-barrier options
  986 mcDoubleBarrierEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
  987  -> (Maybe Word) -- ^timeStepsPerYear
  988  -> (Bool) -- ^brownianBridge
  989  -> (Bool) -- ^antitheticVariate
  990  -> (Maybe Word) -- ^requiredSamples
  991  -> (Maybe Double) -- ^requiredTolerance
  992  -> (Maybe Word) -- ^maxSamples
  993  -> (Word) -- ^seed
  994  -> IO ((PricingEngine))
  995 mcDoubleBarrierEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  996   let {a1' = (fromIntegral . fromEnum) a1} in 
  997   let {a2' = (fromIntegral . fromEnum) a2} in 
  998   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
  999   let {a4' = fromMaybeInt a4} in 
 1000   let {a5' = fromMaybeInt a5} in 
 1001   let {a6' = C2HSImp.fromBool a6} in 
 1002   let {a7' = C2HSImp.fromBool a7} in 
 1003   let {a8' = fromMaybeInt a8} in 
 1004   let {a9' = fromMaybeDouble a9} in 
 1005   let {a10' = fromMaybeInt a10} in 
 1006   let {a11' = fromIntegral a11} in 
 1007   preErrorCheck $ \a12' -> 
 1008   mcDoubleBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1009   peekPricingEngine res >>= \res' ->
 1010   errorCheck  a12'>>
 1011   return (res')
 1012 
 1013 
 1014 
 1015 -- |analytic pricing engine for Cliquet (ratchet) options
 1016 analyticCliquetEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1017 analyticCliquetEngine a1 =
 1018   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1019   preErrorCheck $ \a2' -> 
 1020   analyticCliquetEngine'_ a1' a2' >>= \res ->
 1021   peekPricingEngine res >>= \res' ->
 1022   errorCheck  a2'>>
 1023   return (res')
 1024 
 1025 
 1026 
 1027 -- |analytic pricing engine for compound options
 1028 analyticCompoundOptionEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1029 analyticCompoundOptionEngine a1 =
 1030   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1031   preErrorCheck $ \a2' -> 
 1032   analyticCompoundOptionEngine'_ a1' a2' >>= \res ->
 1033   peekPricingEngine res >>= \res' ->
 1034   errorCheck  a2'>>
 1035   return (res')
 1036 
 1037 
 1038 
 1039 -- |analytic pricing engine for European continuous fixed-strike lookback options
 1040 analyticContinuousFixedLookbackEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1041 analyticContinuousFixedLookbackEngine a1 =
 1042   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1043   preErrorCheck $ \a2' -> 
 1044   analyticContinuousFixedLookbackEngine'_ a1' a2' >>= \res ->
 1045   peekPricingEngine res >>= \res' ->
 1046   errorCheck  a2'>>
 1047   return (res')
 1048 
 1049 
 1050 
 1051 -- |analytic pricing engine for European continuous floating-strike lookback options
 1052 analyticContinuousFloatingLookbackEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1053 analyticContinuousFloatingLookbackEngine a1 =
 1054   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1055   preErrorCheck $ \a2' -> 
 1056   analyticContinuousFloatingLookbackEngine'_ a1' a2' >>= \res ->
 1057   peekPricingEngine res >>= \res' ->
 1058   errorCheck  a2'>>
 1059   return (res')
 1060 
 1061 
 1062 
 1063 -- |analytic pricing engine for European continuous partial-time floating-strike lookback options
 1064 analyticContinuousPartialFloatingLookbackEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1065 analyticContinuousPartialFloatingLookbackEngine a1 =
 1066   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1067   preErrorCheck $ \a2' -> 
 1068   analyticContinuousPartialFloatingLookbackEngine'_ a1' a2' >>= \res ->
 1069   peekPricingEngine res >>= \res' ->
 1070   errorCheck  a2'>>
 1071   return (res')
 1072 
 1073 
 1074 
 1075 -- |analytic pricing engine for European continuous partial-time fixed-strike lookback options
 1076 analyticContinuousPartialFixedLookbackEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1077 analyticContinuousPartialFixedLookbackEngine a1 =
 1078   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1079   preErrorCheck $ \a2' -> 
 1080   analyticContinuousPartialFixedLookbackEngine'_ a1' a2' >>= \res ->
 1081   peekPricingEngine res >>= \res' ->
 1082   errorCheck  a2'>>
 1083   return (res')
 1084 
 1085 
 1086 
 1087 -- |analytic pricing engine for European continuous geometric average-price Asian options
 1088 analyticContinuousGeometricAveragePriceAsianEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1089 analyticContinuousGeometricAveragePriceAsianEngine a1 =
 1090   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1091   preErrorCheck $ \a2' -> 
 1092   analyticContinuousGeometricAveragePriceAsianEngine'_ a1' a2' >>= \res ->
 1093   peekPricingEngine res >>= \res' ->
 1094   errorCheck  a2'>>
 1095   return (res')
 1096 
 1097 
 1098 
 1099 -- |Analytic pricing engine for European continuous geometric average-price Asian options under
 1100 -- the Heston stochastic-volatility model.  Implements the closed-form solution of Kim & Wee,
 1101 -- \"Pricing of geometric Asian options under Heston's stochastic volatility model\", Quantitative
 1102 -- Finance 14:10 (2014). /summationCutoff/ and /xiRightLimit/ bound the truncated summation and
 1103 -- integration ranges used by the closed form; QuantLib's own defaults are 50 and 100.0.
 1104 analyticContinuousGeometricAveragePriceAsianHestonEngine :: (GenHestonProcess hp) -> (Word) -- ^summationCutoff
 1105  -> (Double) -- ^xiRightLimit
 1106  -> IO ((PricingEngine))
 1107 analyticContinuousGeometricAveragePriceAsianHestonEngine a1 a2 a3 =
 1108   withHestonProcess a1 $ \a1' -> 
 1109   let {a2' = fromIntegral a2} in 
 1110   let {a3' = realToFrac a3} in 
 1111   preErrorCheck $ \a4' -> 
 1112   analyticContinuousGeometricAveragePriceAsianHestonEngine'_ a1' a2' a3' a4' >>= \res ->
 1113   peekPricingEngine res >>= \res' ->
 1114   errorCheck  a4'>>
 1115   return (res')
 1116 
 1117 
 1118 
 1119 -- |Analytic pricing engine for European discrete geometric average-price Asian options under the
 1120 -- Heston stochastic-volatility model.  Implements the closed-form solution of Kim, Kim, Kim & Wee,
 1121 -- \"A Recursive Method for Discretely Monitored Geometric Asian Option Prices\", Bull. Korean
 1122 -- Math. Soc. 53 (2016). /xiRightLimit/ bounds the truncated integration range; QuantLib's own
 1123 -- default is 100.0.
 1124 analyticDiscreteGeometricAveragePriceAsianHestonEngine :: (GenHestonProcess hp) -> (Double) -- ^xiRightLimit
 1125  -> IO ((PricingEngine))
 1126 analyticDiscreteGeometricAveragePriceAsianHestonEngine a1 a2 =
 1127   withHestonProcess a1 $ \a1' -> 
 1128   let {a2' = realToFrac a2} in 
 1129   preErrorCheck $ \a3' -> 
 1130   analyticDiscreteGeometricAveragePriceAsianHestonEngine'_ a1' a2' a3' >>= \res ->
 1131   peekPricingEngine res >>= \res' ->
 1132   errorCheck  a3'>>
 1133   return (res')
 1134 
 1135 
 1136 
 1137 -- |Monte Carlo pricing engine for continuous fixed-strike lookback options. Exactly one of
 1138 -- @timeSteps@\/@timeStepsPerYear@ must be given; the other must be 'Nothing'.
 1139 mcLookbackFixedEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 1140  -> (Maybe Word) -- ^timeStepsPerYear
 1141  -> (Bool) -- ^brownianBridge
 1142  -> (Bool) -- ^antitheticVariate
 1143  -> (Maybe Word) -- ^requiredSamples
 1144  -> (Maybe Double) -- ^requiredTolerance
 1145  -> (Maybe Word) -- ^maxSamples
 1146  -> (Word) -- ^seed
 1147  -> IO ((PricingEngine))
 1148 mcLookbackFixedEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1149   let {a1' = (fromIntegral . fromEnum) a1} in 
 1150   let {a2' = (fromIntegral . fromEnum) a2} in 
 1151   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 1152   let {a4' = fromMaybeInt a4} in 
 1153   let {a5' = fromMaybeInt a5} in 
 1154   let {a6' = C2HSImp.fromBool a6} in 
 1155   let {a7' = C2HSImp.fromBool a7} in 
 1156   let {a8' = fromMaybeInt a8} in 
 1157   let {a9' = fromMaybeDouble a9} in 
 1158   let {a10' = fromMaybeInt a10} in 
 1159   let {a11' = fromIntegral a11} in 
 1160   preErrorCheck $ \a12' -> 
 1161   mcLookbackFixedEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1162   peekPricingEngine res >>= \res' ->
 1163   errorCheck  a12'>>
 1164   return (res')
 1165 
 1166 
 1167 
 1168 -- |Monte Carlo pricing engine for continuous floating-strike lookback options. Exactly one of
 1169 -- @timeSteps@\/@timeStepsPerYear@ must be given; the other must be 'Nothing'.
 1170 mcLookbackFloatingEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 1171  -> (Maybe Word) -- ^timeStepsPerYear
 1172  -> (Bool) -- ^brownianBridge
 1173  -> (Bool) -- ^antitheticVariate
 1174  -> (Maybe Word) -- ^requiredSamples
 1175  -> (Maybe Double) -- ^requiredTolerance
 1176  -> (Maybe Word) -- ^maxSamples
 1177  -> (Word) -- ^seed
 1178  -> IO ((PricingEngine))
 1179 mcLookbackFloatingEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1180   let {a1' = (fromIntegral . fromEnum) a1} in 
 1181   let {a2' = (fromIntegral . fromEnum) a2} in 
 1182   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 1183   let {a4' = fromMaybeInt a4} in 
 1184   let {a5' = fromMaybeInt a5} in 
 1185   let {a6' = C2HSImp.fromBool a6} in 
 1186   let {a7' = C2HSImp.fromBool a7} in 
 1187   let {a8' = fromMaybeInt a8} in 
 1188   let {a9' = fromMaybeDouble a9} in 
 1189   let {a10' = fromMaybeInt a10} in 
 1190   let {a11' = fromIntegral a11} in 
 1191   preErrorCheck $ \a12' -> 
 1192   mcLookbackFloatingEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1193   peekPricingEngine res >>= \res' ->
 1194   errorCheck  a12'>>
 1195   return (res')
 1196 
 1197 
 1198 
 1199 -- |Monte Carlo pricing engine for continuous partial-time fixed-strike lookback options. Exactly
 1200 -- one of @timeSteps@\/@timeStepsPerYear@ must be given; the other must be 'Nothing'.
 1201 mcLookbackPartialFixedEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 1202  -> (Maybe Word) -- ^timeStepsPerYear
 1203  -> (Bool) -- ^brownianBridge
 1204  -> (Bool) -- ^antitheticVariate
 1205  -> (Maybe Word) -- ^requiredSamples
 1206  -> (Maybe Double) -- ^requiredTolerance
 1207  -> (Maybe Word) -- ^maxSamples
 1208  -> (Word) -- ^seed
 1209  -> IO ((PricingEngine))
 1210 mcLookbackPartialFixedEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1211   let {a1' = (fromIntegral . fromEnum) a1} in 
 1212   let {a2' = (fromIntegral . fromEnum) a2} in 
 1213   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 1214   let {a4' = fromMaybeInt a4} in 
 1215   let {a5' = fromMaybeInt a5} in 
 1216   let {a6' = C2HSImp.fromBool a6} in 
 1217   let {a7' = C2HSImp.fromBool a7} in 
 1218   let {a8' = fromMaybeInt a8} in 
 1219   let {a9' = fromMaybeDouble a9} in 
 1220   let {a10' = fromMaybeInt a10} in 
 1221   let {a11' = fromIntegral a11} in 
 1222   preErrorCheck $ \a12' -> 
 1223   mcLookbackPartialFixedEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1224   peekPricingEngine res >>= \res' ->
 1225   errorCheck  a12'>>
 1226   return (res')
 1227 
 1228 
 1229 
 1230 -- |Monte Carlo pricing engine for continuous partial-time floating-strike lookback options.
 1231 -- Exactly one of @timeSteps@\/@timeStepsPerYear@ must be given; the other must be 'Nothing'.
 1232 mcLookbackPartialFloatingEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 1233  -> (Maybe Word) -- ^timeStepsPerYear
 1234  -> (Bool) -- ^brownianBridge
 1235  -> (Bool) -- ^antitheticVariate
 1236  -> (Maybe Word) -- ^requiredSamples
 1237  -> (Maybe Double) -- ^requiredTolerance
 1238  -> (Maybe Word) -- ^maxSamples
 1239  -> (Word) -- ^seed
 1240  -> IO ((PricingEngine))
 1241 mcLookbackPartialFloatingEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1242   let {a1' = (fromIntegral . fromEnum) a1} in 
 1243   let {a2' = (fromIntegral . fromEnum) a2} in 
 1244   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 1245   let {a4' = fromMaybeInt a4} in 
 1246   let {a5' = fromMaybeInt a5} in 
 1247   let {a6' = C2HSImp.fromBool a6} in 
 1248   let {a7' = C2HSImp.fromBool a7} in 
 1249   let {a8' = fromMaybeInt a8} in 
 1250   let {a9' = fromMaybeDouble a9} in 
 1251   let {a10' = fromMaybeInt a10} in 
 1252   let {a11' = fromIntegral a11} in 
 1253   preErrorCheck $ \a12' -> 
 1254   mcLookbackPartialFloatingEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1255   peekPricingEngine res >>= \res' ->
 1256   errorCheck  a12'>>
 1257   return (res')
 1258 
 1259 
 1260 
 1261 -- |analytic pricing engine for American digital (cash-or-nothing/asset-or-nothing) options
 1262 analyticDigitalAmericanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1263 analyticDigitalAmericanEngine a1 =
 1264   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1265   preErrorCheck $ \a2' -> 
 1266   analyticDigitalAmericanEngine'_ a1' a2' >>= \res ->
 1267   peekPricingEngine res >>= \res' ->
 1268   errorCheck  a2'>>
 1269   return (res')
 1270 
 1271 
 1272 
 1273 -- |analytic pricing engine for American knock-out digital (cash-or-nothing/asset-or-nothing) options
 1274 analyticDigitalAmericanKoEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1275 analyticDigitalAmericanKoEngine a1 =
 1276   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1277   preErrorCheck $ \a2' -> 
 1278   analyticDigitalAmericanKoEngine'_ a1' a2' >>= \res ->
 1279   peekPricingEngine res >>= \res' ->
 1280   errorCheck  a2'>>
 1281   return (res')
 1282 
 1283 
 1284 
 1285 -- |analytic pricing engine for European discrete geometric average-price Asian options
 1286 analyticDiscreteGeometricAveragePriceAsianEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1287 analyticDiscreteGeometricAveragePriceAsianEngine a1 =
 1288   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1289   preErrorCheck $ \a2' -> 
 1290   analyticDiscreteGeometricAveragePriceAsianEngine'_ a1' a2' >>= \res ->
 1291   peekPricingEngine res >>= \res' ->
 1292   errorCheck  a2'>>
 1293   return (res')
 1294 
 1295 
 1296 
 1297 -- |analytic pricing engine for European discrete geometric average-strike Asian options
 1298 analyticDiscreteGeometricAverageStrikeAsianEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1299 analyticDiscreteGeometricAverageStrikeAsianEngine a1 =
 1300   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1301   preErrorCheck $ \a2' -> 
 1302   analyticDiscreteGeometricAverageStrikeAsianEngine'_ a1' a2' >>= \res ->
 1303   peekPricingEngine res >>= \res' ->
 1304   errorCheck  a2'>>
 1305   return (res')
 1306 
 1307 
 1308 
 1309 -- |Turnbull-Wakeman moment-matching pricing engine for discrete arithmetic average-price\/-strike Asian options
 1310 turnbullWakemanAsianEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1311 turnbullWakemanAsianEngine a1 =
 1312   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1313   preErrorCheck $ \a2' -> 
 1314   turnbullWakemanAsianEngine'_ a1' a2' >>= \res ->
 1315   peekPricingEngine res >>= \res' ->
 1316   errorCheck  a2'>>
 1317   return (res')
 1318 
 1319 
 1320 
 1321 -- |analytic pricing engine for European options with discrete dividends
 1322 analyticDividendEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -> IO ((PricingEngine))
 1323 analyticDividendEuropeanEngine a1 a2 =
 1324   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1325   withDividendArray a2 $ \(a2'1, a2'2) -> 
 1326   preErrorCheck $ \a3' -> 
 1327   analyticDividendEuropeanEngine'_ a1' a2'1  a2'2 a3' >>= \res ->
 1328   peekPricingEngine res >>= \res' ->
 1329   errorCheck  a3'>>
 1330   return (res')
 1331 
 1332 
 1333 
 1334 -- |analytic Black-Scholes pricing engine for European options
 1335 analyticEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Maybe (GenYieldTermStructure y)) -- ^discountCurve
 1336  -> IO ((PricingEngine))
 1337 analyticEuropeanEngine a1 a2 =
 1338   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1339   withMaybeYieldTermStructure a2 $ \a2' -> 
 1340   preErrorCheck $ \a3' -> 
 1341   analyticEuropeanEngine'_ a1' a2' a3' >>= \res ->
 1342   peekPricingEngine res >>= \res' ->
 1343   errorCheck  a3'>>
 1344   return (res')
 1345 
 1346 
 1347 
 1348 -- |analytic pricing engine for performance (return) options
 1349 analyticPerformanceEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1350 analyticPerformanceEngine a1 =
 1351   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1352   preErrorCheck $ \a2' -> 
 1353   analyticPerformanceEngine'_ a1' a2' >>= \res ->
 1354   peekPricingEngine res >>= \res' ->
 1355   errorCheck  a2'>>
 1356   return (res')
 1357 
 1358 
 1359 
 1360 -- |analytic pricing engine for forward-starting European options; binds the @AnalyticEuropeanEngine@ instantiation of upstream's @ForwardVanillaEngine\<Engine\>@ template
 1361 forwardEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1362 forwardEuropeanEngine a1 =
 1363   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1364   preErrorCheck $ \a2' -> 
 1365   forwardEuropeanEngine'_ a1' a2' >>= \res ->
 1366   peekPricingEngine res >>= \res' ->
 1367   errorCheck  a2'>>
 1368   return (res')
 1369 
 1370 
 1371 
 1372 -- |Barone-Adesi\/Whaley approximation pricing engine for forward-starting American options; binds the @BaroneAdesiWhaleyApproximationEngine@ instantiation of @ForwardVanillaEngine\<Engine\>@
 1373 forwardBaroneAdesiWhaleyEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1374 forwardBaroneAdesiWhaleyEngine a1 =
 1375   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1376   preErrorCheck $ \a2' -> 
 1377   forwardBaroneAdesiWhaleyEngine'_ a1' a2' >>= \res ->
 1378   peekPricingEngine res >>= \res' ->
 1379   errorCheck  a2'>>
 1380   return (res')
 1381 
 1382 
 1383 
 1384 -- |Bjerksund\/Stensland approximation pricing engine for forward-starting American options; binds the @BjerksundStenslandApproximationEngine@ instantiation of @ForwardVanillaEngine\<Engine\>@
 1385 forwardBjerksundStenslandEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1386 forwardBjerksundStenslandEngine a1 =
 1387   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1388   preErrorCheck $ \a2' -> 
 1389   forwardBjerksundStenslandEngine'_ a1' a2' >>= \res ->
 1390   peekPricingEngine res >>= \res' ->
 1391   errorCheck  a2'>>
 1392   return (res')
 1393 
 1394 
 1395 
 1396 -- |finite-differences Black-Scholes pricing engine for forward-starting vanilla options, with the wrapped engine's grid\/scheme params fixed at their QuantLib defaults; binds the @FdBlackScholesVanillaEngine@ instantiation of @ForwardVanillaEngine\<Engine\>@
 1397 forwardFdBlackScholesVanillaEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 1398 forwardFdBlackScholesVanillaEngine a1 =
 1399   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1400   preErrorCheck $ \a2' -> 
 1401   forwardFdBlackScholesVanillaEngine'_ a1' a2' >>= \res ->
 1402   peekPricingEngine res >>= \res' ->
 1403   errorCheck  a2'>>
 1404   return (res')
 1405 
 1406 
 1407 
 1408 -- |Monte Carlo pricing engine for forward-starting European options under a Black-Scholes process
 1409 mcForwardEuropeanBsEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 1410  -> (Maybe Word) -- ^timeStepsPerYear
 1411  -> (Bool) -- ^brownianBridge
 1412  -> (Bool) -- ^antitheticVariate
 1413  -> (Maybe Word) -- ^requiredSamples
 1414  -> (Maybe Double) -- ^requiredTolerance
 1415  -> (Maybe Word) -- ^maxSamples
 1416  -> (Word) -- ^seed
 1417  -> IO ((PricingEngine))
 1418 mcForwardEuropeanBsEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1419   let {a1' = (fromIntegral . fromEnum) a1} in 
 1420   let {a2' = (fromIntegral . fromEnum) a2} in 
 1421   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 1422   let {a4' = fromMaybeInt a4} in 
 1423   let {a5' = fromMaybeInt a5} in 
 1424   let {a6' = C2HSImp.fromBool a6} in 
 1425   let {a7' = C2HSImp.fromBool a7} in 
 1426   let {a8' = fromMaybeInt a8} in 
 1427   let {a9' = fromMaybeDouble a9} in 
 1428   let {a10' = fromMaybeInt a10} in 
 1429   let {a11' = fromIntegral a11} in 
 1430   preErrorCheck $ \a12' -> 
 1431   mcForwardEuropeanBsEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1432   peekPricingEngine res >>= \res' ->
 1433   errorCheck  a12'>>
 1434   return (res')
 1435 
 1436 
 1437 
 1438 -- |Monte Carlo engine for European 'forwardVanillaOption's under a Heston process. Supply either @requiredSamples@ or @requiredTolerance@, and use a fixed nonzero @seed@ for reproducible results.
 1439 mcForwardEuropeanHestonEngine :: (RngTrait) -- ^rng
 1440  -> (StatisticsTrait) -- ^statistics
 1441  -> (GenHestonProcess hp) -- ^process
 1442  -> (Maybe Word) -- ^timeSteps
 1443  -> (Maybe Word) -- ^timeStepsPerYear
 1444  -> (Bool) -- ^antitheticVariate
 1445  -> (Maybe Word) -- ^requiredSamples
 1446  -> (Maybe Double) -- ^requiredTolerance
 1447  -> (Maybe Word) -- ^maxSamples
 1448  -> (Word) -- ^seed
 1449  -> (Bool) -- ^controlVariate
 1450  -> IO ((PricingEngine))
 1451 mcForwardEuropeanHestonEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1452   let {a1' = (fromIntegral . fromEnum) a1} in 
 1453   let {a2' = (fromIntegral . fromEnum) a2} in 
 1454   withHestonProcess a3 $ \a3' -> 
 1455   let {a4' = fromMaybeInt a4} in 
 1456   let {a5' = fromMaybeInt a5} in 
 1457   let {a6' = C2HSImp.fromBool a6} in 
 1458   let {a7' = fromMaybeInt a7} in 
 1459   let {a8' = fromMaybeDouble a8} in 
 1460   let {a9' = fromMaybeInt a9} in 
 1461   let {a10' = fromIntegral a10} in 
 1462   let {a11' = C2HSImp.fromBool a11} in 
 1463   preErrorCheck $ \a12' -> 
 1464   mcForwardEuropeanHestonEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1465   peekPricingEngine res >>= \res' ->
 1466   errorCheck  a12'>>
 1467   return (res')
 1468 
 1469 
 1470 
 1471 -- |analytic pricing engine for forward-starting European options under a Heston process
 1472 analyticHestonForwardEuropeanEngine :: (GenHestonProcess hp) -> (Word) -- ^integrationOrder
 1473  -> IO ((PricingEngine))
 1474 analyticHestonForwardEuropeanEngine a1 a2 =
 1475   withHestonProcess a1 $ \a1' -> 
 1476   let {a2' = fromIntegral a2} in 
 1477   preErrorCheck $ \a3' -> 
 1478   analyticHestonForwardEuropeanEngine'_ a1' a2' a3' >>= \res ->
 1479   peekPricingEngine res >>= \res' ->
 1480   errorCheck  a3'>>
 1481   return (res')
 1482 
 1483 
 1484 
 1485 -- |quanto-adjusts a European vanilla option's price and greeks for a payoff paid in a currency other than the underlying's; binds the @VanillaOption@\/@AnalyticEuropeanEngine@ instantiation of upstream's @QuantoEngine\<Instr,Engine\>@ template
 1486 quantoEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (GenYieldTermStructure y) -- ^foreignRiskFreeRate
 1487  -> (GenBlackVolTermStructure bv) -- ^exchangeRateVolatility
 1488  -> (GenQuote q) -- ^correlation
 1489  -> IO ((PricingEngine))
 1490 quantoEuropeanEngine a1 a2 a3 a4 =
 1491   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1492   withYieldTermStructure a2 $ \a2' -> 
 1493   withBlackVolTermStructure a3 $ \a3' -> 
 1494   withQuote a4 $ \a4' -> 
 1495   preErrorCheck $ \a5' -> 
 1496   quantoEuropeanEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1497   peekPricingEngine res >>= \res' ->
 1498   errorCheck  a5'>>
 1499   return (res')
 1500 
 1501 
 1502 
 1503 -- |quanto-adjusts a forward-starting vanilla option; binds the @ForwardVanillaOption@\/@ForwardVanillaEngine\<AnalyticEuropeanEngine\>@ instantiation of @QuantoEngine\<Instr,Engine\>@
 1504 quantoForwardEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (GenYieldTermStructure y) -- ^foreignRiskFreeRate
 1505  -> (GenBlackVolTermStructure bv) -- ^exchangeRateVolatility
 1506  -> (GenQuote q) -- ^correlation
 1507  -> IO ((PricingEngine))
 1508 quantoForwardEuropeanEngine a1 a2 a3 a4 =
 1509   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1510   withYieldTermStructure a2 $ \a2' -> 
 1511   withBlackVolTermStructure a3 $ \a3' -> 
 1512   withQuote a4 $ \a4' -> 
 1513   preErrorCheck $ \a5' -> 
 1514   quantoForwardEuropeanEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1515   peekPricingEngine res >>= \res' ->
 1516   errorCheck  a5'>>
 1517   return (res')
 1518 
 1519 
 1520 
 1521 -- |quanto-adjusts a forward-starting performance (strike-resetting, percentage-payoff) vanilla option; binds the @ForwardVanillaOption@\/@ForwardPerformanceVanillaEngine\<AnalyticEuropeanEngine\>@ instantiation of @QuantoEngine\<Instr,Engine\>@
 1522 quantoForwardPerformanceEuropeanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (GenYieldTermStructure y) -- ^foreignRiskFreeRate
 1523  -> (GenBlackVolTermStructure bv) -- ^exchangeRateVolatility
 1524  -> (GenQuote q) -- ^correlation
 1525  -> IO ((PricingEngine))
 1526 quantoForwardPerformanceEuropeanEngine a1 a2 a3 a4 =
 1527   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1528   withYieldTermStructure a2 $ \a2' -> 
 1529   withBlackVolTermStructure a3 $ \a3' -> 
 1530   withQuote a4 $ \a4' -> 
 1531   preErrorCheck $ \a5' -> 
 1532   quantoForwardPerformanceEuropeanEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1533   peekPricingEngine res >>= \res' ->
 1534   errorCheck  a5'>>
 1535   return (res')
 1536 
 1537 
 1538 
 1539 -- |quanto-adjusts a single-barrier option; binds the @BarrierOption@\/@AnalyticBarrierEngine@ instantiation of @QuantoEngine\<Instr,Engine\>@
 1540 quantoBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (GenYieldTermStructure y) -- ^foreignRiskFreeRate
 1541  -> (GenBlackVolTermStructure bv) -- ^exchangeRateVolatility
 1542  -> (GenQuote q) -- ^correlation
 1543  -> IO ((PricingEngine))
 1544 quantoBarrierEngine a1 a2 a3 a4 =
 1545   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1546   withYieldTermStructure a2 $ \a2' -> 
 1547   withBlackVolTermStructure a3 $ \a3' -> 
 1548   withQuote a4 $ \a4' -> 
 1549   preErrorCheck $ \a5' -> 
 1550   quantoBarrierEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1551   peekPricingEngine res >>= \res' ->
 1552   errorCheck  a5'>>
 1553   return (res')
 1554 
 1555 
 1556 
 1557 -- |quanto-adjusts a double-barrier option; binds the @DoubleBarrierOption@\/@AnalyticDoubleBarrierEngine@ instantiation of @QuantoEngine\<Instr,Engine\>@
 1558 quantoDoubleBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (GenYieldTermStructure y) -- ^foreignRiskFreeRate
 1559  -> (GenBlackVolTermStructure bv) -- ^exchangeRateVolatility
 1560  -> (GenQuote q) -- ^correlation
 1561  -> IO ((PricingEngine))
 1562 quantoDoubleBarrierEngine a1 a2 a3 a4 =
 1563   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1564   withYieldTermStructure a2 $ \a2' -> 
 1565   withBlackVolTermStructure a3 $ \a3' -> 
 1566   withQuote a4 $ \a4' -> 
 1567   preErrorCheck $ \a5' -> 
 1568   quantoDoubleBarrierEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1569   peekPricingEngine res >>= \res' ->
 1570   errorCheck  a5'>>
 1571   return (res')
 1572 
 1573 
 1574 
 1575 -- |Black-formula cap\/floor engine, taking an optionlet volatility structure
 1576 blackCapFloorEngineFromVolatilityStructure :: (GenYieldTermStructure y) -> (GenOptionletVolatilityStructure ov) -> IO ((PricingEngine))
 1577 blackCapFloorEngineFromVolatilityStructure a1 a2 =
 1578   withYieldTermStructure a1 $ \a1' -> 
 1579   withOptionletVolatilityStructure a2 $ \a2' -> 
 1580   preErrorCheck $ \a3' -> 
 1581   blackCapFloorEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 1582   peekPricingEngine res >>= \res' ->
 1583   errorCheck  a3'>>
 1584   return (res')
 1585 
 1586 
 1587 
 1588 -- |Black-formula cap\/floor engine, taking a flat volatility quote
 1589 blackCapFloorEngine :: (GenYieldTermStructure y) -> (GenQuote q) -> (DayCounter) -> (Double) -- ^displacement
 1590  -> IO ((PricingEngine))
 1591 blackCapFloorEngine a1 a2 a3 a4 =
 1592   withYieldTermStructure a1 $ \a1' -> 
 1593   withQuote a2 $ \a2' -> 
 1594   withDayCounter a3 $ \a3' -> 
 1595   let {a4' = realToFrac a4} in 
 1596   preErrorCheck $ \a5' -> 
 1597   blackCapFloorEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1598   peekPricingEngine res >>= \res' ->
 1599   errorCheck  a5'>>
 1600   return (res')
 1601 
 1602 
 1603 
 1604 -- |shifted-lognormal Black-formula swaption engine, taking a flat volatility quote
 1605 blackSwaptionEngine :: (GenYieldTermStructure y) -> (GenQuote q) -> (DayCounter) -> (Double) -- ^displacement
 1606  -> (CashAnnuityModel) -- ^model
 1607  -> IO ((PricingEngine))
 1608 blackSwaptionEngine a1 a2 a3 a4 a5 =
 1609   withYieldTermStructure a1 $ \a1' -> 
 1610   withQuote a2 $ \a2' -> 
 1611   withDayCounter a3 $ \a3' -> 
 1612   let {a4' = realToFrac a4} in 
 1613   let {a5' = (fromIntegral . fromEnum) a5} in 
 1614   preErrorCheck $ \a6' -> 
 1615   blackSwaptionEngine'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 1616   peekPricingEngine res >>= \res' ->
 1617   errorCheck  a6'>>
 1618   return (res')
 1619 
 1620 
 1621 haganIrregularSwaptionEngine :: (GenSwaptionVolatilityStructure sv) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 1622 haganIrregularSwaptionEngine a1 a2 =
 1623   withSwaptionVolatilityStructure a1 $ \a1' -> 
 1624   withMaybeYieldTermStructure a2 $ \a2' -> 
 1625   preErrorCheck $ \a3' -> 
 1626   haganIrregularSwaptionEngine'_ a1' a2' a3' >>= \res ->
 1627   peekPricingEngine res >>= \res' ->
 1628   errorCheck  a3'>>
 1629   return (res')
 1630 
 1631 
 1632 
 1633 -- |shifted-lognormal Black-formula swaption engine, taking a swaption volatility structure
 1634 blackSwaptionEngineFromVolatilityStructure :: (GenYieldTermStructure y) -> (GenSwaptionVolatilityStructure sv) -> IO ((PricingEngine))
 1635 blackSwaptionEngineFromVolatilityStructure a1 a2 =
 1636   withYieldTermStructure a1 $ \a1' -> 
 1637   withSwaptionVolatilityStructure a2 $ \a2' -> 
 1638   preErrorCheck $ \a3' -> 
 1639   blackSwaptionEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 1640   peekPricingEngine res >>= \res' ->
 1641   errorCheck  a3'>>
 1642   return (res')
 1643 
 1644 
 1645 
 1646 -- |Bachelier (normal) cap\/floor engine, taking an optionlet volatility structure
 1647 bachelierCapFloorEngineFromVolatilityStructure :: (GenYieldTermStructure y) -> (GenOptionletVolatilityStructure ov) -> IO ((PricingEngine))
 1648 bachelierCapFloorEngineFromVolatilityStructure a1 a2 =
 1649   withYieldTermStructure a1 $ \a1' -> 
 1650   withOptionletVolatilityStructure a2 $ \a2' -> 
 1651   preErrorCheck $ \a3' -> 
 1652   bachelierCapFloorEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 1653   peekPricingEngine res >>= \res' ->
 1654   errorCheck  a3'>>
 1655   return (res')
 1656 
 1657 
 1658 
 1659 -- |Bachelier (normal) cap\/floor engine, taking a flat volatility quote
 1660 bachelierCapFloorEngine :: (GenYieldTermStructure y) -> (GenQuote q) -> (DayCounter) -> IO ((PricingEngine))
 1661 bachelierCapFloorEngine a1 a2 a3 =
 1662   withYieldTermStructure a1 $ \a1' -> 
 1663   withQuote a2 $ \a2' -> 
 1664   withDayCounter a3 $ \a3' -> 
 1665   preErrorCheck $ \a4' -> 
 1666   bachelierCapFloorEngine'_ a1' a2' a3' a4' >>= \res ->
 1667   peekPricingEngine res >>= \res' ->
 1668   errorCheck  a4'>>
 1669   return (res')
 1670 
 1671 
 1672 
 1673 -- |Black-formula YoY inflation cap\/floor engine. The nominal discount curve and the index's
 1674 -- own linked 'QuantLib.TermStructure.Inflation.YoYInflationTermStructure' are separate --
 1675 -- @nominalTermStructure@ discounts cashflows, while the index forecasts them.
 1676 yoyInflationBlackCapFloorEngine :: (GenYoYInflationIndex yidx) -> (YoYOptionletVolatilitySurface) -- ^vol
 1677  -> (GenYieldTermStructure y) -- ^nominalTermStructure
 1678  -> IO ((PricingEngine))
 1679 yoyInflationBlackCapFloorEngine a1 a2 a3 =
 1680   withYoYInflationIndex a1 $ \a1' -> 
 1681   withGenVolatilityTermStructure a2 $ \a2' -> 
 1682   withYieldTermStructure a3 $ \a3' -> 
 1683   preErrorCheck $ \a4' -> 
 1684   yoyInflationBlackCapFloorEngine'_ a1' a2' a3' a4' >>= \res ->
 1685   peekPricingEngine res >>= \res' ->
 1686   errorCheck  a4'>>
 1687   return (res')
 1688 
 1689 
 1690 
 1691 -- |as 'yoyInflationBlackCapFloorEngine', but unit-displaced Black
 1692 yoyInflationUnitDisplacedBlackCapFloorEngine :: (GenYoYInflationIndex yidx) -> (YoYOptionletVolatilitySurface) -- ^vol
 1693  -> (GenYieldTermStructure y) -- ^nominalTermStructure
 1694  -> IO ((PricingEngine))
 1695 yoyInflationUnitDisplacedBlackCapFloorEngine a1 a2 a3 =
 1696   withYoYInflationIndex a1 $ \a1' -> 
 1697   withGenVolatilityTermStructure a2 $ \a2' -> 
 1698   withYieldTermStructure a3 $ \a3' -> 
 1699   preErrorCheck $ \a4' -> 
 1700   yoyInflationUnitDisplacedBlackCapFloorEngine'_ a1' a2' a3' a4' >>= \res ->
 1701   peekPricingEngine res >>= \res' ->
 1702   errorCheck  a4'>>
 1703   return (res')
 1704 
 1705 
 1706 
 1707 -- |as 'yoyInflationBlackCapFloorEngine', but Bachelier (normal model)
 1708 yoyInflationBachelierCapFloorEngine :: (GenYoYInflationIndex yidx) -> (YoYOptionletVolatilitySurface) -- ^vol
 1709  -> (GenYieldTermStructure y) -- ^nominalTermStructure
 1710  -> IO ((PricingEngine))
 1711 yoyInflationBachelierCapFloorEngine a1 a2 a3 =
 1712   withYoYInflationIndex a1 $ \a1' -> 
 1713   withGenVolatilityTermStructure a2 $ \a2' -> 
 1714   withYieldTermStructure a3 $ \a3' -> 
 1715   preErrorCheck $ \a4' -> 
 1716   yoyInflationBachelierCapFloorEngine'_ a1' a2' a3' a4' >>= \res ->
 1717   peekPricingEngine res >>= \res' ->
 1718   errorCheck  a4'>>
 1719   return (res')
 1720 
 1721 
 1722 
 1723 -- |The only 'QuantLib.Instrument.InflationCapFloor.CPICapFloor' pricing engine in QL 1.43 --
 1724 -- prices purely by interpolating a market price surface, no stochastic-vol model (see that
 1725 -- type's own haddock for the CPI\/YoY asymmetry).
 1726 interpolatingCpiCapFloorEngine :: (CPICapFloorTermPriceSurface) -> IO ((PricingEngine))
 1727 interpolatingCpiCapFloorEngine a1 =
 1728   withGenTermStructure a1 $ \a1' -> 
 1729   preErrorCheck $ \a2' -> 
 1730   interpolatingCpiCapFloorEngine'_ a1' a2' >>= \res ->
 1731   peekPricingEngine res >>= \res' ->
 1732   errorCheck  a2'>>
 1733   return (res')
 1734 
 1735 
 1736 
 1737 -- |Bachelier (normal) swaption engine, taking a flat volatility quote
 1738 bachelierSwaptionEngine :: (GenYieldTermStructure y) -> (GenQuote q) -> (DayCounter) -> (CashAnnuityModel) -- ^model
 1739  -> IO ((PricingEngine))
 1740 bachelierSwaptionEngine a1 a2 a3 a4 =
 1741   withYieldTermStructure a1 $ \a1' -> 
 1742   withQuote a2 $ \a2' -> 
 1743   withDayCounter a3 $ \a3' -> 
 1744   let {a4' = (fromIntegral . fromEnum) a4} in 
 1745   preErrorCheck $ \a5' -> 
 1746   bachelierSwaptionEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 1747   peekPricingEngine res >>= \res' ->
 1748   errorCheck  a5'>>
 1749   return (res')
 1750 
 1751 
 1752 
 1753 -- |Bachelier (normal) swaption engine, taking a swaption volatility structure
 1754 bachelierSwaptionEngineFromVolatilityStructure :: (GenYieldTermStructure y) -> (GenSwaptionVolatilityStructure sv) -> IO ((PricingEngine))
 1755 bachelierSwaptionEngineFromVolatilityStructure a1 a2 =
 1756   withYieldTermStructure a1 $ \a1' -> 
 1757   withSwaptionVolatilityStructure a2 $ \a2' -> 
 1758   preErrorCheck $ \a3' -> 
 1759   bachelierSwaptionEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 1760   peekPricingEngine res >>= \res' ->
 1761   errorCheck  a3'>>
 1762   return (res')
 1763 
 1764 
 1765 
 1766 -- |analytic European option pricer including stochastic interest rates (Black-Scholes-Merton + Hull-White)
 1767 analyticBsmHullWhiteEngine :: (Double) -> (GenGeneralizedBlackScholesProcess gbs) -> (HullWhite) -> IO ((PricingEngine))
 1768 analyticBsmHullWhiteEngine a1 a2 a3 =
 1769   let {a1' = realToFrac a1} in 
 1770   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 1771   withHullWhite a3 $ \a3' -> 
 1772   preErrorCheck $ \a4' -> 
 1773   analyticBsmHullWhiteEngine'_ a1' a2' a3' a4' >>= \res ->
 1774   peekPricingEngine res >>= \res' ->
 1775   errorCheck  a4'>>
 1776   return (res')
 1777 
 1778 
 1779 
 1780 -- |the term structure is only needed when the short-rate model cannot provide one itself.
 1781 analyticCapFloorEngine :: (AffineModel) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 1782 analyticCapFloorEngine a1 a2 =
 1783   withStandalone a1 $ \a1' -> 
 1784   withMaybeYieldTermStructure a2 $ \a2' -> 
 1785   preErrorCheck $ \a3' -> 
 1786   analyticCapFloorEngine'_ a1' a2' a3' >>= \res ->
 1787   peekPricingEngine res >>= \res' ->
 1788   errorCheck  a3'>>
 1789   return (res')
 1790 
 1791 
 1792 
 1793 -- |cap\/floor pricing engine for any one-factor Gaussian short-rate model, evaluated by
 1794 -- integration over the model's state variable. As 'gaussian1dSwaptionEngine', without
 1795 -- 'Probabilities'.
 1796 gaussian1dCapFloorEngine :: (Gaussian1dModel) -> (Int) -- ^integrationPoints
 1797  -> (Double) -- ^stddevs
 1798  -> (Bool) -- ^extrapolatePayoff
 1799  -> (Bool) -- ^flatPayoffExtrapolation
 1800  -> (Maybe (GenYieldTermStructure y)) -- ^discountCurve
 1801  -> IO ((PricingEngine))
 1802 gaussian1dCapFloorEngine a1 a2 a3 a4 a5 a6 =
 1803   withStandalone a1 $ \a1' -> 
 1804   let {a2' = fromIntegral a2} in 
 1805   let {a3' = realToFrac a3} in 
 1806   let {a4' = C2HSImp.fromBool a4} in 
 1807   let {a5' = C2HSImp.fromBool a5} in 
 1808   withMaybeYieldTermStructure a6 $ \a6' -> 
 1809   preErrorCheck $ \a7' -> 
 1810   gaussian1dCapFloorEngine'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1811   peekPricingEngine res >>= \res' ->
 1812   errorCheck  a7'>>
 1813   return (res')
 1814 
 1815 
 1816 
 1817 -- |analytic pricing engine for vanilla options under a GJR-GARCH process
 1818 analyticGjrGarchEngine :: (GJRGARCHModel) -> IO ((PricingEngine))
 1819 analyticGjrGarchEngine a1 =
 1820   withGenCalibratedModel a1 $ \a1' -> 
 1821   preErrorCheck $ \a2' -> 
 1822   analyticGjrGarchEngine'_ a1' a2' >>= \res ->
 1823   peekPricingEngine res >>= \res' ->
 1824   errorCheck  a2'>>
 1825   return (res')
 1826 
 1827 
 1828 
 1829 -- |semi-analytic Heston-model pricing engine, integrating with a fixed relative tolerance and evaluation cap
 1830 analyticHestonEngineTolerance :: (GenHestonModel hm) -> (Double) -- ^relTolerance
 1831  -> (Word) -- ^maxEvaluations
 1832  -> IO ((PricingEngine))
 1833 analyticHestonEngineTolerance a1 a2 a3 =
 1834   withHestonModel a1 $ \a1' -> 
 1835   let {a2' = realToFrac a2} in 
 1836   let {a3' = fromIntegral a3} in 
 1837   preErrorCheck $ \a4' -> 
 1838   analyticHestonEngineTolerance'_ a1' a2' a3' a4' >>= \res ->
 1839   peekPricingEngine res >>= \res' ->
 1840   errorCheck  a4'>>
 1841   return (res')
 1842 
 1843 
 1844 
 1845 -- |Heston/Hull-White approximation engine for European vanilla options. The H1-HW approximation assumes zero variance/short-rate correlation; @rhoSr@ is the equity/short-rate correlation.
 1846 analyticH1HwEngineOrder :: (GenHestonModel hm) -> (HullWhite) -> (Double) -- ^rhoSr
 1847  -> (Word) -- ^integrationOrder
 1848  -> (Bool) -- ^exactMean
 1849  -> (Word) -- ^meanOrder
 1850  -> IO ((PricingEngine))
 1851 analyticH1HwEngineOrder a1 a2 a3 a4 a5 a6 =
 1852   withHestonModel a1 $ \a1' -> 
 1853   withHullWhite a2 $ \a2' -> 
 1854   let {a3' = realToFrac a3} in 
 1855   let {a4' = fromIntegral a4} in 
 1856   let {a5' = C2HSImp.fromBool a5} in 
 1857   let {a6' = fromIntegral a6} in 
 1858   preErrorCheck $ \a7' -> 
 1859   analyticH1HwEngineOrder'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1860   peekPricingEngine res >>= \res' ->
 1861   errorCheck  a7'>>
 1862   return (res')
 1863 
 1864 
 1865 
 1866 -- |semi-analytic pricing engine combining a Heston equity model with a Hull-White short-rate model
 1867 analyticHestonHullWhiteEngineOrder :: (GenHestonModel hm) -> (HullWhite) -> (Word) -- ^integrationOrder
 1868  -> IO ((PricingEngine))
 1869 analyticHestonHullWhiteEngineOrder a1 a2 a3 =
 1870   withHestonModel a1 $ \a1' -> 
 1871   withHullWhite a2 $ \a2' -> 
 1872   let {a3' = fromIntegral a3} in 
 1873   preErrorCheck $ \a4' -> 
 1874   analyticHestonHullWhiteEngineOrder'_ a1' a2' a3' a4' >>= \res ->
 1875   peekPricingEngine res >>= \res' ->
 1876   errorCheck  a4'>>
 1877   return (res')
 1878 
 1879 
 1880 
 1881 -- |semi-analytic pricing engine for the Bates (Heston plus jumps) model, integrating with a fixed order
 1882 batesEngineOrder :: (GenBatesModel bm) -> (Word) -- ^integrationOrder
 1883  -> IO ((PricingEngine))
 1884 batesEngineOrder a1 a2 =
 1885   withBatesModel a1 $ \a1' -> 
 1886   let {a2' = fromIntegral a2} in 
 1887   preErrorCheck $ \a3' -> 
 1888   batesEngineOrder'_ a1' a2' a3' >>= \res ->
 1889   peekPricingEngine res >>= \res' ->
 1890   errorCheck  a3'>>
 1891   return (res')
 1892 
 1893 
 1894 
 1895 -- |FFT-based pricing engine for vanilla options under a Black-Scholes process
 1896 fftVanillaEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^logStrikeSpacing
 1897  -> IO ((PricingEngine))
 1898 fftVanillaEngine a1 a2 =
 1899   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 1900   let {a2' = realToFrac a2} in 
 1901   preErrorCheck $ \a3' -> 
 1902   fftVanillaEngine'_ a1' a2' a3' >>= \res ->
 1903   peekPricingEngine res >>= \res' ->
 1904   errorCheck  a3'>>
 1905   return (res')
 1906 
 1907 
 1908 
 1909 -- |swaption pricing engine for the G2 two-factor short-rate model, priced via the Black formula
 1910 g2SwaptionEngine :: (G2) -> (Double) -- ^range
 1911  -> (Word) -- ^intervals
 1912  -> IO ((PricingEngine))
 1913 g2SwaptionEngine a1 a2 a3 =
 1914   withG2 a1 $ \a1' -> 
 1915   let {a2' = realToFrac a2} in 
 1916   let {a3' = fromIntegral a3} in 
 1917   preErrorCheck $ \a4' -> 
 1918   g2SwaptionEngine'_ a1' a2' a3' a4' >>= \res ->
 1919   peekPricingEngine res >>= \res' ->
 1920   errorCheck  a4'>>
 1921   return (res')
 1922 
 1923 
 1924 
 1925 -- |jump-diffusion pricing engine for vanilla options, taking a Merton76 process
 1926 jumpDiffusionEngine :: (Merton76Process) -> (Double) -- ^relativeAccuracy
 1927  -> (Word) -- ^maxIterations
 1928  -> IO ((PricingEngine))
 1929 jumpDiffusionEngine a1 a2 a3 =
 1930   withGenStochasticProcess1D a1 $ \a1' -> 
 1931   let {a2' = realToFrac a2} in 
 1932   let {a3' = fromIntegral a3} in 
 1933   preErrorCheck $ \a4' -> 
 1934   jumpDiffusionEngine'_ a1' a2' a3' a4' >>= \res ->
 1935   peekPricingEngine res >>= \res' ->
 1936   errorCheck  a4'>>
 1937   return (res')
 1938 
 1939 
 1940 
 1941 -- |numerical-lattice pricing engine for caps\/floors under a short-rate model
 1942 treeCapFloorEngineTimeSteps :: (GenShortRateModel sm) -> (Word) -- ^timeSteps
 1943  -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 1944 treeCapFloorEngineTimeSteps a1 a2 a3 =
 1945   withShortRateModel a1 $ \a1' -> 
 1946   let {a2' = fromIntegral a2} in 
 1947   withMaybeYieldTermStructure a3 $ \a3' -> 
 1948   preErrorCheck $ \a4' -> 
 1949   treeCapFloorEngineTimeSteps'_ a1' a2' a3' a4' >>= \res ->
 1950   peekPricingEngine res >>= \res' ->
 1951   errorCheck  a4'>>
 1952   return (res')
 1953 
 1954 
 1955 
 1956 -- |numerical-lattice pricing engine for swaptions under a short-rate model
 1957 treeSwaptionEngineTimeSteps :: (GenShortRateModel sm) -> (Word) -- ^timeSteps
 1958  -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 1959 treeSwaptionEngineTimeSteps a1 a2 a3 =
 1960   withShortRateModel a1 $ \a1' -> 
 1961   let {a2' = fromIntegral a2} in 
 1962   withMaybeYieldTermStructure a3 $ \a3' -> 
 1963   preErrorCheck $ \a4' -> 
 1964   treeSwaptionEngineTimeSteps'_ a1' a2' a3' a4' >>= \res ->
 1965   peekPricingEngine res >>= \res' ->
 1966   errorCheck  a4'>>
 1967   return (res')
 1968 
 1969 
 1970 
 1971 -- |numerical-lattice pricing engine for plain vanilla swaps under a short-rate model
 1972 treeVanillaSwapEngineTimeSteps :: (GenShortRateModel sm) -> (Word) -- ^timeSteps
 1973  -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 1974 treeVanillaSwapEngineTimeSteps a1 a2 a3 =
 1975   withShortRateModel a1 $ \a1' -> 
 1976   let {a2' = fromIntegral a2} in 
 1977   withMaybeYieldTermStructure a3 $ \a3' -> 
 1978   preErrorCheck $ \a4' -> 
 1979   treeVanillaSwapEngineTimeSteps'_ a1' a2' a3' a4' >>= \res ->
 1980   peekPricingEngine res >>= \res' ->
 1981   errorCheck  a4'>>
 1982   return (res')
 1983 
 1984 
 1985 
 1986 -- |pricing engine for European vanilla options using the Variance Gamma model, integrated numerically
 1987 varianceGammaEngine :: (VarianceGammaProcess) -> (Double) -- ^absoluteError
 1988  -> IO ((PricingEngine))
 1989 varianceGammaEngine a1 a2 =
 1990   withGenStochasticProcess1D a1 $ \a1' -> 
 1991   let {a2' = realToFrac a2} in 
 1992   preErrorCheck $ \a3' -> 
 1993   varianceGammaEngine'_ a1' a2' a3' >>= \res ->
 1994   peekPricingEngine res >>= \res' ->
 1995   errorCheck  a3'>>
 1996   return (res')
 1997 
 1998 
 1999 
 2000 -- |semi-analytic Heston-model pricing engine, integrating with a fixed quadrature order
 2001 analyticHestonEngineOrder :: (GenHestonModel hm) -> (Word) -- ^integrationOrder
 2002  -> IO ((PricingEngine))
 2003 analyticHestonEngineOrder a1 a2 =
 2004   withHestonModel a1 $ \a1' -> 
 2005   let {a2' = fromIntegral a2} in 
 2006   preErrorCheck $ \a3' -> 
 2007   analyticHestonEngineOrder'_ a1' a2' a3' >>= \res ->
 2008   peekPricingEngine res >>= \res' ->
 2009   errorCheck  a3'>>
 2010   return (res')
 2011 
 2012 
 2013 
 2014 -- |Semi-analytic Heston engine with either fixed-order or tolerance-based integration.
 2015 analyticHestonEngine :: GenHestonModel hm -> IntegrationControl -> IO PricingEngine
 2016 analyticHestonEngine model control =
 2017   case control of
 2018     IntegrationOrder order -> analyticHestonEngineOrder model order
 2019     IntegrationTolerance tolerance evaluations -> analyticHestonEngineTolerance model tolerance evaluations
 2020 
 2021 -- |The complex-logarithm evaluation formula 'AnalyticHestonEngine' would pick for the given
 2022 -- maturity and Heston parameters when constructed with 'ComplexLogFormula' left to default to
 2023 -- the model's own heuristic (mirrors upstream's asymptotic-characteristic-function threshold).
 2024 analyticHestonEngineOptimalControlVariate :: (Double) -- ^t
 2025  -> (Double) -- ^v0
 2026  -> (Double) -- ^kappa
 2027  -> (Double) -- ^theta
 2028  -> (Double) -- ^sigma
 2029  -> (Double) -- ^rho
 2030  -> (ComplexLogFormula)
 2031 analyticHestonEngineOptimalControlVariate a1 a2 a3 a4 a5 a6 =
 2032   C2HSImp.unsafePerformIO $
 2033   let {a1' = realToFrac a1} in 
 2034   let {a2' = realToFrac a2} in 
 2035   let {a3' = realToFrac a3} in 
 2036   let {a4' = realToFrac a4} in 
 2037   let {a5' = realToFrac a5} in 
 2038   let {a6' = realToFrac a6} in 
 2039   analyticHestonEngineOptimalControlVariate'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 2040   let {res' = (toEnum . fromIntegral) res} in
 2041   return (res')
 2042 
 2043 
 2044 
 2045 -- |semi-analytic Heston/Hull-White engine, integrating with a fixed relative tolerance and evaluation cap
 2046 analyticHestonHullWhiteEngineTolerance :: (GenHestonModel hm) -> (HullWhite) -> (Double) -- ^relTolerance
 2047  -> (Word) -- ^maxEvaluations
 2048  -> IO ((PricingEngine))
 2049 analyticHestonHullWhiteEngineTolerance a1 a2 a3 a4 =
 2050   withHestonModel a1 $ \a1' -> 
 2051   withHullWhite a2 $ \a2' -> 
 2052   let {a3' = realToFrac a3} in 
 2053   let {a4' = fromIntegral a4} in 
 2054   preErrorCheck $ \a5' -> 
 2055   analyticHestonHullWhiteEngineTolerance'_ a1' a2' a3' a4' a5' >>= \res ->
 2056   peekPricingEngine res >>= \res' ->
 2057   errorCheck  a5'>>
 2058   return (res')
 2059 
 2060 
 2061 
 2062 analyticH1HwEngineTolerance :: (GenHestonModel hm) -> (HullWhite) -> (Double) -- ^rhoSr
 2063  -> (Double) -- ^relTolerance
 2064  -> (Word) -- ^maxEvaluations
 2065  -> (Bool) -- ^exactMean
 2066  -> (Word) -- ^meanOrder
 2067  -> IO ((PricingEngine))
 2068 analyticH1HwEngineTolerance a1 a2 a3 a4 a5 a6 a7 =
 2069   withHestonModel a1 $ \a1' -> 
 2070   withHullWhite a2 $ \a2' -> 
 2071   let {a3' = realToFrac a3} in 
 2072   let {a4' = realToFrac a4} in 
 2073   let {a5' = fromIntegral a5} in 
 2074   let {a6' = C2HSImp.fromBool a6} in 
 2075   let {a7' = fromIntegral a7} in 
 2076   preErrorCheck $ \a8' -> 
 2077   analyticH1HwEngineTolerance'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 2078   peekPricingEngine res >>= \res' ->
 2079   errorCheck  a8'>>
 2080   return (res')
 2081 
 2082 
 2083 
 2084 -- |Semi-analytic Heston/Hull-White engine with fixed-order or tolerance-based integration.
 2085 analyticHestonHullWhiteEngine :: GenHestonModel hm -> HullWhite -> IntegrationControl -> IO PricingEngine
 2086 analyticHestonHullWhiteEngine heston hullWhite control =
 2087   case control of
 2088     IntegrationOrder order -> analyticHestonHullWhiteEngineOrder heston hullWhite order
 2089     IntegrationTolerance tolerance evaluations -> analyticHestonHullWhiteEngineTolerance heston hullWhite tolerance evaluations
 2090 
 2091 -- |H1-HW approximation engine with fixed-order or tolerance-based integration. @rhoSr@ must be
 2092 -- non-negative. 'ExactMean' uses QuantLib's native variance-root expectation integration when
 2093 -- available, otherwise hasquant's backport. 'FittedExponentialMean' delegates to QuantLib's fitted
 2094 -- engine: invalid or singular fits can return NaN or throw, depending on the linked version.
 2095 analyticH1HwEngine :: GenHestonModel hm -> HullWhite -> Double -> IntegrationControl -> H1HwMean -> IO PricingEngine
 2096 analyticH1HwEngine heston hullWhite rhoSr control mean =
 2097   case control of
 2098     IntegrationOrder order -> analyticH1HwEngineOrder heston hullWhite rhoSr order exact meanOrder
 2099     IntegrationTolerance tolerance evaluations -> analyticH1HwEngineTolerance heston hullWhite rhoSr tolerance evaluations exact meanOrder
 2100   where
 2101     (exact, meanOrder) = case mean of
 2102       FittedExponentialMean -> (False, 0)
 2103       ExactMean n -> (True, n)
 2104 
 2105 -- |semi-analytic Bates-model pricing engine, integrating with a fixed relative tolerance and evaluation cap
 2106 batesEngineTolerance :: (GenBatesModel bm) -> (Double) -- ^relTolerance
 2107  -> (Word) -- ^maxEvaluations
 2108  -> IO ((PricingEngine))
 2109 batesEngineTolerance a1 a2 a3 =
 2110   withBatesModel a1 $ \a1' -> 
 2111   let {a2' = realToFrac a2} in 
 2112   let {a3' = fromIntegral a3} in 
 2113   preErrorCheck $ \a4' -> 
 2114   batesEngineTolerance'_ a1' a2' a3' a4' >>= \res ->
 2115   peekPricingEngine res >>= \res' ->
 2116   errorCheck  a4'>>
 2117   return (res')
 2118 
 2119 
 2120 
 2121 -- |Semi-analytic Bates engine with either fixed-order or tolerance-based integration.
 2122 batesEngine :: GenBatesModel bm -> IntegrationControl -> IO PricingEngine
 2123 batesEngine model control =
 2124   case control of
 2125     IntegrationOrder order -> batesEngineOrder model order
 2126     IntegrationTolerance tolerance evaluations -> batesEngineTolerance model tolerance evaluations
 2127 
 2128 -- |Barone-Adesi and Whaley (1987) quadratic-approximation engine for American options
 2129 baroneAdesiWhaleyApproximationEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 2130 baroneAdesiWhaleyApproximationEngine a1 =
 2131   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2132   preErrorCheck $ \a2' -> 
 2133   baroneAdesiWhaleyApproximationEngine'_ a1' a2' >>= \res ->
 2134   peekPricingEngine res >>= \res' ->
 2135   errorCheck  a2'>>
 2136   return (res')
 2137 
 2138 
 2139 
 2140 batesDetJumpEngineTolerance :: (BatesDetJumpModel) -> (Double) -- ^relTolerance
 2141  -> (Word) -- ^maxEvaluations
 2142  -> IO ((PricingEngine))
 2143 batesDetJumpEngineTolerance a1 a2 a3 =
 2144   withBatesDetJumpModel a1 $ \a1' -> 
 2145   let {a2' = realToFrac a2} in 
 2146   let {a3' = fromIntegral a3} in 
 2147   preErrorCheck $ \a4' -> 
 2148   batesDetJumpEngineTolerance'_ a1' a2' a3' a4' >>= \res ->
 2149   peekPricingEngine res >>= \res' ->
 2150   errorCheck  a4'>>
 2151   return (res')
 2152 
 2153 
 2154 
 2155 batesDetJumpEngineOrder :: (BatesDetJumpModel) -> (Word) -- ^integrationOrder
 2156  -> IO ((PricingEngine))
 2157 batesDetJumpEngineOrder a1 a2 =
 2158   withBatesDetJumpModel a1 $ \a1' -> 
 2159   let {a2' = fromIntegral a2} in 
 2160   preErrorCheck $ \a3' -> 
 2161   batesDetJumpEngineOrder'_ a1' a2' a3' >>= \res ->
 2162   peekPricingEngine res >>= \res' ->
 2163   errorCheck  a3'>>
 2164   return (res')
 2165 
 2166 
 2167 
 2168 -- |Semi-analytic engine for the Bates model with deterministic jumps, with fixed-order or tolerance-based integration.
 2169 batesDetJumpEngine :: BatesDetJumpModel -> IntegrationControl -> IO PricingEngine
 2170 batesDetJumpEngine model control =
 2171   case control of
 2172     IntegrationOrder order -> batesDetJumpEngineOrder model order
 2173     IntegrationTolerance tolerance evaluations -> batesDetJumpEngineTolerance model tolerance evaluations
 2174 
 2175 batesDoubleExpDetJumpEngineTolerance :: (BatesDoubleExpDetJumpModel) -> (Double) -- ^relTolerance
 2176  -> (Word) -- ^maxEvaluations
 2177  -> IO ((PricingEngine))
 2178 batesDoubleExpDetJumpEngineTolerance a1 a2 a3 =
 2179   withBatesDoubleExpDetJumpModel a1 $ \a1' -> 
 2180   let {a2' = realToFrac a2} in 
 2181   let {a3' = fromIntegral a3} in 
 2182   preErrorCheck $ \a4' -> 
 2183   batesDoubleExpDetJumpEngineTolerance'_ a1' a2' a3' a4' >>= \res ->
 2184   peekPricingEngine res >>= \res' ->
 2185   errorCheck  a4'>>
 2186   return (res')
 2187 
 2188 
 2189 
 2190 batesDoubleExpDetJumpEngineOrder :: (BatesDoubleExpDetJumpModel) -> (Word) -- ^integrationOrder
 2191  -> IO ((PricingEngine))
 2192 batesDoubleExpDetJumpEngineOrder a1 a2 =
 2193   withBatesDoubleExpDetJumpModel a1 $ \a1' -> 
 2194   let {a2' = fromIntegral a2} in 
 2195   preErrorCheck $ \a3' -> 
 2196   batesDoubleExpDetJumpEngineOrder'_ a1' a2' a3' >>= \res ->
 2197   peekPricingEngine res >>= \res' ->
 2198   errorCheck  a3'>>
 2199   return (res')
 2200 
 2201 
 2202 
 2203 -- |Semi-analytic engine for the double-exponential-jump Bates model with deterministic jumps, with fixed-order or tolerance-based integration.
 2204 batesDoubleExpDetJumpEngine :: BatesDoubleExpDetJumpModel -> IntegrationControl -> IO PricingEngine
 2205 batesDoubleExpDetJumpEngine model control =
 2206   case control of
 2207     IntegrationOrder order -> batesDoubleExpDetJumpEngineOrder model order
 2208     IntegrationTolerance tolerance evaluations -> batesDoubleExpDetJumpEngineTolerance model tolerance evaluations
 2209 
 2210 batesDoubleExpEngineTolerance :: (GenBatesDoubleExpModel bdem) -> (Double) -- ^relTolerance
 2211  -> (Word) -- ^maxEvaluations
 2212  -> IO ((PricingEngine))
 2213 batesDoubleExpEngineTolerance a1 a2 a3 =
 2214   withBatesDoubleExpModel a1 $ \a1' -> 
 2215   let {a2' = realToFrac a2} in 
 2216   let {a3' = fromIntegral a3} in 
 2217   preErrorCheck $ \a4' -> 
 2218   batesDoubleExpEngineTolerance'_ a1' a2' a3' a4' >>= \res ->
 2219   peekPricingEngine res >>= \res' ->
 2220   errorCheck  a4'>>
 2221   return (res')
 2222 
 2223 
 2224 
 2225 batesDoubleExpEngineOrder :: (GenBatesDoubleExpModel bdem) -> (Word) -- ^integrationOrder
 2226  -> IO ((PricingEngine))
 2227 batesDoubleExpEngineOrder a1 a2 =
 2228   withBatesDoubleExpModel a1 $ \a1' -> 
 2229   let {a2' = fromIntegral a2} in 
 2230   preErrorCheck $ \a3' -> 
 2231   batesDoubleExpEngineOrder'_ a1' a2' a3' >>= \res ->
 2232   peekPricingEngine res >>= \res' ->
 2233   errorCheck  a3'>>
 2234   return (res')
 2235 
 2236 
 2237 
 2238 -- |Semi-analytic engine for the double-exponential-jump Bates model, with fixed-order or tolerance-based integration.
 2239 batesDoubleExpEngine :: GenBatesDoubleExpModel bdem -> IntegrationControl -> IO PricingEngine
 2240 batesDoubleExpEngine model control =
 2241   case control of
 2242     IntegrationOrder order -> batesDoubleExpEngineOrder model order
 2243     IntegrationTolerance tolerance evaluations -> batesDoubleExpEngineTolerance model tolerance evaluations
 2244 
 2245 -- |Bjerksund and Stensland (1993) approximation engine for American options
 2246 bjerksundStenslandApproximationEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 2247 bjerksundStenslandApproximationEngine a1 =
 2248   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2249   preErrorCheck $ \a2' -> 
 2250   bjerksundStenslandApproximationEngine'_ a1' a2' >>= \res ->
 2251   peekPricingEngine res >>= \res' ->
 2252   errorCheck  a2'>>
 2253   return (res')
 2254 
 2255 
 2256 
 2257 -- |American engine based on the QD+ approximation to the exercise boundary. Mainly a good
 2258 -- initial guess for the exercise boundary of 'qdFpAmericanEngine'; usable as a standalone
 2259 -- (lower-accuracy) American pricer on its own.
 2260 qdPlusAmericanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^interpolationPoints, number of Chebyshev nodes used to interpolate the exercise boundary
 2261  -> (SolverType) -- ^solverType, root-finding method used to locate the exercise boundary
 2262  -> (Double) -- ^eps, solver accuracy
 2263  -> (Maybe Word) -- ^maxIter, solver iteration cap; Nothing uses upstream's default
 2264  -> IO ((PricingEngine))
 2265 qdPlusAmericanEngine a1 a2 a3 a4 a5 =
 2266   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2267   let {a2' = fromIntegral a2} in 
 2268   let {a3' = (fromIntegral . fromEnum) a3} in 
 2269   let {a4' = realToFrac a4} in 
 2270   let {a5' = fromMaybeInt a5} in 
 2271   preErrorCheck $ \a6' -> 
 2272   qdPlusAmericanEngine'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 2273   peekPricingEngine res >>= \res' ->
 2274   errorCheck  a6'>>
 2275   return (res')
 2276 
 2277 
 2278 
 2279 -- |High performance\/precision American engine based on fixed point iteration for the exercise
 2280 -- boundary (Andersen, Lake and Offengenden 2015; Andersen and Lake 2021). 'QdFpScheme' selects
 2281 -- one of upstream's three built-in 'iterationScheme's ('FastScheme', 'AccurateScheme',
 2282 -- 'HighPrecisionScheme'), trading speed for accuracy.
 2283 qdFpAmericanEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (QdFpScheme) -- ^iterationScheme
 2284  -> (FixedPointEquation) -- ^fpEquation, which fixed-point formulation of the exercise boundary equation to solve
 2285  -> IO ((PricingEngine))
 2286 qdFpAmericanEngine a1 a2 a3 =
 2287   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2288   let {a2' = (fromIntegral . fromEnum) a2} in 
 2289   let {a3' = (fromIntegral . fromEnum) a3} in 
 2290   preErrorCheck $ \a4' -> 
 2291   qdFpAmericanEngine'_ a1' a2' a3' a4' >>= \res ->
 2292   peekPricingEngine res >>= \res' ->
 2293   errorCheck  a4'>>
 2294   return (res')
 2295 
 2296 
 2297 
 2298 -- |Vecer (2001) engine for continuous-averaging arithmetic Asian options, replicating the average
 2299 -- by a self-financing strategy in the underlying and solving the resulting PDE on a finite
 2300 -- @[zMin,zMax]@ grid; requires @zMin <= 0 <= zMax@ and @startDate@ no earlier than the evaluation
 2301 -- date (seasoned Asians are not supported). @currentAverage@ is accepted for parity with upstream's
 2302 -- constructor but is not read by the current implementation (only the not-yet-seasoned case is
 2303 -- handled), so 'Nothing' is fine.
 2304 continuousArithmeticAsianVecerEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Maybe (GenQuote q)) -- ^currentAverage
 2305  -> (Day) -- ^startDate
 2306  -> (Word) -- ^timeSteps
 2307  -> (Word) -- ^assetSteps
 2308  -> (Double) -- ^zMin
 2309  -> (Double) -- ^zMax
 2310  -> IO ((PricingEngine))
 2311 continuousArithmeticAsianVecerEngine a1 a2 a3 a4 a5 a6 a7 =
 2312   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2313   withMaybeQuote a2 $ \a2' -> 
 2314   withDay a3 $ \a3' -> 
 2315   let {a4' = fromIntegral a4} in 
 2316   let {a5' = fromIntegral a5} in 
 2317   let {a6' = realToFrac a6} in 
 2318   let {a7' = realToFrac a7} in 
 2319   preErrorCheck $ \a8' -> 
 2320   continuousArithmeticAsianVecerEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 2321   peekPricingEngine res >>= \res' ->
 2322   errorCheck  a8'>>
 2323   return (res')
 2324 
 2325 
 2326 
 2327 -- |CDS pricing engine that integrates the default-leg payoff over the CDS's step-wise schedule
 2328 -- |Black-formula CDS-option engine: the option on the forward spread, lognormal at the quoted
 2329 -- volatility, scaled by the risky annuity. It assumes the exercise date is the CDS's start date.
 2330 blackCdsOptionEngine :: (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
 2331  -> (GenYieldTermStructure y) -- ^termStructure
 2332  -> (GenQuote q) -- ^volatility
 2333  -> IO ((PricingEngine))
 2334 blackCdsOptionEngine a1 a2 a3 a4 =
 2335   withDefaultProbabilityTermStructure a1 $ \a1' -> 
 2336   let {a2' = realToFrac a2} in 
 2337   withYieldTermStructure a3 $ \a3' -> 
 2338   withQuote a4 $ \a4' -> 
 2339   preErrorCheck $ \a5' -> 
 2340   blackCdsOptionEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 2341   peekPricingEngine res >>= \res' ->
 2342   errorCheck  a5'>>
 2343   return (res')
 2344 
 2345 
 2346 
 2347 integralCdsEngine :: ((Word,TimeUnit)) -- ^integrationStep
 2348  -> (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
 2349  -> (GenYieldTermStructure y) -- ^discountCurve
 2350  -> (Maybe Bool) -- ^includeSettlementDateFlows
 2351  -> IO ((PricingEngine))
 2352 integralCdsEngine a1 a2 a3 a4 a5 =
 2353   let {(a1'1, a1'2) = fromEnumQuantity a1} in 
 2354   withDefaultProbabilityTermStructure a2 $ \a2' -> 
 2355   let {a3' = realToFrac a3} in 
 2356   withYieldTermStructure a4 $ \a4' -> 
 2357   let {a5' = fromMaybeBool a5} in 
 2358   preErrorCheck $ \a6' -> 
 2359   integralCdsEngine'_ a1'1  a1'2 a2' a3' a4' a5' a6' >>= \res ->
 2360   peekPricingEngine res >>= \res' ->
 2361   errorCheck  a6'>>
 2362   return (res')
 2363 
 2364 
 2365 
 2366 -- |pricing engine for European vanilla options using an integral approach
 2367 integralEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 2368 integralEngine a1 =
 2369   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2370   preErrorCheck $ \a2' -> 
 2371   integralEngine'_ a1' a2' >>= \res ->
 2372   peekPricingEngine res >>= \res' ->
 2373   errorCheck  a2'>>
 2374   return (res')
 2375 
 2376 
 2377 
 2378 -- |the term structure is only needed when the short-rate model cannot provide one itself.
 2379 jamshidianSwaptionEngine :: (GenOneFactorAffineModel om) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 2380 jamshidianSwaptionEngine a1 a2 =
 2381   withOneFactorAffineModel a1 $ \a1' -> 
 2382   withMaybeYieldTermStructure a2 $ \a2' -> 
 2383   preErrorCheck $ \a3' -> 
 2384   jamshidianSwaptionEngine'_ a1' a2' a3' >>= \res ->
 2385   peekPricingEngine res >>= \res' ->
 2386   errorCheck  a3'>>
 2387   return (res')
 2388 
 2389 
 2390 
 2391 -- |swaption pricing engine for any one-factor Gaussian short-rate model, evaluated by integration over the model's state variable.
 2392 -- On QuantLib 1.44 it also prices an 'QuantLib.Instrument.Swap.OvernightIndexedSwap' underlying (see 'QuantLib.Instrument.Swap.swaption').
 2393 gaussian1dSwaptionEngine :: (Gaussian1dModel) -> (Int) -- ^integrationPoints
 2394  -> (Double) -- ^stddevs
 2395  -> (Bool) -- ^extrapolatePayoff
 2396  -> (Bool) -- ^flatPayoffExtrapolation
 2397  -> (Maybe (GenYieldTermStructure y)) -- ^discountCurve
 2398  -> (Probabilities) -- ^probabilities
 2399  -> IO ((PricingEngine))
 2400 gaussian1dSwaptionEngine a1 a2 a3 a4 a5 a6 a7 =
 2401   withStandalone a1 $ \a1' -> 
 2402   let {a2' = fromIntegral a2} in 
 2403   let {a3' = realToFrac a3} in 
 2404   let {a4' = C2HSImp.fromBool a4} in 
 2405   let {a5' = C2HSImp.fromBool a5} in 
 2406   withMaybeYieldTermStructure a6 $ \a6' -> 
 2407   let {a7' = (fromIntegral . fromEnum) a7} in 
 2408   preErrorCheck $ \a8' -> 
 2409   gaussian1dSwaptionEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 2410   peekPricingEngine res >>= \res' ->
 2411   errorCheck  a8'>>
 2412   return (res')
 2413 
 2414 
 2415 
 2416 -- |As 'gaussian1dSwaptionEngine', for a 'QuantLib.Instrument.Swap.NonstandardSwaption'. Adds
 2417 -- an optional OAS ('oas', continuously compounded w.r.t. the discount curve's day counter) on
 2418 -- top of the shared parameters. Overnight-indexed floating coupons are compounded on QuantLib 1.44.
 2419 gaussian1dNonstandardSwaptionEngine :: (Gaussian1dModel) -> (Int) -- ^integrationPoints
 2420  -> (Double) -- ^stddevs
 2421  -> (Bool) -- ^extrapolatePayoff
 2422  -> (Bool) -- ^flatPayoffExtrapolation
 2423  -> (Maybe (GenQuote q)) -- ^oas
 2424  -> (Maybe (GenYieldTermStructure y)) -- ^discountCurve
 2425  -> (Probabilities) -- ^probabilities
 2426  -> IO ((PricingEngine))
 2427 gaussian1dNonstandardSwaptionEngine a1 a2 a3 a4 a5 a6 a7 a8 =
 2428   withStandalone a1 $ \a1' -> 
 2429   let {a2' = fromIntegral a2} in 
 2430   let {a3' = realToFrac a3} in 
 2431   let {a4' = C2HSImp.fromBool a4} in 
 2432   let {a5' = C2HSImp.fromBool a5} in 
 2433   withMaybeQuote a6 $ \a6' -> 
 2434   withMaybeYieldTermStructure a7 $ \a7' -> 
 2435   let {a8' = (fromIntegral . fromEnum) a8} in 
 2436   preErrorCheck $ \a9' -> 
 2437   gaussian1dNonstandardSwaptionEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 2438   peekPricingEngine res >>= \res' ->
 2439   errorCheck  a9'>>
 2440   return (res')
 2441 
 2442 
 2443 
 2444 -- |As 'gaussian1dNonstandardSwaptionEngine', for a
 2445 -- 'QuantLib.Instrument.Swap.FloatFloatSwaption'. Adds 'includeTodaysExercise' -- whether a
 2446 -- fixing due exactly \"today\" counts as part of the exercise-into leg.
 2447 gaussian1dFloatFloatSwaptionEngine :: (Gaussian1dModel) -> (Int) -- ^integrationPoints
 2448  -> (Double) -- ^stddevs
 2449  -> (Bool) -- ^extrapolatePayoff
 2450  -> (Bool) -- ^flatPayoffExtrapolation
 2451  -> (Maybe (GenQuote q)) -- ^oas
 2452  -> (Maybe (GenYieldTermStructure y)) -- ^discountCurve
 2453  -> (Bool) -- ^includeTodaysExercise
 2454  -> (Probabilities) -- ^probabilities
 2455  -> IO ((PricingEngine))
 2456 gaussian1dFloatFloatSwaptionEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2457   withStandalone a1 $ \a1' -> 
 2458   let {a2' = fromIntegral a2} in 
 2459   let {a3' = realToFrac a3} in 
 2460   let {a4' = C2HSImp.fromBool a4} in 
 2461   let {a5' = C2HSImp.fromBool a5} in 
 2462   withMaybeQuote a6 $ \a6' -> 
 2463   withMaybeYieldTermStructure a7 $ \a7' -> 
 2464   let {a8' = C2HSImp.fromBool a8} in 
 2465   let {a9' = (fromIntegral . fromEnum) a9} in 
 2466   preErrorCheck $ \a10' -> 
 2467   gaussian1dFloatFloatSwaptionEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 2468   peekPricingEngine res >>= \res' ->
 2469   errorCheck  a10'>>
 2470   return (res')
 2471 
 2472 
 2473 
 2474 -- |swaption pricing engine using Jamshidian's decomposition, for any one-factor Gaussian
 2475 -- short-rate model. QuantLib 1.44 freezes a floating payment lag's convexity at time zero.
 2476 gaussian1dJamshidianSwaptionEngine :: (Gaussian1dModel) -> IO ((PricingEngine))
 2477 gaussian1dJamshidianSwaptionEngine a1 =
 2478   withStandalone a1 $ \a1' -> 
 2479   preErrorCheck $ \a2' -> 
 2480   gaussian1dJamshidianSwaptionEngine'_ a1' a2' >>= \res ->
 2481   peekPricingEngine res >>= \res' ->
 2482   errorCheck  a2'>>
 2483   return (res')
 2484 
 2485 
 2486 
 2487 -- |Ju (1999) quadratic-approximation engine for American options
 2488 juQuadraticApproximationEngine :: (GenGeneralizedBlackScholesProcess gbs) -> IO ((PricingEngine))
 2489 juQuadraticApproximationEngine a1 =
 2490   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2491   preErrorCheck $ \a2' -> 
 2492   juQuadraticApproximationEngine'_ a1' a2' >>= \res ->
 2493   peekPricingEngine res >>= \res' ->
 2494   errorCheck  a2'>>
 2495   return (res')
 2496 
 2497 
 2498 
 2499 -- |pricing engine for a spread option on two futures/assets
 2500 kirkEngine :: (BlackProcess) -> (BlackProcess) -> (Double) -- ^correlation
 2501  -> IO ((PricingEngine))
 2502 kirkEngine a1 a2 a3 =
 2503   withBlackProcess a1 $ \a1' -> 
 2504   withBlackProcess a2 $ \a2' -> 
 2505   let {a3' = realToFrac a3} in 
 2506   preErrorCheck $ \a4' -> 
 2507   kirkEngine'_ a1' a2' a3' a4' >>= \res ->
 2508   peekPricingEngine res >>= \res' ->
 2509   errorCheck  a4'>>
 2510   return (res')
 2511 
 2512 
 2513 
 2514 -- |CDS pricing engine using the mid-point approximation, evaluating the default leg at the mid-point of each accrual period
 2515 midPointCdsEngine :: (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
 2516  -> (GenYieldTermStructure y) -> (Maybe Bool) -- ^includeSettlementDateFlows
 2517  -> IO ((PricingEngine))
 2518 midPointCdsEngine a1 a2 a3 a4 =
 2519   withDefaultProbabilityTermStructure a1 $ \a1' -> 
 2520   let {a2' = realToFrac a2} in 
 2521   withYieldTermStructure a3 $ \a3' -> 
 2522   let {a4' = fromMaybeBool a4} in 
 2523   preErrorCheck $ \a5' -> 
 2524   midPointCdsEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 2525   peekPricingEngine res >>= \res' ->
 2526   errorCheck  a5'>>
 2527   return (res')
 2528 
 2529 
 2530 
 2531 -- |Synthetic CDO tranche pricing engine using the mid-point approximation, evaluating the
 2532 -- expected tranche loss at the mid-point of each accrual/protection period. The basket must
 2533 -- already have a 'QuantLib.Credit.DefaultLossModel' attached.
 2534 midPointCdoEngine :: (GenYieldTermStructure y) -- ^discountCurve
 2535  -> IO ((PricingEngine))
 2536 midPointCdoEngine a1 =
 2537   withYieldTermStructure a1 $ \a1' -> 
 2538   preErrorCheck $ \a2' -> 
 2539   midPointCdoEngine'_ a1' a2' >>= \res ->
 2540   peekPricingEngine res >>= \res' ->
 2541   errorCheck  a2'>>
 2542   return (res')
 2543 
 2544 
 2545 
 2546 -- |Synthetic CDO tranche pricing engine that integrates the expected tranche loss over
 2547 -- @stepSize@-sized steps of the tranche's schedule.
 2548 integralCdoEngine :: (GenYieldTermStructure y) -- ^discountCurve
 2549  -> ((Word,TimeUnit)) -- ^stepSize
 2550  -> IO ((PricingEngine))
 2551 integralCdoEngine a1 a2 =
 2552   withYieldTermStructure a1 $ \a1' -> 
 2553   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 2554   preErrorCheck $ \a3' -> 
 2555   integralCdoEngine'_ a1' a2'1  a2'2 a3' >>= \res ->
 2556   peekPricingEngine res >>= \res' ->
 2557   errorCheck  a3'>>
 2558   return (res')
 2559 
 2560 
 2561 
 2562 -- |Nth-to-default pricing engine that integrates the probability of at least @n@ defaults over
 2563 -- @integrationStep@-sized steps of the underlying basket's copula.
 2564 integralNtdEngine :: ((Word,TimeUnit)) -- ^integrationStep
 2565  -> (GenYieldTermStructure y) -- ^discountCurve
 2566  -> IO ((PricingEngine))
 2567 integralNtdEngine a1 a2 =
 2568   let {(a1'1, a1'2) = fromEnumQuantity a1} in 
 2569   withYieldTermStructure a2 $ \a2' -> 
 2570   preErrorCheck $ \a3' -> 
 2571   integralNtdEngine'_ a1'1  a1'2 a2' a3' >>= \res ->
 2572   peekPricingEngine res >>= \res' ->
 2573   errorCheck  a3'>>
 2574   return (res')
 2575 
 2576 
 2577 
 2578 -- |CDS pricing engine implementing the ISDA standard model
 2579 isdaCdsEngine :: (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
 2580  -> (GenYieldTermStructure y) -> (Maybe Bool) -- ^includeSettlementDateFlows
 2581  -> (NumericalFix) -- ^numericalFix
 2582  -> (AccrualBias) -- ^accrualBias
 2583  -> (ForwardsInCouponPeriod) -- ^forwardsInCouponPeriod
 2584  -> IO ((PricingEngine))
 2585 isdaCdsEngine a1 a2 a3 a4 a5 a6 a7 =
 2586   withDefaultProbabilityTermStructure a1 $ \a1' -> 
 2587   let {a2' = realToFrac a2} in 
 2588   withYieldTermStructure a3 $ \a3' -> 
 2589   let {a4' = fromMaybeBool a4} in 
 2590   let {a5' = (fromIntegral . fromEnum) a5} in 
 2591   let {a6' = (fromIntegral . fromEnum) a6} in 
 2592   let {a7' = (fromIntegral . fromEnum) a7} in 
 2593   preErrorCheck $ \a8' -> 
 2594   isdaCdsEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 2595   peekPricingEngine res >>= \res' ->
 2596   errorCheck  a8'>>
 2597   return (res')
 2598 
 2599 
 2600 
 2601 -- |variance-swap pricing engine using a replicating portfolio of vanilla options at the given strikes
 2602 replicatingVarianceSwapEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^dk
 2603  -> (NonEmpty Double) -- ^callStrikes
 2604  -> (NonEmpty Double) -- ^putStrikes
 2605  -> IO ((PricingEngine))
 2606 replicatingVarianceSwapEngine a1 a2 a3 a4 =
 2607   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2608   let {a2' = realToFrac a2} in 
 2609   withNonEmptyDoubleArray a3 $ \(a3'1, a3'2) -> 
 2610   withNonEmptyDoubleArray a4 $ \(a4'1, a4'2) -> 
 2611   preErrorCheck $ \a5' -> 
 2612   replicatingVarianceSwapEngine'_ a1' a2' a3'1  a3'2 a4'1  a4'2 a5' >>= \res ->
 2613   peekPricingEngine res >>= \res' ->
 2614   errorCheck  a5'>>
 2615   return (res')
 2616 
 2617 
 2618 
 2619 -- |pricing engine for 2D European basket options (Stulz formula)
 2620 stulzEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2621  -> IO ((PricingEngine))
 2622 stulzEngine a1 a2 a3 =
 2623   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2624   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2625   let {a3' = realToFrac a3} in 
 2626   preErrorCheck $ \a4' -> 
 2627   stulzEngine'_ a1' a2' a3' a4' >>= \res ->
 2628   peekPricingEngine res >>= \res' ->
 2629   errorCheck  a4'>>
 2630   return (res')
 2631 
 2632 
 2633 
 2634 -- |Bjerksund-Stensland (2014) closed-form pricing engine for a spread option on two futures
 2635 bjerksundStenslandSpreadEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2636  -> IO ((PricingEngine))
 2637 bjerksundStenslandSpreadEngine a1 a2 a3 =
 2638   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2639   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2640   let {a3' = realToFrac a3} in 
 2641   preErrorCheck $ \a4' -> 
 2642   bjerksundStenslandSpreadEngine'_ a1' a2' a3' a4' >>= \res ->
 2643   peekPricingEngine res >>= \res' ->
 2644   errorCheck  a4'>>
 2645   return (res')
 2646 
 2647 
 2648 
 2649 -- |Chi-Fai Lo (2015) operator-splitting-approximation pricing engine for a spread option
 2650 operatorSplittingSpreadEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2651  -> (OperatorSplittingOrder) -- ^order, upstream default: 'Second'
 2652  -> IO ((PricingEngine))
 2653 operatorSplittingSpreadEngine a1 a2 a3 a4 =
 2654   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2655   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2656   let {a3' = realToFrac a3} in 
 2657   let {a4' = (fromIntegral . fromEnum) a4} in 
 2658   preErrorCheck $ \a5' -> 
 2659   operatorSplittingSpreadEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 2660   peekPricingEngine res >>= \res' ->
 2661   errorCheck  a5'>>
 2662   return (res')
 2663 
 2664 
 2665 
 2666 -- |Pearson (1995) 1-D-numerical-integration pricing engine for a spread option
 2667 pearsonSpreadEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2668  -> (Double) -- ^integrationTolerance, upstream default: 1e-10
 2669  -> (Word) -- ^maxIntegrationIterations, upstream default: 10000
 2670  -> (Double) -- ^nStd, upstream default: 8.0
 2671  -> IO ((PricingEngine))
 2672 pearsonSpreadEngine a1 a2 a3 a4 a5 a6 =
 2673   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2674   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2675   let {a3' = realToFrac a3} in 
 2676   let {a4' = realToFrac a4} in 
 2677   let {a5' = fromIntegral a5} in 
 2678   let {a6' = realToFrac a6} in 
 2679   preErrorCheck $ \a7' -> 
 2680   pearsonSpreadEngine'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 2681   peekPricingEngine res >>= \res' ->
 2682   errorCheck  a7'>>
 2683   return (res')
 2684 
 2685 
 2686 
 2687 -- |Gaussian-copula nested-Gauss-Hermite-quadrature pricing engine for a spread option with smile-implied marginals
 2688 gaussianCopulaSpreadEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2689  -> (Word) -- ^nPoints, upstream default: 64
 2690  -> IO ((PricingEngine))
 2691 gaussianCopulaSpreadEngine a1 a2 a3 a4 =
 2692   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2693   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2694   let {a3' = realToFrac a3} in 
 2695   let {a4' = fromIntegral a4} in 
 2696   preErrorCheck $ \a5' -> 
 2697   gaussianCopulaSpreadEngine'_ a1' a2' a3' a4' a5' >>= \res ->
 2698   peekPricingEngine res >>= \res' ->
 2699   errorCheck  a5'>>
 2700   return (res')
 2701 
 2702 
 2703 
 2704 -- |Choi (2018) \"sum of Black-Scholes-Merton models\" pricing engine for a basket option on
 2705 -- multiple underlyings, correlated via @rho@
 2706 choiBasketEngine :: NonEmpty (GenGeneralizedBlackScholesProcess gbs) -> Matrix Double -- ^correlation matrix rho
 2707   -> Double -- ^lambda, upstream default: 10.0
 2708   -> Word -- ^maxNrIntegrationSteps, upstream default: unbounded; the C shim takes a 32-bit count
 2709   -> Bool -- ^calcfwdDelta
 2710   -> Bool -- ^controlVariate
 2711   -> IO PricingEngine
 2712 choiBasketEngine ps (Matrix mr mc md) = qlChoiBasketEngine (toList ps) mr mc md
 2713 qlChoiBasketEngine :: ([GenGeneralizedBlackScholesProcess gbs]) -> (Word) -> (Word) -> ([Double]) -> (Double) -- ^lambda
 2714  -> (Word) -- ^maxNrIntegrationSteps
 2715  -> (Bool) -- ^calcfwdDelta
 2716  -> (Bool) -- ^controlVariate
 2717  -> IO ((PricingEngine))
 2718 qlChoiBasketEngine a1 a2 a3 a4 a5 a6 a7 a8 =
 2719   withGeneralizedBlackScholesProcessArray a1 $ \(a1'1, a1'2) -> 
 2720   let {a2' = fromIntegral a2} in 
 2721   let {a3' = fromIntegral a3} in 
 2722   withDoubleArrayRaw a4 $ \a4' -> 
 2723   let {a5' = realToFrac a5} in 
 2724   let {a6' = fromIntegral a6} in 
 2725   let {a7' = C2HSImp.fromBool a7} in 
 2726   let {a8' = C2HSImp.fromBool a8} in 
 2727   preErrorCheck $ \a9' -> 
 2728   qlChoiBasketEngine'_ a1'1  a1'2 a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 2729   peekPricingEngine res >>= \res' ->
 2730   errorCheck  a9'>>
 2731   return (res')
 2732 
 2733 
 2734 
 2735 -- |Deng-Li-Zhou (2008) closed-form-approximation pricing engine for a spread option on multiple
 2736 -- underlyings, correlated via @rho@
 2737 dengLiZhouBasketEngine :: NonEmpty (GenGeneralizedBlackScholesProcess gbs) -> Matrix Double -- ^correlation matrix rho
 2738   -> IO PricingEngine
 2739 dengLiZhouBasketEngine ps (Matrix mr mc md) = qlDengLiZhouBasketEngine (toList ps) mr mc md
 2740 qlDengLiZhouBasketEngine :: ([GenGeneralizedBlackScholesProcess gbs]) -> (Word) -> (Word) -> ([Double]) -> IO ((PricingEngine))
 2741 qlDengLiZhouBasketEngine a1 a2 a3 a4 =
 2742   withGeneralizedBlackScholesProcessArray a1 $ \(a1'1, a1'2) -> 
 2743   let {a2' = fromIntegral a2} in 
 2744   let {a3' = fromIntegral a3} in 
 2745   withDoubleArrayRaw a4 $ \a4' -> 
 2746   preErrorCheck $ \a5' -> 
 2747   qlDengLiZhouBasketEngine'_ a1'1  a1'2 a2' a3' a4' a5' >>= \res ->
 2748   peekPricingEngine res >>= \res' ->
 2749   errorCheck  a5'>>
 2750   return (res')
 2751 
 2752 
 2753 
 2754 -- |pricing engine for a basket where all underlyings are driven by one stochastic factor
 2755 singleFactorBsmBasketEngine :: NonEmpty (GenGeneralizedBlackScholesProcess gbs)
 2756   -> Double -- ^xTol, upstream default: @1e4*QL_EPSILON@
 2757   -> IO PricingEngine
 2758 singleFactorBsmBasketEngine ps = qlSingleFactorBsmBasketEngine (toList ps)
 2759 qlSingleFactorBsmBasketEngine :: ([GenGeneralizedBlackScholesProcess gbs]) -> (Double) -- ^xTol
 2760  -> IO ((PricingEngine))
 2761 qlSingleFactorBsmBasketEngine a1 a2 =
 2762   withGeneralizedBlackScholesProcessArray a1 $ \(a1'1, a1'2) -> 
 2763   let {a2' = realToFrac a2} in 
 2764   preErrorCheck $ \a3' -> 
 2765   qlSingleFactorBsmBasketEngine'_ a1'1  a1'2 a2' a3' >>= \res ->
 2766   peekPricingEngine res >>= \res' ->
 2767   errorCheck  a3'>>
 2768   return (res')
 2769 
 2770 
 2771 
 2772 -- |Libor forward model swaption engine, priced via the Black formula
 2773 lfmSwaptionEngine :: (LiborForwardModel) -> (GenYieldTermStructure y) -> IO ((PricingEngine))
 2774 lfmSwaptionEngine a1 a2 =
 2775   withGenCalibratedModel a1 $ \a1' -> 
 2776   withYieldTermStructure a2 $ \a2' -> 
 2777   preErrorCheck $ \a3' -> 
 2778   lfmSwaptionEngine'_ a1' a2' a3' >>= \res ->
 2779   peekPricingEngine res >>= \res' ->
 2780   errorCheck  a3'>>
 2781   return (res')
 2782 
 2783 
 2784 
 2785 -- |numerical-lattice pricing engine for caps\/floors under a short-rate model, on an explicit time grid
 2786 treeCapFloorEngineTimeGrid :: (GenShortRateModel sm) -> (TimeGrid) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 2787 treeCapFloorEngineTimeGrid a1 a2 a3 =
 2788   withShortRateModel a1 $ \a1' -> 
 2789   withTimeGrid a2 $ \a2' -> 
 2790   withMaybeYieldTermStructure a3 $ \a3' -> 
 2791   preErrorCheck $ \a4' -> 
 2792   treeCapFloorEngineTimeGrid'_ a1' a2' a3' a4' >>= \res ->
 2793   peekPricingEngine res >>= \res' ->
 2794   errorCheck  a4'>>
 2795   return (res')
 2796 
 2797 
 2798 
 2799 -- |numerical-lattice pricing engine for swaptions under a short-rate model, on an explicit time grid
 2800 treeSwaptionEngineTimeGrid :: (GenShortRateModel sm) -> (TimeGrid) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 2801 treeSwaptionEngineTimeGrid a1 a2 a3 =
 2802   withShortRateModel a1 $ \a1' -> 
 2803   withTimeGrid a2 $ \a2' -> 
 2804   withMaybeYieldTermStructure a3 $ \a3' -> 
 2805   preErrorCheck $ \a4' -> 
 2806   treeSwaptionEngineTimeGrid'_ a1' a2' a3' a4' >>= \res ->
 2807   peekPricingEngine res >>= \res' ->
 2808   errorCheck  a4'>>
 2809   return (res')
 2810 
 2811 
 2812 
 2813 -- |numerical-lattice pricing engine for plain vanilla swaps under a short-rate model, on an explicit time grid
 2814 treeVanillaSwapEngineTimeGrid :: (GenShortRateModel sm) -> (TimeGrid) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 2815 treeVanillaSwapEngineTimeGrid a1 a2 a3 =
 2816   withShortRateModel a1 $ \a1' -> 
 2817   withTimeGrid a2 $ \a2' -> 
 2818   withMaybeYieldTermStructure a3 $ \a3' -> 
 2819   preErrorCheck $ \a4' -> 
 2820   treeVanillaSwapEngineTimeGrid'_ a1' a2' a3' a4' >>= \res ->
 2821   peekPricingEngine res >>= \res' ->
 2822   errorCheck  a4'>>
 2823   return (res')
 2824 
 2825 
 2826 
 2827 -- |Numerical-lattice cap/floor engine using either a step count or an explicit grid.
 2828 treeCapFloorEngine :: GenShortRateModel sm -> LatticeTime -> Maybe (GenYieldTermStructure y) -> IO PricingEngine
 2829 treeCapFloorEngine model latticeTime curve =
 2830   case latticeTime of
 2831     TimeSteps steps -> treeCapFloorEngineTimeSteps model steps curve
 2832     ExplicitTimeGrid grid -> treeCapFloorEngineTimeGrid model grid curve
 2833 
 2834 -- |Numerical-lattice swaption engine using either a step count or an explicit grid.
 2835 treeSwaptionEngine :: GenShortRateModel sm -> LatticeTime -> Maybe (GenYieldTermStructure y) -> IO PricingEngine
 2836 treeSwaptionEngine model latticeTime curve =
 2837   case latticeTime of
 2838     TimeSteps steps -> treeSwaptionEngineTimeSteps model steps curve
 2839     ExplicitTimeGrid grid -> treeSwaptionEngineTimeGrid model grid curve
 2840 
 2841 -- |Numerical-lattice vanilla-swap engine using either a step count or an explicit grid.
 2842 treeVanillaSwapEngine :: GenShortRateModel sm -> LatticeTime -> Maybe (GenYieldTermStructure y) -> IO PricingEngine
 2843 treeVanillaSwapEngine model latticeTime curve =
 2844   case latticeTime of
 2845     TimeSteps steps -> treeVanillaSwapEngineTimeSteps model steps curve
 2846     ExplicitTimeGrid grid -> treeVanillaSwapEngineTimeGrid model grid curve
 2847 
 2848 -- |Snapshots @rTS@/@fTS@/@fxVolTS@ at construction time (their underlying @shared_ptr@s are copied
 2849 -- out of their handles): a later relink of a 'RelinkableYieldTermStructure' or
 2850 -- 'RelinkableBlackVolTermStructure' passed in here will /not/ be reflected in this 'FdmQuantoHelper'.
 2851 fdmQuantoHelper :: (GenYieldTermStructure y1) -- ^rTS
 2852  -> (GenYieldTermStructure y2) -- ^fTS
 2853  -> (GenBlackVolTermStructure bv) -- ^fxVolTS
 2854  -> (Double) -- ^equityFxCorrelation
 2855  -> (Double) -- ^exchRateATMlevel
 2856  -> IO ((FdmQuantoHelper))
 2857 fdmQuantoHelper a1 a2 a3 a4 a5 =
 2858   withYieldTermStructure a1 $ \a1' -> 
 2859   withYieldTermStructure a2 $ \a2' -> 
 2860   withBlackVolTermStructure a3 $ \a3' -> 
 2861   let {a4' = realToFrac a4} in 
 2862   let {a5' = realToFrac a5} in 
 2863   preErrorCheck $ \a6' -> 
 2864   fdmQuantoHelper'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 2865   peekFdmQuantoHelper res >>= \res' ->
 2866   errorCheck  a6'>>
 2867   return (res')
 2868 
 2869 
 2870 
 2871 -- |quanto drift adjustment @domesticRate - foreignRate + equityFxCorrelation*equityVol*fxVol@ over @[t1,t2]@
 2872 quantoAdjustment :: (FdmQuantoHelper) -> (Double) -- ^equityVol
 2873  -> (Double) -- ^t1
 2874  -> (Double) -- ^t2
 2875  -> IO ((Double))
 2876 quantoAdjustment a1 a2 a3 a4 =
 2877   withFdmQuantoHelper a1 $ \a1' -> 
 2878   let {a2' = realToFrac a2} in 
 2879   let {a3' = realToFrac a3} in 
 2880   let {a4' = realToFrac a4} in 
 2881   preErrorCheck $ \a5' -> 
 2882   quantoAdjustment'_ a1' a2' a3' a4' a5' >>= \res ->
 2883   let {res' = realToFrac res} in
 2884   errorCheck  a5'>>
 2885   return (res')
 2886 
 2887 
 2888 
 2889 -- |two-dimensional finite-differences Black-Scholes basket-option pricing engine
 2890 fd2dBlackScholesVanillaEngine :: (GenGeneralizedBlackScholesProcess gbs1) -> (GenGeneralizedBlackScholesProcess gbs2) -> (Double) -- ^correlation
 2891  -> (Word) -- ^xGrid, upstream default: 100
 2892  -> (Word) -- ^yGrid, upstream default: 100
 2893  -> (Word) -- ^tGrid, upstream default: 50
 2894  -> (Word) -- ^dampingSteps, upstream default: 0
 2895  -> (FdmScheme) -- ^schemeDesc, upstream default: 'Hundsdorfer'
 2896  -> (Bool) -- ^localVol
 2897  -> (Double) -- ^illegalLocalVolOverwrite, upstream default: @-Null\<Real\>()@
 2898  -> IO ((PricingEngine))
 2899 fd2dBlackScholesVanillaEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 2900   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 2901   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 2902   let {a3' = realToFrac a3} in 
 2903   let {a4' = fromIntegral a4} in 
 2904   let {a5' = fromIntegral a5} in 
 2905   let {a6' = fromIntegral a6} in 
 2906   let {a7' = fromIntegral a7} in 
 2907   withFdmSchemeDesc a8 $ \a8' -> 
 2908   let {a9' = C2HSImp.fromBool a9} in 
 2909   let {a10' = realToFrac a10} in 
 2910   preErrorCheck $ \a11' -> 
 2911   fd2dBlackScholesVanillaEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 2912   peekPricingEngine res >>= \res' ->
 2913   errorCheck  a11'>>
 2914   return (res')
 2915 
 2916 
 2917 
 2918 -- |n-dimensional finite-differences Black-Scholes basket-option pricing engine, with an explicit
 2919 -- per-axis grid size
 2920 fdndimBlackScholesVanillaEngineAxisGrids :: NonEmpty (GenGeneralizedBlackScholesProcess gbs) -> Matrix Double -- ^correlation matrix rho
 2921   -> NonEmpty Word -- ^xGrids, one per underlying
 2922   -> Word -- ^tGrid, upstream default: 50
 2923   -> Word -- ^dampingSteps, upstream default: 0
 2924   -> FdmScheme -- ^schemeDesc, upstream default: 'Douglas'
 2925   -> IO PricingEngine
 2926 fdndimBlackScholesVanillaEngineAxisGrids ps (Matrix mr mc md) xGrids = qlFdndimBlackScholesVanillaEngine (toList ps) mr mc md (toList xGrids)
 2927 qlFdndimBlackScholesVanillaEngine :: ([GenGeneralizedBlackScholesProcess gbs]) -> (Word) -> (Word) -> ([Double]) -> ([Word]) -> (Word) -- ^tGrid
 2928  -> (Word) -- ^dampingSteps
 2929  -> (FdmScheme) -> IO ((PricingEngine))
 2930 qlFdndimBlackScholesVanillaEngine a1 a2 a3 a4 a5 a6 a7 a8 =
 2931   withGeneralizedBlackScholesProcessArray a1 $ \(a1'1, a1'2) -> 
 2932   let {a2' = fromIntegral a2} in 
 2933   let {a3' = fromIntegral a3} in 
 2934   withDoubleArrayRaw a4 $ \a4' -> 
 2935   withIntArray a5 $ \(a5'1, a5'2) -> 
 2936   let {a6' = fromIntegral a6} in 
 2937   let {a7' = fromIntegral a7} in 
 2938   withFdmSchemeDesc a8 $ \a8' -> 
 2939   preErrorCheck $ \a9' -> 
 2940   qlFdndimBlackScholesVanillaEngine'_ a1'1  a1'2 a2' a3' a4' a5'1  a5'2 a6' a7' a8' a9' >>= \res ->
 2941   peekPricingEngine res >>= \res' ->
 2942   errorCheck  a9'>>
 2943   return (res')
 2944 
 2945 
 2946 
 2947 -- |n-dimensional finite-differences Black-Scholes basket-option pricing engine, auto-scaling every
 2948 -- axis' grid from a single size (largest eigenvalue gets @xGrid@)
 2949 fdndimBlackScholesVanillaEngineUniformGrid :: NonEmpty (GenGeneralizedBlackScholesProcess gbs) -> Matrix Double -- ^correlation matrix rho
 2950   -> Word -- ^xGrid
 2951   -> Word -- ^tGrid, upstream default: 50
 2952   -> Word -- ^dampingSteps, upstream default: 0
 2953   -> FdmScheme -- ^schemeDesc, upstream default: 'Douglas'
 2954   -> IO PricingEngine
 2955 fdndimBlackScholesVanillaEngineUniformGrid ps (Matrix mr mc md) = qlFdndimBlackScholesVanillaEngine1 (toList ps) mr mc md
 2956 qlFdndimBlackScholesVanillaEngine1 :: ([GenGeneralizedBlackScholesProcess gbs]) -> (Word) -> (Word) -> ([Double]) -> (Word) -- ^xGrid
 2957  -> (Word) -- ^tGrid
 2958  -> (Word) -- ^dampingSteps
 2959  -> (FdmScheme) -> IO ((PricingEngine))
 2960 qlFdndimBlackScholesVanillaEngine1 a1 a2 a3 a4 a5 a6 a7 a8 =
 2961   withGeneralizedBlackScholesProcessArray a1 $ \(a1'1, a1'2) -> 
 2962   let {a2' = fromIntegral a2} in 
 2963   let {a3' = fromIntegral a3} in 
 2964   withDoubleArrayRaw a4 $ \a4' -> 
 2965   let {a5' = fromIntegral a5} in 
 2966   let {a6' = fromIntegral a6} in 
 2967   let {a7' = fromIntegral a7} in 
 2968   withFdmSchemeDesc a8 $ \a8' -> 
 2969   preErrorCheck $ \a9' -> 
 2970   qlFdndimBlackScholesVanillaEngine1'_ a1'1  a1'2 a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 2971   peekPricingEngine res >>= \res' ->
 2972   errorCheck  a9'>>
 2973   return (res')
 2974 
 2975 
 2976 
 2977 -- |N-dimensional Black-Scholes finite-difference engine with uniform or per-axis grids.
 2978 fdndimBlackScholesVanillaEngine :: NonEmpty (GenGeneralizedBlackScholesProcess gbs) -> Matrix Double
 2979   -> FdmGrid -> Word -> Word -> FdmScheme -> IO PricingEngine
 2980 fdndimBlackScholesVanillaEngine processes correlations grid =
 2981   case grid of
 2982     UniformGrid gridSize -> fdndimBlackScholesVanillaEngineUniformGrid processes correlations gridSize
 2983     AxisGrids sizes -> fdndimBlackScholesVanillaEngineAxisGrids processes correlations sizes
 2984 
 2985 -- |finite-differences swaption pricing engine for the G2 two-factor short-rate model
 2986 fdG2SwaptionEngine :: (G2) -> (Word) -- ^tGrid
 2987  -> (Word) -- ^xGrid
 2988  -> (Word) -- ^yGrid
 2989  -> (Word) -- ^dampingSpecs
 2990  -> (Double) -- ^invEps
 2991  -> (FdmScheme) -> IO ((PricingEngine))
 2992 fdG2SwaptionEngine a1 a2 a3 a4 a5 a6 a7 =
 2993   withG2 a1 $ \a1' -> 
 2994   let {a2' = fromIntegral a2} in 
 2995   let {a3' = fromIntegral a3} in 
 2996   let {a4' = fromIntegral a4} in 
 2997   let {a5' = fromIntegral a5} in 
 2998   let {a6' = realToFrac a6} in 
 2999   withFdmSchemeDesc a7 $ \a7' -> 
 3000   preErrorCheck $ \a8' -> 
 3001   fdG2SwaptionEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 3002   peekPricingEngine res >>= \res' ->
 3003   errorCheck  a8'>>
 3004   return (res')
 3005 
 3006 
 3007 
 3008 -- |finite-differences swaption pricing engine for the Hull-White short-rate model
 3009 fdHullWhiteSwaptionEngine :: (HullWhite) -> (Word) -- ^tGrid
 3010  -> (Word) -- ^xGrid
 3011  -> (Word) -- ^dampingSpecs
 3012  -> (Double) -- ^invEps
 3013  -> (FdmScheme) -> IO ((PricingEngine))
 3014 fdHullWhiteSwaptionEngine a1 a2 a3 a4 a5 a6 =
 3015   withHullWhite a1 $ \a1' -> 
 3016   let {a2' = fromIntegral a2} in 
 3017   let {a3' = fromIntegral a3} in 
 3018   let {a4' = fromIntegral a4} in 
 3019   let {a5' = realToFrac a5} in 
 3020   withFdmSchemeDesc a6 $ \a6' -> 
 3021   preErrorCheck $ \a7' -> 
 3022   fdHullWhiteSwaptionEngine'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 3023   peekPricingEngine res >>= \res' ->
 3024   errorCheck  a7'>>
 3025   return (res')
 3026 
 3027 
 3028 
 3029 -- |finite-differences Black-Scholes barrier-option pricing engine
 3030 fdBlackScholesBarrierEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^tGrid
 3031  -> (Word) -- ^xGrid
 3032  -> (Word) -- ^dampingSteps
 3033  -> (FdmScheme) -> (Bool) -- ^localVol
 3034  -> (Double) -- ^illegalLocalVolOverwrite
 3035  -> IO ((PricingEngine))
 3036 fdBlackScholesBarrierEngine a1 a2 a3 a4 a5 a6 a7 =
 3037   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3038   let {a2' = fromIntegral a2} in 
 3039   let {a3' = fromIntegral a3} in 
 3040   let {a4' = fromIntegral a4} in 
 3041   withFdmSchemeDesc a5 $ \a5' -> 
 3042   let {a6' = C2HSImp.fromBool a6} in 
 3043   let {a7' = realToFrac a7} in 
 3044   preErrorCheck $ \a8' -> 
 3045   fdBlackScholesBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 3046   peekPricingEngine res >>= \res' ->
 3047   errorCheck  a8'>>
 3048   return (res')
 3049 
 3050 
 3051 
 3052 -- |finite-differences Heston-model barrier-option pricing engine
 3053 fdHestonBarrierEngineNoDividends :: (GenHestonModel hm) -> (Word) -- ^tGrid
 3054  -> (Word) -- ^xGrid
 3055  -> (Word) -- ^vGrid
 3056  -> (Word) -- ^dampingSteps
 3057  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 3058  -> (Double) -- ^mixingFactor, upstream default: 1.0
 3059  -> IO ((PricingEngine))
 3060 fdHestonBarrierEngineNoDividends a1 a2 a3 a4 a5 a6 a7 a8 =
 3061   withHestonModel a1 $ \a1' -> 
 3062   let {a2' = fromIntegral a2} in 
 3063   let {a3' = fromIntegral a3} in 
 3064   let {a4' = fromIntegral a4} in 
 3065   let {a5' = fromIntegral a5} in 
 3066   withFdmSchemeDesc a6 $ \a6' -> 
 3067   withMaybeLocalVolTermStructure a7 $ \a7' -> 
 3068   let {a8' = realToFrac a8} in 
 3069   preErrorCheck $ \a9' -> 
 3070   fdHestonBarrierEngineNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 3071   peekPricingEngine res >>= \res' ->
 3072   errorCheck  a9'>>
 3073   return (res')
 3074 
 3075 
 3076 
 3077 -- |finite-differences Heston-model barrier-option pricing engine, with discrete dividends
 3078 fdHestonBarrierEngineWithDividends :: (GenHestonModel hm) -> ([Dividend]) -> (Word) -- ^tGrid
 3079  -> (Word) -- ^xGrid
 3080  -> (Word) -- ^vGrid
 3081  -> (Word) -- ^dampingSteps
 3082  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 3083  -> (Double) -- ^mixingFactor, upstream default: 1.0
 3084  -> IO ((PricingEngine))
 3085 fdHestonBarrierEngineWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3086   withHestonModel a1 $ \a1' -> 
 3087   withDividendArray a2 $ \(a2'1, a2'2) -> 
 3088   let {a3' = fromIntegral a3} in 
 3089   let {a4' = fromIntegral a4} in 
 3090   let {a5' = fromIntegral a5} in 
 3091   let {a6' = fromIntegral a6} in 
 3092   withFdmSchemeDesc a7 $ \a7' -> 
 3093   withMaybeLocalVolTermStructure a8 $ \a8' -> 
 3094   let {a9' = realToFrac a9} in 
 3095   preErrorCheck $ \a10' -> 
 3096   fdHestonBarrierEngineWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3097   peekPricingEngine res >>= \res' ->
 3098   errorCheck  a10'>>
 3099   return (res')
 3100 
 3101 
 3102 
 3103 -- |Finite-difference Heston barrier engine; an empty list selects the no-dividend overload.
 3104 fdHestonBarrierEngine :: GenHestonModel hm -> [Dividend] -> Word -> Word -> Word -> Word
 3105   -> FdmScheme -> Maybe (GenLocalVolTermStructure lv) -> Double -> IO PricingEngine
 3106 fdHestonBarrierEngine model dividends =
 3107   case dividends of
 3108     [] -> fdHestonBarrierEngineNoDividends model
 3109     _ -> fdHestonBarrierEngineWithDividends model dividends
 3110 
 3111 -- |finite-differences Heston-model double-barrier-option pricing engine
 3112 fdHestonDoubleBarrierEngine :: (GenHestonModel hm) -> (Word) -- ^tGrid
 3113  -> (Word) -- ^xGrid
 3114  -> (Word) -- ^vGrid
 3115  -> (Word) -- ^dampingSteps
 3116  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 3117  -> (Double) -- ^mixingFactor, upstream default: 1.0
 3118  -> IO ((PricingEngine))
 3119 fdHestonDoubleBarrierEngine a1 a2 a3 a4 a5 a6 a7 a8 =
 3120   withHestonModel a1 $ \a1' -> 
 3121   let {a2' = fromIntegral a2} in 
 3122   let {a3' = fromIntegral a3} in 
 3123   let {a4' = fromIntegral a4} in 
 3124   let {a5' = fromIntegral a5} in 
 3125   withFdmSchemeDesc a6 $ \a6' -> 
 3126   withMaybeLocalVolTermStructure a7 $ \a7' -> 
 3127   let {a8' = realToFrac a8} in 
 3128   preErrorCheck $ \a9' -> 
 3129   fdHestonDoubleBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 3130   peekPricingEngine res >>= \res' ->
 3131   errorCheck  a9'>>
 3132   return (res')
 3133 
 3134 
 3135 
 3136 -- |/NB/ every Monte Carlo engine in this module is C++-templated on both an RNG policy and a
 3137 -- statistics accumulator; all of them (bar 'mcAmericanBasketEngine', see its own doc comment)
 3138 -- take an explicit 'StatisticsTrait' argument for the latter, letting the caller pick
 3139 -- 'Statistics'\/'GaussianStatistics'\/'GeneralStatistics'\/'IncrementalStatistics' instead of being
 3140 -- pinned to upstream's default @Statistics@.
 3141 mcHestonHullWhiteEngine :: (RngTrait) -> (StatisticsTrait) -> (HybridHestonHullWhiteProcess) -> (Maybe Word) -- ^timeSteps
 3142  -> (Maybe Word) -- ^timStepsPerYear
 3143  -> (Bool) -- ^antitheticVariate
 3144  -> (Bool) -- ^controlVariate
 3145  -> (Maybe Word) -- ^requiredSamples
 3146  -> (Maybe Double) -- ^requiredTolerance
 3147  -> (Maybe Word) -- ^maxSamples
 3148  -> (Word) -- ^seed
 3149  -> IO ((PricingEngine))
 3150 mcHestonHullWhiteEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3151   let {a1' = (fromIntegral . fromEnum) a1} in 
 3152   let {a2' = (fromIntegral . fromEnum) a2} in 
 3153   withGenStochasticProcess a3 $ \a3' -> 
 3154   let {a4' = fromMaybeInt a4} in 
 3155   let {a5' = fromMaybeInt a5} in 
 3156   let {a6' = C2HSImp.fromBool a6} in 
 3157   let {a7' = C2HSImp.fromBool a7} in 
 3158   let {a8' = fromMaybeInt a8} in 
 3159   let {a9' = fromMaybeDouble a9} in 
 3160   let {a10' = fromMaybeInt a10} in 
 3161   let {a11' = fromIntegral a11} in 
 3162   preErrorCheck $ \a12' -> 
 3163   mcHestonHullWhiteEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3164   peekPricingEngine res >>= \res' ->
 3165   errorCheck  a12'>>
 3166   return (res')
 3167 
 3168 
 3169 
 3170 -- |Monte Carlo (least-squares) pricing engine for American options
 3171 mcAmericanEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -> (Maybe Word) -- ^timeStepsPerYear
 3172  -> (Bool) -- ^antitheticVariate
 3173  -> (Bool) -- ^controlVariate
 3174  -> (Maybe Word) -- ^requiredSamples
 3175  -> (Maybe Double) -- ^requiredTolerance
 3176  -> (Maybe Word) -- ^maxSamples
 3177  -> (Word) -- ^seed
 3178  -> (Word) -- ^polynomOrder
 3179  -> (PolynomialType) -> (Maybe Word) -- ^nCalibrationSamples
 3180  -> (Maybe Bool) -- ^antitheticVariateCalibration
 3181  -> (Maybe Word) -- ^seedCalibration
 3182  -> IO ((PricingEngine))
 3183 mcAmericanEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
 3184   let {a1' = (fromIntegral . fromEnum) a1} in 
 3185   let {a2' = (fromIntegral . fromEnum) a2} in 
 3186   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3187   let {a4' = fromMaybeInt a4} in 
 3188   let {a5' = fromMaybeInt a5} in 
 3189   let {a6' = C2HSImp.fromBool a6} in 
 3190   let {a7' = C2HSImp.fromBool a7} in 
 3191   let {a8' = fromMaybeInt a8} in 
 3192   let {a9' = fromMaybeDouble a9} in 
 3193   let {a10' = fromMaybeInt a10} in 
 3194   let {a11' = fromIntegral a11} in 
 3195   let {a12' = fromIntegral a12} in 
 3196   let {a13' = (fromIntegral . fromEnum) a13} in 
 3197   let {a14' = fromMaybeInt a14} in 
 3198   let {a15' = fromMaybeBool a15} in 
 3199   let {a16' = fromMaybeInt a16} in 
 3200   preErrorCheck $ \a17' -> 
 3201   mcAmericanEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' >>= \res ->
 3202   peekPricingEngine res >>= \res' ->
 3203   errorCheck  a17'>>
 3204   return (res')
 3205 
 3206 
 3207 
 3208 -- |Monte Carlo pricing engine for barrier options
 3209 mcBarrierEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 3210  -> (Maybe Word) -- ^timeStepsPerYear
 3211  -> (Bool) -- ^brownianBridge
 3212  -> (Bool) -- ^antitheticVariate
 3213  -> (Maybe Word) -- ^requiredSamples
 3214  -> (Maybe Double) -- ^requiredTolerance
 3215  -> (Maybe Word) -- ^maxSamples
 3216  -> (Bool) -- ^isBiased
 3217  -> (Word) -- ^seed
 3218  -> IO ((PricingEngine))
 3219 mcBarrierEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
 3220   let {a1' = (fromIntegral . fromEnum) a1} in 
 3221   let {a2' = (fromIntegral . fromEnum) a2} in 
 3222   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3223   let {a4' = fromMaybeInt a4} in 
 3224   let {a5' = fromMaybeInt a5} in 
 3225   let {a6' = C2HSImp.fromBool a6} in 
 3226   let {a7' = C2HSImp.fromBool a7} in 
 3227   let {a8' = fromMaybeInt a8} in 
 3228   let {a9' = fromMaybeDouble a9} in 
 3229   let {a10' = fromMaybeInt a10} in 
 3230   let {a11' = C2HSImp.fromBool a11} in 
 3231   let {a12' = fromIntegral a12} in 
 3232   preErrorCheck $ \a13' -> 
 3233   mcBarrierEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' >>= \res ->
 3234   peekPricingEngine res >>= \res' ->
 3235   errorCheck  a13'>>
 3236   return (res')
 3237 
 3238 
 3239 
 3240 -- |Monte Carlo pricing engine for digital (cash-or-nothing/asset-or-nothing) options
 3241 mcDigitalEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 3242  -> (Maybe Word) -> (Bool) -> (Bool) -> (Maybe Word) -- ^requiredSamples
 3243  -> (Maybe Double) -- ^requiredTolerance
 3244  -> (Maybe Word) -- ^maxSamples
 3245  -> (Word) -- ^seed
 3246  -> IO ((PricingEngine))
 3247 mcDigitalEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3248   let {a1' = (fromIntegral . fromEnum) a1} in 
 3249   let {a2' = (fromIntegral . fromEnum) a2} in 
 3250   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3251   let {a4' = fromMaybeInt a4} in 
 3252   let {a5' = fromMaybeInt a5} in 
 3253   let {a6' = C2HSImp.fromBool a6} in 
 3254   let {a7' = C2HSImp.fromBool a7} in 
 3255   let {a8' = fromMaybeInt a8} in 
 3256   let {a9' = fromMaybeDouble a9} in 
 3257   let {a10' = fromMaybeInt a10} in 
 3258   let {a11' = fromIntegral a11} in 
 3259   preErrorCheck $ \a12' -> 
 3260   mcDigitalEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3261   peekPricingEngine res >>= \res' ->
 3262   errorCheck  a12'>>
 3263   return (res')
 3264 
 3265 
 3266 
 3267 -- |Monte Carlo pricing engine for discrete arithmetic average-price Asian options
 3268 mcDiscreteArithmeticApEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Bool) -- ^brownianBridge
 3269  -> (Bool) -- ^antitheticVariate
 3270  -> (Bool) -- ^controlVariate
 3271  -> (Maybe Word) -- ^requiredSamples
 3272  -> (Maybe Double) -- ^requiredTolerance
 3273  -> (Maybe Word) -- ^maxSamples
 3274  -> (Word) -- ^seed
 3275  -> IO ((PricingEngine))
 3276 mcDiscreteArithmeticApEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 3277   let {a1' = (fromIntegral . fromEnum) a1} in 
 3278   let {a2' = (fromIntegral . fromEnum) a2} in 
 3279   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3280   let {a4' = C2HSImp.fromBool a4} in 
 3281   let {a5' = C2HSImp.fromBool a5} in 
 3282   let {a6' = C2HSImp.fromBool a6} in 
 3283   let {a7' = fromMaybeInt a7} in 
 3284   let {a8' = fromMaybeDouble a8} in 
 3285   let {a9' = fromMaybeInt a9} in 
 3286   let {a10' = fromIntegral a10} in 
 3287   preErrorCheck $ \a11' -> 
 3288   mcDiscreteArithmeticApEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 3289   peekPricingEngine res >>= \res' ->
 3290   errorCheck  a11'>>
 3291   return (res')
 3292 
 3293 
 3294 
 3295 -- |Monte Carlo pricing engine for discrete arithmetic average-strike Asian options
 3296 mcDiscreteArithmeticAsEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Bool) -- ^brownianBridge
 3297  -> (Bool) -- ^antitheticVariate
 3298  -> (Maybe Word) -- ^requiredSamples
 3299  -> (Maybe Double) -- ^requiredTolerance
 3300  -> (Maybe Word) -- ^maxSamples
 3301  -> (Word) -- ^seed
 3302  -> IO ((PricingEngine))
 3303 mcDiscreteArithmeticAsEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3304   let {a1' = (fromIntegral . fromEnum) a1} in 
 3305   let {a2' = (fromIntegral . fromEnum) a2} in 
 3306   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3307   let {a4' = C2HSImp.fromBool a4} in 
 3308   let {a5' = C2HSImp.fromBool a5} in 
 3309   let {a6' = fromMaybeInt a6} in 
 3310   let {a7' = fromMaybeDouble a7} in 
 3311   let {a8' = fromMaybeInt a8} in 
 3312   let {a9' = fromIntegral a9} in 
 3313   preErrorCheck $ \a10' -> 
 3314   mcDiscreteArithmeticAsEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3315   peekPricingEngine res >>= \res' ->
 3316   errorCheck  a10'>>
 3317   return (res')
 3318 
 3319 
 3320 
 3321 -- |Monte Carlo pricing engine for discrete geometric average-price Asian options
 3322 mcDiscreteGeometricApEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Bool) -- ^brownianBridge
 3323  -> (Bool) -- ^antitheticVariate
 3324  -> (Maybe Word) -- ^requiredSamples
 3325  -> (Maybe Double) -- ^requiredTolerance
 3326  -> (Maybe Word) -- ^maxSamples
 3327  -> (Word) -- ^seed
 3328  -> IO ((PricingEngine))
 3329 mcDiscreteGeometricApEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3330   let {a1' = (fromIntegral . fromEnum) a1} in 
 3331   let {a2' = (fromIntegral . fromEnum) a2} in 
 3332   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3333   let {a4' = C2HSImp.fromBool a4} in 
 3334   let {a5' = C2HSImp.fromBool a5} in 
 3335   let {a6' = fromMaybeInt a6} in 
 3336   let {a7' = fromMaybeDouble a7} in 
 3337   let {a8' = fromMaybeInt a8} in 
 3338   let {a9' = fromIntegral a9} in 
 3339   preErrorCheck $ \a10' -> 
 3340   mcDiscreteGeometricApEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3341   peekPricingEngine res >>= \res' ->
 3342   errorCheck  a10'>>
 3343   return (res')
 3344 
 3345 
 3346 
 3347 -- |Monte Carlo pricing engine for discrete arithmetic average-price Asian options under the
 3348 -- Heston stochastic-volatility model.  Uses one time step per fixing date unless /timeSteps/ or
 3349 -- /timeStepsPerYear/ overrides the grid. When /controlVariate/ is true, prices the same path
 3350 -- against 'analyticDiscreteGeometricAveragePriceAsianHestonEngine' as a control variate.
 3351 mcDiscreteArithmeticApHestonEngine :: (RngTrait) -> (StatisticsTrait) -> (GenHestonProcess hp) -> (Bool) -- ^antitheticVariate
 3352  -> (Maybe Word) -- ^requiredSamples
 3353  -> (Maybe Double) -- ^requiredTolerance
 3354  -> (Maybe Word) -- ^maxSamples
 3355  -> (Word) -- ^seed
 3356  -> (Maybe Word) -- ^timeSteps
 3357  -> (Maybe Word) -- ^timeStepsPerYear
 3358  -> (Bool) -- ^controlVariate
 3359  -> IO ((PricingEngine))
 3360 mcDiscreteArithmeticApHestonEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3361   let {a1' = (fromIntegral . fromEnum) a1} in 
 3362   let {a2' = (fromIntegral . fromEnum) a2} in 
 3363   withHestonProcess a3 $ \a3' -> 
 3364   let {a4' = C2HSImp.fromBool a4} in 
 3365   let {a5' = fromMaybeInt a5} in 
 3366   let {a6' = fromMaybeDouble a6} in 
 3367   let {a7' = fromMaybeInt a7} in 
 3368   let {a8' = fromIntegral a8} in 
 3369   let {a9' = fromMaybeInt a9} in 
 3370   let {a10' = fromMaybeInt a10} in 
 3371   let {a11' = C2HSImp.fromBool a11} in 
 3372   preErrorCheck $ \a12' -> 
 3373   mcDiscreteArithmeticApHestonEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3374   peekPricingEngine res >>= \res' ->
 3375   errorCheck  a12'>>
 3376   return (res')
 3377 
 3378 
 3379 
 3380 -- |Monte Carlo pricing engine for discrete geometric average-price Asian options under the
 3381 -- Heston stochastic-volatility model.  Uses one time step per fixing date unless /timeSteps/ or
 3382 -- /timeStepsPerYear/ overrides the grid.
 3383 mcDiscreteGeometricApHestonEngine :: (RngTrait) -> (StatisticsTrait) -> (GenHestonProcess hp) -> (Bool) -- ^antitheticVariate
 3384  -> (Maybe Word) -- ^requiredSamples
 3385  -> (Maybe Double) -- ^requiredTolerance
 3386  -> (Maybe Word) -- ^maxSamples
 3387  -> (Word) -- ^seed
 3388  -> (Maybe Word) -- ^timeSteps
 3389  -> (Maybe Word) -- ^timeStepsPerYear
 3390  -> IO ((PricingEngine))
 3391 mcDiscreteGeometricApHestonEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 3392   let {a1' = (fromIntegral . fromEnum) a1} in 
 3393   let {a2' = (fromIntegral . fromEnum) a2} in 
 3394   withHestonProcess a3 $ \a3' -> 
 3395   let {a4' = C2HSImp.fromBool a4} in 
 3396   let {a5' = fromMaybeInt a5} in 
 3397   let {a6' = fromMaybeDouble a6} in 
 3398   let {a7' = fromMaybeInt a7} in 
 3399   let {a8' = fromIntegral a8} in 
 3400   let {a9' = fromMaybeInt a9} in 
 3401   let {a10' = fromMaybeInt a10} in 
 3402   preErrorCheck $ \a11' -> 
 3403   mcDiscreteGeometricApHestonEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 3404   peekPricingEngine res >>= \res' ->
 3405   errorCheck  a11'>>
 3406   return (res')
 3407 
 3408 
 3409 
 3410 -- |Monte Carlo pricing engine for European options under a Black-Scholes process
 3411 mcEuropeanEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 3412  -> (Maybe Word) -- ^timeStepsPerYear
 3413  -> (Bool) -- ^brownianBridge
 3414  -> (Bool) -- ^antitheticVariate
 3415  -> (Maybe Word) -- ^requiredSamples
 3416  -> (Maybe Double) -- ^requiredTolerance
 3417  -> (Maybe Word) -- ^maxSamples
 3418  -> (Word) -- ^seed
 3419  -> IO ((PricingEngine))
 3420 mcEuropeanEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3421   let {a1' = (fromIntegral . fromEnum) a1} in 
 3422   let {a2' = (fromIntegral . fromEnum) a2} in 
 3423   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3424   let {a4' = fromMaybeInt a4} in 
 3425   let {a5' = fromMaybeInt a5} in 
 3426   let {a6' = C2HSImp.fromBool a6} in 
 3427   let {a7' = C2HSImp.fromBool a7} in 
 3428   let {a8' = fromMaybeInt a8} in 
 3429   let {a9' = fromMaybeDouble a9} in 
 3430   let {a10' = fromMaybeInt a10} in 
 3431   let {a11' = fromIntegral a11} in 
 3432   preErrorCheck $ \a12' -> 
 3433   mcEuropeanEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3434   peekPricingEngine res >>= \res' ->
 3435   errorCheck  a12'>>
 3436   return (res')
 3437 
 3438 
 3439 
 3440 -- |Monte Carlo pricing engine for European options under a GJR-GARCH process
 3441 mcEuropeanGjrGarchEngine :: (RngTrait) -> (StatisticsTrait) -> (GJRGARCHProcess) -> (Maybe Word) -- ^timeSteps
 3442  -> (Maybe Word) -- ^timeStepsPerYear
 3443  -> (Bool) -- ^antitheticVariate
 3444  -> (Maybe Word) -- ^requiredSamples
 3445  -> (Maybe Double) -- ^requiredTolerance
 3446  -> (Maybe Word) -- ^maxSamples
 3447  -> (Word) -- ^seed
 3448  -> IO ((PricingEngine))
 3449 mcEuropeanGjrGarchEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 3450   let {a1' = (fromIntegral . fromEnum) a1} in 
 3451   let {a2' = (fromIntegral . fromEnum) a2} in 
 3452   withGenStochasticProcess a3 $ \a3' -> 
 3453   let {a4' = fromMaybeInt a4} in 
 3454   let {a5' = fromMaybeInt a5} in 
 3455   let {a6' = C2HSImp.fromBool a6} in 
 3456   let {a7' = fromMaybeInt a7} in 
 3457   let {a8' = fromMaybeDouble a8} in 
 3458   let {a9' = fromMaybeInt a9} in 
 3459   let {a10' = fromIntegral a10} in 
 3460   preErrorCheck $ \a11' -> 
 3461   mcEuropeanGjrGarchEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 3462   peekPricingEngine res >>= \res' ->
 3463   errorCheck  a11'>>
 3464   return (res')
 3465 
 3466 
 3467 
 3468 -- |Monte Carlo pricing engine for European options under a Heston process
 3469 mcEuropeanHestonEngine :: (RngTrait) -> (StatisticsTrait) -> (GenHestonProcess hp) -> (Maybe Word) -- ^timeSteps
 3470  -> (Maybe Word) -- ^timeStepsPerYear
 3471  -> (Bool) -- ^antitheticVariate
 3472  -> (Maybe Word) -- ^requiredSamples
 3473  -> (Maybe Double) -- ^requiredTolerance
 3474  -> (Maybe Word) -- ^maxSamples
 3475  -> (Word) -- ^seed
 3476  -> IO ((PricingEngine))
 3477 mcEuropeanHestonEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 3478   let {a1' = (fromIntegral . fromEnum) a1} in 
 3479   let {a2' = (fromIntegral . fromEnum) a2} in 
 3480   withHestonProcess a3 $ \a3' -> 
 3481   let {a4' = fromMaybeInt a4} in 
 3482   let {a5' = fromMaybeInt a5} in 
 3483   let {a6' = C2HSImp.fromBool a6} in 
 3484   let {a7' = fromMaybeInt a7} in 
 3485   let {a8' = fromMaybeDouble a8} in 
 3486   let {a9' = fromMaybeInt a9} in 
 3487   let {a10' = fromIntegral a10} in 
 3488   preErrorCheck $ \a11' -> 
 3489   mcEuropeanHestonEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 3490   peekPricingEngine res >>= \res' ->
 3491   errorCheck  a11'>>
 3492   return (res')
 3493 
 3494 
 3495 
 3496 -- |Prices a 'VarianceOption' by integrating its payoff against the Heston-model transition density.
 3497 integralHestonVarianceOptionEngine :: (GenHestonProcess hp) -> IO ((PricingEngine))
 3498 integralHestonVarianceOptionEngine a1 =
 3499   withHestonProcess a1 $ \a1' -> 
 3500   preErrorCheck $ \a2' -> 
 3501   integralHestonVarianceOptionEngine'_ a1' a2' >>= \res ->
 3502   peekPricingEngine res >>= \res' ->
 3503   errorCheck  a2'>>
 3504   return (res')
 3505 
 3506 
 3507 
 3508 -- |Monte Carlo Hull-White pricing engine for caps\/floors
 3509 mcHullWhiteCapFloorEngine :: (RngTrait) -> (StatisticsTrait) -> (HullWhite) -> (Bool) -- ^brownianBridge
 3510  -> (Bool) -- ^antitheticVariate
 3511  -> (Maybe Word) -- ^requiredSamples
 3512  -> (Maybe Double) -- ^requiredTolerance
 3513  -> (Maybe Word) -- ^maxSamples
 3514  -> (Word) -- ^seed
 3515  -> IO ((PricingEngine))
 3516 mcHullWhiteCapFloorEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3517   let {a1' = (fromIntegral . fromEnum) a1} in 
 3518   let {a2' = (fromIntegral . fromEnum) a2} in 
 3519   withHullWhite a3 $ \a3' -> 
 3520   let {a4' = C2HSImp.fromBool a4} in 
 3521   let {a5' = C2HSImp.fromBool a5} in 
 3522   let {a6' = fromMaybeInt a6} in 
 3523   let {a7' = fromMaybeDouble a7} in 
 3524   let {a8' = fromMaybeInt a8} in 
 3525   let {a9' = fromIntegral a9} in 
 3526   preErrorCheck $ \a10' -> 
 3527   mcHullWhiteCapFloorEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3528   peekPricingEngine res >>= \res' ->
 3529   errorCheck  a10'>>
 3530   return (res')
 3531 
 3532 
 3533 
 3534 -- |Monte Carlo pricing engine for 'himalayaOption'
 3535 mcHimalayaEngine :: (RngTrait) -> (StatisticsTrait) -> (StochasticProcessArray) -> (Bool) -- ^brownianBridge
 3536  -> (Bool) -- ^antitheticVariate
 3537  -> (Maybe Word) -- ^requiredSamples
 3538  -> (Maybe Double) -- ^requiredTolerance
 3539  -> (Maybe Word) -- ^maxSamples
 3540  -> (Word) -- ^seed
 3541  -> IO ((PricingEngine))
 3542 mcHimalayaEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3543   let {a1' = (fromIntegral . fromEnum) a1} in 
 3544   let {a2' = (fromIntegral . fromEnum) a2} in 
 3545   withGenStochasticProcess a3 $ \a3' -> 
 3546   let {a4' = C2HSImp.fromBool a4} in 
 3547   let {a5' = C2HSImp.fromBool a5} in 
 3548   let {a6' = fromMaybeInt a6} in 
 3549   let {a7' = fromMaybeDouble a7} in 
 3550   let {a8' = fromMaybeInt a8} in 
 3551   let {a9' = fromIntegral a9} in 
 3552   preErrorCheck $ \a10' -> 
 3553   mcHimalayaEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3554   peekPricingEngine res >>= \res' ->
 3555   errorCheck  a10'>>
 3556   return (res')
 3557 
 3558 
 3559 
 3560 -- |Monte Carlo pricing engine for 'pagodaOption'
 3561 mcPagodaEngine :: (RngTrait) -> (StatisticsTrait) -> (StochasticProcessArray) -> (Bool) -- ^brownianBridge
 3562  -> (Bool) -- ^antitheticVariate
 3563  -> (Maybe Word) -- ^requiredSamples
 3564  -> (Maybe Double) -- ^requiredTolerance
 3565  -> (Maybe Word) -- ^maxSamples
 3566  -> (Word) -- ^seed
 3567  -> IO ((PricingEngine))
 3568 mcPagodaEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3569   let {a1' = (fromIntegral . fromEnum) a1} in 
 3570   let {a2' = (fromIntegral . fromEnum) a2} in 
 3571   withGenStochasticProcess a3 $ \a3' -> 
 3572   let {a4' = C2HSImp.fromBool a4} in 
 3573   let {a5' = C2HSImp.fromBool a5} in 
 3574   let {a6' = fromMaybeInt a6} in 
 3575   let {a7' = fromMaybeDouble a7} in 
 3576   let {a8' = fromMaybeInt a8} in 
 3577   let {a9' = fromIntegral a9} in 
 3578   preErrorCheck $ \a10' -> 
 3579   mcPagodaEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3580   peekPricingEngine res >>= \res' ->
 3581   errorCheck  a10'>>
 3582   return (res')
 3583 
 3584 
 3585 
 3586 -- |Monte Carlo pricing engine for a European 'basketOption'.
 3587 mcEuropeanBasketEngine :: (RngTrait) -> (StatisticsTrait) -> (StochasticProcessArray) -> (Maybe Word) -- ^timeSteps
 3588  -> (Maybe Word) -- ^timeStepsPerYear
 3589  -> (Bool) -- ^brownianBridge
 3590  -> (Bool) -- ^antitheticVariate
 3591  -> (Maybe Word) -- ^requiredSamples
 3592  -> (Maybe Double) -- ^requiredTolerance
 3593  -> (Maybe Word) -- ^maxSamples
 3594  -> (Word) -- ^seed
 3595  -> IO ((PricingEngine))
 3596 mcEuropeanBasketEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3597   let {a1' = (fromIntegral . fromEnum) a1} in 
 3598   let {a2' = (fromIntegral . fromEnum) a2} in 
 3599   withGenStochasticProcess a3 $ \a3' -> 
 3600   let {a4' = fromMaybeInt a4} in 
 3601   let {a5' = fromMaybeInt a5} in 
 3602   let {a6' = C2HSImp.fromBool a6} in 
 3603   let {a7' = C2HSImp.fromBool a7} in 
 3604   let {a8' = fromMaybeInt a8} in 
 3605   let {a9' = fromMaybeDouble a9} in 
 3606   let {a10' = fromMaybeInt a10} in 
 3607   let {a11' = fromIntegral a11} in 
 3608   preErrorCheck $ \a12' -> 
 3609   mcEuropeanBasketEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3610   peekPricingEngine res >>= \res' ->
 3611   errorCheck  a12'>>
 3612   return (res')
 3613 
 3614 
 3615 
 3616 -- |Monte Carlo pricing engine for 'everestOption'. Exactly one of @timeSteps@\/@timeStepsPerYear@ must be given.
 3617 mcEverestEngine :: (RngTrait) -> (StatisticsTrait) -> (StochasticProcessArray) -> (Maybe Word) -- ^timeSteps
 3618  -> (Maybe Word) -- ^timeStepsPerYear
 3619  -> (Bool) -- ^brownianBridge
 3620  -> (Bool) -- ^antitheticVariate
 3621  -> (Maybe Word) -- ^requiredSamples
 3622  -> (Maybe Double) -- ^requiredTolerance
 3623  -> (Maybe Word) -- ^maxSamples
 3624  -> (Word) -- ^seed
 3625  -> IO ((PricingEngine))
 3626 mcEverestEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3627   let {a1' = (fromIntegral . fromEnum) a1} in 
 3628   let {a2' = (fromIntegral . fromEnum) a2} in 
 3629   withGenStochasticProcess a3 $ \a3' -> 
 3630   let {a4' = fromMaybeInt a4} in 
 3631   let {a5' = fromMaybeInt a5} in 
 3632   let {a6' = C2HSImp.fromBool a6} in 
 3633   let {a7' = C2HSImp.fromBool a7} in 
 3634   let {a8' = fromMaybeInt a8} in 
 3635   let {a9' = fromMaybeDouble a9} in 
 3636   let {a10' = fromMaybeInt a10} in 
 3637   let {a11' = fromIntegral a11} in 
 3638   preErrorCheck $ \a12' -> 
 3639   mcEverestEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3640   peekPricingEngine res >>= \res' ->
 3641   errorCheck  a12'>>
 3642   return (res')
 3643 
 3644 
 3645 
 3646 -- |Monte Carlo (least-squares) pricing engine for an American 'basketOption'. /NB/ unlike every
 3647 -- other MC engine in this module, this one has no 'StatisticsTrait' parameter: upstream's
 3648 -- @MCAmericanBasketEngine\<RNG\>@ is templated on @RNG@ only -- its base
 3649 -- @MCLongstaffSchwartzEngine\<BasketOption::engine,MultiVariate,RNG\>@ never forwards a second
 3650 -- template argument, so there is no @S@ to expose here (a real upstream limitation, not an
 3651 -- oversight).
 3652 mcAmericanBasketEngine :: (RngTrait) -> (StochasticProcessArray) -> (Maybe Word) -- ^timeSteps
 3653  -> (Maybe Word) -- ^timeStepsPerYear
 3654  -> (Bool) -- ^brownianBridge
 3655  -> (Bool) -- ^antitheticVariate
 3656  -> (Maybe Word) -- ^requiredSamples
 3657  -> (Maybe Double) -- ^requiredTolerance
 3658  -> (Maybe Word) -- ^maxSamples
 3659  -> (Word) -- ^seed
 3660  -> (Maybe Word) -- ^nCalibrationSamples
 3661  -> (Word) -- ^polynomialOrder
 3662  -> (PolynomialType) -- ^polynomialType
 3663  -> IO ((PricingEngine))
 3664 mcAmericanBasketEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
 3665   let {a1' = (fromIntegral . fromEnum) a1} in 
 3666   withGenStochasticProcess a2 $ \a2' -> 
 3667   let {a3' = fromMaybeInt a3} in 
 3668   let {a4' = fromMaybeInt a4} in 
 3669   let {a5' = C2HSImp.fromBool a5} in 
 3670   let {a6' = C2HSImp.fromBool a6} in 
 3671   let {a7' = fromMaybeInt a7} in 
 3672   let {a8' = fromMaybeDouble a8} in 
 3673   let {a9' = fromMaybeInt a9} in 
 3674   let {a10' = fromIntegral a10} in 
 3675   let {a11' = fromMaybeInt a11} in 
 3676   let {a12' = fromIntegral a12} in 
 3677   let {a13' = (fromIntegral . fromEnum) a13} in 
 3678   preErrorCheck $ \a14' -> 
 3679   mcAmericanBasketEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' >>= \res ->
 3680   peekPricingEngine res >>= \res' ->
 3681   errorCheck  a14'>>
 3682   return (res')
 3683 
 3684 
 3685 
 3686 -- |Monte Carlo pricing engine for performance (return) options
 3687 mcPerformanceEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Bool) -- ^brownianBridge
 3688  -> (Bool) -- ^antitheticVariate
 3689  -> (Maybe Word) -- ^requiredSamples
 3690  -> (Maybe Double) -- ^requiredTolerance
 3691  -> (Maybe Word) -- ^maxSamples
 3692  -> (Word) -- ^seed
 3693  -> IO ((PricingEngine))
 3694 mcPerformanceEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3695   let {a1' = (fromIntegral . fromEnum) a1} in 
 3696   let {a2' = (fromIntegral . fromEnum) a2} in 
 3697   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3698   let {a4' = C2HSImp.fromBool a4} in 
 3699   let {a5' = C2HSImp.fromBool a5} in 
 3700   let {a6' = fromMaybeInt a6} in 
 3701   let {a7' = fromMaybeDouble a7} in 
 3702   let {a8' = fromMaybeInt a8} in 
 3703   let {a9' = fromIntegral a9} in 
 3704   preErrorCheck $ \a10' -> 
 3705   mcPerformanceEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3706   peekPricingEngine res >>= \res' ->
 3707   errorCheck  a10'>>
 3708   return (res')
 3709 
 3710 
 3711 
 3712 -- |variance-swap pricing engine using Monte Carlo simulation (see the note above
 3713 -- 'mcHestonHullWhiteEngine' for the 'StatisticsTrait' parameter shared by every MC engine here).
 3714 mcVarianceSwapEngine :: (RngTrait) -> (StatisticsTrait) -> (GenGeneralizedBlackScholesProcess gbs) -> (Maybe Word) -- ^timeSteps
 3715  -> (Maybe Word) -- ^timeStepsPerYear
 3716  -> (Bool) -- ^brownianBridge
 3717  -> (Bool) -- ^antitheticVariate
 3718  -> (Maybe Word) -- ^requiredSamples
 3719  -> (Maybe Double) -- ^requiredTolerance
 3720  -> (Maybe Word) -- ^maxSamples
 3721  -> (Word) -- ^seed
 3722  -> IO ((PricingEngine))
 3723 mcVarianceSwapEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 3724   let {a1' = (fromIntegral . fromEnum) a1} in 
 3725   let {a2' = (fromIntegral . fromEnum) a2} in 
 3726   withGeneralizedBlackScholesProcess a3 $ \a3' -> 
 3727   let {a4' = fromMaybeInt a4} in 
 3728   let {a5' = fromMaybeInt a5} in 
 3729   let {a6' = C2HSImp.fromBool a6} in 
 3730   let {a7' = C2HSImp.fromBool a7} in 
 3731   let {a8' = fromMaybeInt a8} in 
 3732   let {a9' = fromMaybeDouble a9} in 
 3733   let {a10' = fromMaybeInt a10} in 
 3734   let {a11' = fromIntegral a11} in 
 3735   preErrorCheck $ \a12' -> 
 3736   mcVarianceSwapEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 3737   peekPricingEngine res >>= \res' ->
 3738   errorCheck  a12'>>
 3739   return (res')
 3740 
 3741 
 3742 
 3743 -- |pricing engine for vanilla options using binomial trees
 3744 binomialVanillaEngine :: (BinomialTree) -> (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^timeSteps
 3745  -> IO ((PricingEngine))
 3746 binomialVanillaEngine a1 a2 a3 =
 3747   let {a1' = (fromIntegral . fromEnum) a1} in 
 3748   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 3749   let {a3' = fromIntegral a3} in 
 3750   preErrorCheck $ \a4' -> 
 3751   binomialVanillaEngine'_ a1' a2' a3' a4' >>= \res ->
 3752   peekPricingEngine res >>= \res' ->
 3753   errorCheck  a4'>>
 3754   return (res')
 3755 
 3756 
 3757 
 3758 -- |finite-differences Black-Scholes pricing engine for discrete-averaging Asian options
 3759 fdBlackScholesAsianEngine :: (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^tGrid
 3760  -> (Word) -- ^xGrid
 3761  -> (Word) -- ^aGrid
 3762  -> (FdmScheme) -> IO ((PricingEngine))
 3763 fdBlackScholesAsianEngine a1 a2 a3 a4 a5 =
 3764   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3765   let {a2' = fromIntegral a2} in 
 3766   let {a3' = fromIntegral a3} in 
 3767   let {a4' = fromIntegral a4} in 
 3768   withFdmSchemeDesc a5 $ \a5' -> 
 3769   preErrorCheck $ \a6' -> 
 3770   fdBlackScholesAsianEngine'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 3771   peekPricingEngine res >>= \res' ->
 3772   errorCheck  a6'>>
 3773   return (res')
 3774 
 3775 
 3776 
 3777 -- |finite-differences Black-Scholes pricing engine for vanilla options
 3778 fdBlackScholesVanillaEngineNoDividends :: (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^timeSteps
 3779  -> (Word) -- ^gridPoints
 3780  -> (Word) -- ^timeDependent
 3781  -> (FdmScheme) -> (Bool) -- ^localVol
 3782  -> (Double) -- ^illegalLocalVolOverwrite
 3783  -> (CashDividendModel) -- ^cashDividendModel
 3784  -> IO ((PricingEngine))
 3785 fdBlackScholesVanillaEngineNoDividends a1 a2 a3 a4 a5 a6 a7 a8 =
 3786   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3787   let {a2' = fromIntegral a2} in 
 3788   let {a3' = fromIntegral a3} in 
 3789   let {a4' = fromIntegral a4} in 
 3790   withFdmSchemeDesc a5 $ \a5' -> 
 3791   let {a6' = C2HSImp.fromBool a6} in 
 3792   let {a7' = realToFrac a7} in 
 3793   let {a8' = (fromIntegral . fromEnum) a8} in 
 3794   preErrorCheck $ \a9' -> 
 3795   fdBlackScholesVanillaEngineNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 3796   peekPricingEngine res >>= \res' ->
 3797   errorCheck  a9'>>
 3798   return (res')
 3799 
 3800 
 3801 
 3802 -- |finite-differences Black-Scholes pricing engine for vanilla options, with discrete dividends
 3803 fdBlackScholesVanillaEngineWithDividends :: (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -> (Word) -- ^timeSteps
 3804  -> (Word) -- ^gridPoints
 3805  -> (Word) -- ^timeDependent
 3806  -> (FdmScheme) -> (Bool) -- ^localVol
 3807  -> (Double) -- ^illegalLocalVolOverwrite
 3808  -> (CashDividendModel) -- ^cashDividendModel
 3809  -> IO ((PricingEngine))
 3810 fdBlackScholesVanillaEngineWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3811   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3812   withDividendArray a2 $ \(a2'1, a2'2) -> 
 3813   let {a3' = fromIntegral a3} in 
 3814   let {a4' = fromIntegral a4} in 
 3815   let {a5' = fromIntegral a5} in 
 3816   withFdmSchemeDesc a6 $ \a6' -> 
 3817   let {a7' = C2HSImp.fromBool a7} in 
 3818   let {a8' = realToFrac a8} in 
 3819   let {a9' = (fromIntegral . fromEnum) a9} in 
 3820   preErrorCheck $ \a10' -> 
 3821   fdBlackScholesVanillaEngineWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3822   peekPricingEngine res >>= \res' ->
 3823   errorCheck  a10'>>
 3824   return (res')
 3825 
 3826 
 3827 
 3828 -- |Finite-difference Black-Scholes vanilla engine; @[]@ selects no-dividend behavior.
 3829 fdBlackScholesVanillaEngine :: GenGeneralizedBlackScholesProcess gbs -> [Dividend] -> Word -> Word -> Word
 3830   -> FdmScheme -> Bool -> Double -> CashDividendModel -> IO PricingEngine
 3831 fdBlackScholesVanillaEngine process dividends =
 3832   case dividends of
 3833     [] -> fdBlackScholesVanillaEngineNoDividends process
 3834     _ -> fdBlackScholesVanillaEngineWithDividends process dividends
 3835 
 3836 -- |finite-differences Black-Scholes pricing engine for vanilla options, with quanto adjustment
 3837 fdBlackScholesVanillaEngineQuantoNoDividends :: (GenGeneralizedBlackScholesProcess gbs) -> (Maybe FdmQuantoHelper) -> (Word) -- ^timeSteps
 3838  -> (Word) -- ^gridPoints
 3839  -> (Word) -- ^timeDependent
 3840  -> (FdmScheme) -> (Bool) -- ^localVol
 3841  -> (Double) -- ^illegalLocalVolOverwrite
 3842  -> (CashDividendModel) -- ^cashDividendModel
 3843  -> IO ((PricingEngine))
 3844 fdBlackScholesVanillaEngineQuantoNoDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3845   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3846   withMaybeFdmQuantoHelper a2 $ \a2' -> 
 3847   let {a3' = fromIntegral a3} in 
 3848   let {a4' = fromIntegral a4} in 
 3849   let {a5' = fromIntegral a5} in 
 3850   withFdmSchemeDesc a6 $ \a6' -> 
 3851   let {a7' = C2HSImp.fromBool a7} in 
 3852   let {a8' = realToFrac a8} in 
 3853   let {a9' = (fromIntegral . fromEnum) a9} in 
 3854   preErrorCheck $ \a10' -> 
 3855   fdBlackScholesVanillaEngineQuantoNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3856   peekPricingEngine res >>= \res' ->
 3857   errorCheck  a10'>>
 3858   return (res')
 3859 
 3860 
 3861 
 3862 -- |finite-differences Black-Scholes pricing engine for vanilla options, with discrete dividends and quanto adjustment
 3863 fdBlackScholesVanillaEngineQuantoWithDividends :: (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -> (Maybe FdmQuantoHelper) -> (Word) -- ^timeSteps
 3864  -> (Word) -- ^gridPoints
 3865  -> (Word) -- ^timeDependent
 3866  -> (FdmScheme) -> (Bool) -- ^localVol
 3867  -> (Double) -- ^illegalLocalVolOverwrite
 3868  -> (CashDividendModel) -- ^cashDividendModel
 3869  -> IO ((PricingEngine))
 3870 fdBlackScholesVanillaEngineQuantoWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 3871   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 3872   withDividendArray a2 $ \(a2'1, a2'2) -> 
 3873   withMaybeFdmQuantoHelper a3 $ \a3' -> 
 3874   let {a4' = fromIntegral a4} in 
 3875   let {a5' = fromIntegral a5} in 
 3876   let {a6' = fromIntegral a6} in 
 3877   withFdmSchemeDesc a7 $ \a7' -> 
 3878   let {a8' = C2HSImp.fromBool a8} in 
 3879   let {a9' = realToFrac a9} in 
 3880   let {a10' = (fromIntegral . fromEnum) a10} in 
 3881   preErrorCheck $ \a11' -> 
 3882   fdBlackScholesVanillaEngineQuantoWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 3883   peekPricingEngine res >>= \res' ->
 3884   errorCheck  a11'>>
 3885   return (res')
 3886 
 3887 
 3888 
 3889 -- |Quanto-adjusted Black-Scholes vanilla engine; @[]@ selects no-dividend behavior.
 3890 fdBlackScholesVanillaEngineQuanto :: GenGeneralizedBlackScholesProcess gbs -> [Dividend]
 3891   -> Maybe FdmQuantoHelper -> Word -> Word -> Word -> FdmScheme -> Bool -> Double
 3892   -> CashDividendModel -> IO PricingEngine
 3893 fdBlackScholesVanillaEngineQuanto process dividends =
 3894   case dividends of
 3895     [] -> fdBlackScholesVanillaEngineQuantoNoDividends process
 3896     _ -> fdBlackScholesVanillaEngineQuantoWithDividends process dividends
 3897 
 3898 -- |finite-differences Heston-model pricing engine for vanilla options
 3899 fdHestonVanillaEngineNoDividends :: (GenHestonModel hm) -> (Word) -- ^tGrid
 3900  -> (Word) -- ^xGrid
 3901  -> (Word) -- ^vGrid
 3902  -> (Word) -- ^dampingSteps
 3903  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 3904  -> (Double) -- ^mixingFactor, upstream default: 1.0
 3905  -> IO ((PricingEngine))
 3906 fdHestonVanillaEngineNoDividends a1 a2 a3 a4 a5 a6 a7 a8 =
 3907   withHestonModel a1 $ \a1' -> 
 3908   let {a2' = fromIntegral a2} in 
 3909   let {a3' = fromIntegral a3} in 
 3910   let {a4' = fromIntegral a4} in 
 3911   let {a5' = fromIntegral a5} in 
 3912   withFdmSchemeDesc a6 $ \a6' -> 
 3913   withMaybeLocalVolTermStructure a7 $ \a7' -> 
 3914   let {a8' = realToFrac a8} in 
 3915   preErrorCheck $ \a9' -> 
 3916   fdHestonVanillaEngineNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 3917   peekPricingEngine res >>= \res' ->
 3918   errorCheck  a9'>>
 3919   return (res')
 3920 
 3921 
 3922 
 3923 -- |finite-differences Heston-model pricing engine for vanilla options, with discrete dividends
 3924 fdHestonVanillaEngineWithDividends :: (GenHestonModel hm) -> ([Dividend]) -> (Word) -- ^tGrid
 3925  -> (Word) -- ^xGrid
 3926  -> (Word) -- ^vGrid
 3927  -> (Word) -- ^dampingSteps
 3928  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 3929  -> (Double) -- ^mixingFactor, upstream default: 1.0
 3930  -> IO ((PricingEngine))
 3931 fdHestonVanillaEngineWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 3932   withHestonModel a1 $ \a1' -> 
 3933   withDividendArray a2 $ \(a2'1, a2'2) -> 
 3934   let {a3' = fromIntegral a3} in 
 3935   let {a4' = fromIntegral a4} in 
 3936   let {a5' = fromIntegral a5} in 
 3937   let {a6' = fromIntegral a6} in 
 3938   withFdmSchemeDesc a7 $ \a7' -> 
 3939   withMaybeLocalVolTermStructure a8 $ \a8' -> 
 3940   let {a9' = realToFrac a9} in 
 3941   preErrorCheck $ \a10' -> 
 3942   fdHestonVanillaEngineWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 3943   peekPricingEngine res >>= \res' ->
 3944   errorCheck  a10'>>
 3945   return (res')
 3946 
 3947 
 3948 
 3949 -- |Finite-difference Heston vanilla engine; @[]@ selects no-dividend behavior.
 3950 fdHestonVanillaEngine :: GenHestonModel hm -> [Dividend] -> Word -> Word -> Word -> Word
 3951   -> FdmScheme -> Maybe (GenLocalVolTermStructure lv) -> Double -> IO PricingEngine
 3952 fdHestonVanillaEngine model dividends =
 3953   case dividends of
 3954     [] -> fdHestonVanillaEngineNoDividends model
 3955     _ -> fdHestonVanillaEngineWithDividends model dividends
 3956 
 3957 -- |Fourier-cosine-series Heston engine for European vanilla options. @L@ controls the truncation range and @n@ the number of cosine terms.
 3958 cosHestonEngine :: (GenHestonModel hm) -- ^model
 3959  -> (Double) -- ^L
 3960  -> (Word) -- ^n
 3961  -> IO ((PricingEngine))
 3962 cosHestonEngine a1 a2 a3 =
 3963   withHestonModel a1 $ \a1' -> 
 3964   let {a2' = realToFrac a2} in 
 3965   let {a3' = fromIntegral a3} in 
 3966   preErrorCheck $ \a4' -> 
 3967   cosHestonEngine'_ a1' a2' a3' a4' >>= \res ->
 3968   peekPricingEngine res >>= \res' ->
 3969   errorCheck  a4'>>
 3970   return (res')
 3971 
 3972 
 3973 
 3974 -- |Heston transition-density integration engine for European vanilla options. @eps@ and @integrationOrder@ control Gauss-Lobatto integration accuracy and its iteration limit.
 3975 analyticPdfHestonEngine :: (GenHestonModel hm) -- ^model
 3976  -> (Double) -- ^eps
 3977  -> (Word) -- ^integrationOrder
 3978  -> IO ((PricingEngine))
 3979 analyticPdfHestonEngine a1 a2 a3 =
 3980   withHestonModel a1 $ \a1' -> 
 3981   let {a2' = realToFrac a2} in 
 3982   let {a3' = fromIntegral a3} in 
 3983   preErrorCheck $ \a4' -> 
 3984   analyticPdfHestonEngine'_ a1' a2' a3' a4' >>= \res ->
 3985   peekPricingEngine res >>= \res' ->
 3986   errorCheck  a4'>>
 3987   return (res')
 3988 
 3989 
 3990 
 3991 -- |Partial-integro finite-difference Bates-model engine for vanilla options.
 3992 fdBatesVanillaEngineNoDividends :: (GenBatesModel bm) -- ^model
 3993  -> (Word) -- ^tGrid
 3994  -> (Word) -- ^xGrid
 3995  -> (Word) -- ^vGrid
 3996  -> (Word) -- ^dampingSteps
 3997  -> (FdmScheme) -- ^schemeDesc
 3998  -> IO ((PricingEngine))
 3999 fdBatesVanillaEngineNoDividends a1 a2 a3 a4 a5 a6 =
 4000   withBatesModel a1 $ \a1' -> 
 4001   let {a2' = fromIntegral a2} in 
 4002   let {a3' = fromIntegral a3} in 
 4003   let {a4' = fromIntegral a4} in 
 4004   let {a5' = fromIntegral a5} in 
 4005   withFdmSchemeDesc a6 $ \a6' -> 
 4006   preErrorCheck $ \a7' -> 
 4007   fdBatesVanillaEngineNoDividends'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 4008   peekPricingEngine res >>= \res' ->
 4009   errorCheck  a7'>>
 4010   return (res')
 4011 
 4012 
 4013 
 4014 -- |Partial-integro finite-difference Bates-model engine for vanilla options with discrete dividends.
 4015 fdBatesVanillaEngineWithDividends :: (GenBatesModel bm) -- ^model
 4016  -> ([Dividend]) -- ^dividends
 4017  -> (Word) -- ^tGrid
 4018  -> (Word) -- ^xGrid
 4019  -> (Word) -- ^vGrid
 4020  -> (Word) -- ^dampingSteps
 4021  -> (FdmScheme) -- ^schemeDesc
 4022  -> IO ((PricingEngine))
 4023 fdBatesVanillaEngineWithDividends a1 a2 a3 a4 a5 a6 a7 =
 4024   withBatesModel a1 $ \a1' -> 
 4025   withDividendArray a2 $ \(a2'1, a2'2) -> 
 4026   let {a3' = fromIntegral a3} in 
 4027   let {a4' = fromIntegral a4} in 
 4028   let {a5' = fromIntegral a5} in 
 4029   let {a6' = fromIntegral a6} in 
 4030   withFdmSchemeDesc a7 $ \a7' -> 
 4031   preErrorCheck $ \a8' -> 
 4032   fdBatesVanillaEngineWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' >>= \res ->
 4033   peekPricingEngine res >>= \res' ->
 4034   errorCheck  a8'>>
 4035   return (res')
 4036 
 4037 
 4038 
 4039 -- |Finite-difference Bates vanilla engine; @[]@ selects no-dividend behavior.
 4040 fdBatesVanillaEngine :: GenBatesModel bm -> [Dividend] -> Word -> Word -> Word -> Word
 4041   -> FdmScheme -> IO PricingEngine
 4042 fdBatesVanillaEngine model dividends =
 4043   case dividends of
 4044     [] -> fdBatesVanillaEngineNoDividends model
 4045     _ -> fdBatesVanillaEngineWithDividends model dividends
 4046 
 4047 -- |Finite-difference Black-Scholes engine for American shout options.
 4048 fdBlackScholesShoutEngineNoDividends :: (GenGeneralizedBlackScholesProcess gbs) -- ^process
 4049  -> (Word) -- ^tGrid
 4050  -> (Word) -- ^xGrid
 4051  -> (Word) -- ^dampingSteps
 4052  -> (FdmScheme) -- ^schemeDesc
 4053  -> IO ((PricingEngine))
 4054 fdBlackScholesShoutEngineNoDividends a1 a2 a3 a4 a5 =
 4055   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 4056   let {a2' = fromIntegral a2} in 
 4057   let {a3' = fromIntegral a3} in 
 4058   let {a4' = fromIntegral a4} in 
 4059   withFdmSchemeDesc a5 $ \a5' -> 
 4060   preErrorCheck $ \a6' -> 
 4061   fdBlackScholesShoutEngineNoDividends'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 4062   peekPricingEngine res >>= \res' ->
 4063   errorCheck  a6'>>
 4064   return (res')
 4065 
 4066 
 4067 
 4068 -- |Finite-difference Black-Scholes engine for American shout options with discrete dividends.
 4069 fdBlackScholesShoutEngineWithDividends :: (GenGeneralizedBlackScholesProcess gbs) -- ^process
 4070  -> ([Dividend]) -- ^dividends
 4071  -> (Word) -- ^tGrid
 4072  -> (Word) -- ^xGrid
 4073  -> (Word) -- ^dampingSteps
 4074  -> (FdmScheme) -- ^schemeDesc
 4075  -> IO ((PricingEngine))
 4076 fdBlackScholesShoutEngineWithDividends a1 a2 a3 a4 a5 a6 =
 4077   withGeneralizedBlackScholesProcess a1 $ \a1' -> 
 4078   withDividendArray a2 $ \(a2'1, a2'2) -> 
 4079   let {a3' = fromIntegral a3} in 
 4080   let {a4' = fromIntegral a4} in 
 4081   let {a5' = fromIntegral a5} in 
 4082   withFdmSchemeDesc a6 $ \a6' -> 
 4083   preErrorCheck $ \a7' -> 
 4084   fdBlackScholesShoutEngineWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' >>= \res ->
 4085   peekPricingEngine res >>= \res' ->
 4086   errorCheck  a7'>>
 4087   return (res')
 4088 
 4089 
 4090 
 4091 -- |Finite-difference Black-Scholes shout engine; @[]@ selects no-dividend behavior.
 4092 fdBlackScholesShoutEngine :: GenGeneralizedBlackScholesProcess gbs -> [Dividend] -> Word -> Word
 4093   -> Word -> FdmScheme -> IO PricingEngine
 4094 fdBlackScholesShoutEngine process dividends =
 4095   case dividends of
 4096     [] -> fdBlackScholesShoutEngineNoDividends process
 4097     _ -> fdBlackScholesShoutEngineWithDividends process dividends
 4098 
 4099 -- |finite-differences Heston-model pricing engine for vanilla options, with quanto adjustment
 4100 fdHestonVanillaEngineQuantoNoDividends :: (GenHestonModel hm) -> (Maybe FdmQuantoHelper) -> (Word) -- ^tGrid
 4101  -> (Word) -- ^xGrid
 4102  -> (Word) -- ^vGrid
 4103  -> (Word) -- ^dampingSteps
 4104  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 4105  -> (Double) -- ^mixingFactor, upstream default: 1.0
 4106  -> IO ((PricingEngine))
 4107 fdHestonVanillaEngineQuantoNoDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 4108   withHestonModel a1 $ \a1' -> 
 4109   withMaybeFdmQuantoHelper a2 $ \a2' -> 
 4110   let {a3' = fromIntegral a3} in 
 4111   let {a4' = fromIntegral a4} in 
 4112   let {a5' = fromIntegral a5} in 
 4113   let {a6' = fromIntegral a6} in 
 4114   withFdmSchemeDesc a7 $ \a7' -> 
 4115   withMaybeLocalVolTermStructure a8 $ \a8' -> 
 4116   let {a9' = realToFrac a9} in 
 4117   preErrorCheck $ \a10' -> 
 4118   fdHestonVanillaEngineQuantoNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 4119   peekPricingEngine res >>= \res' ->
 4120   errorCheck  a10'>>
 4121   return (res')
 4122 
 4123 
 4124 
 4125 -- |finite-differences Heston-model pricing engine for vanilla options, with discrete dividends and quanto adjustment
 4126 fdHestonVanillaEngineQuantoWithDividends :: (GenHestonModel hm) -> ([Dividend]) -> (Maybe FdmQuantoHelper) -> (Word) -- ^tGrid
 4127  -> (Word) -- ^xGrid
 4128  -> (Word) -- ^vGrid
 4129  -> (Word) -- ^dampingSteps
 4130  -> (FdmScheme) -> (Maybe (GenLocalVolTermStructure lv)) -- ^leverageFct
 4131  -> (Double) -- ^mixingFactor, upstream default: 1.0
 4132  -> IO ((PricingEngine))
 4133 fdHestonVanillaEngineQuantoWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 4134   withHestonModel a1 $ \a1' -> 
 4135   withDividendArray a2 $ \(a2'1, a2'2) -> 
 4136   withMaybeFdmQuantoHelper a3 $ \a3' -> 
 4137   let {a4' = fromIntegral a4} in 
 4138   let {a5' = fromIntegral a5} in 
 4139   let {a6' = fromIntegral a6} in 
 4140   let {a7' = fromIntegral a7} in 
 4141   withFdmSchemeDesc a8 $ \a8' -> 
 4142   withMaybeLocalVolTermStructure a9 $ \a9' -> 
 4143   let {a10' = realToFrac a10} in 
 4144   preErrorCheck $ \a11' -> 
 4145   fdHestonVanillaEngineQuantoWithDividends'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 4146   peekPricingEngine res >>= \res' ->
 4147   errorCheck  a11'>>
 4148   return (res')
 4149 
 4150 
 4151 
 4152 -- |Quanto-adjusted Heston vanilla engine; @[]@ selects no-dividend behavior.
 4153 fdHestonVanillaEngineQuanto :: GenHestonModel hm -> [Dividend] -> Maybe FdmQuantoHelper
 4154   -> Word -> Word -> Word -> Word -> FdmScheme -> Maybe (GenLocalVolTermStructure lv)
 4155   -> Double -> IO PricingEngine
 4156 fdHestonVanillaEngineQuanto model dividends =
 4157   case dividends of
 4158     [] -> fdHestonVanillaEngineQuantoNoDividends model
 4159     _ -> fdHestonVanillaEngineQuantoWithDividends model dividends
 4160 
 4161 -- |finite-differences pricing engine for vanilla options combining a Heston equity model with a Hull-White short-rate model
 4162 fdHestonHullWhiteVanillaEngineNoDividends :: (GenHestonModel hm) -> (HullWhiteProcess) -> (Double) -- ^corrEquityShortRate
 4163  -> (Word) -- ^tGrid
 4164  -> (Word) -- ^xGrid
 4165  -> (Word) -- ^vGrid
 4166  -> (Word) -- ^rGrid
 4167  -> (Word) -- ^dampingSteps
 4168  -> (Bool) -- ^controlVariate, upstream default: true
 4169  -> (FdmScheme) -> IO ((PricingEngine))
 4170 fdHestonHullWhiteVanillaEngineNoDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 4171   withHestonModel a1 $ \a1' -> 
 4172   withGenStochasticProcess1D a2 $ \a2' -> 
 4173   let {a3' = realToFrac a3} in 
 4174   let {a4' = fromIntegral a4} in 
 4175   let {a5' = fromIntegral a5} in 
 4176   let {a6' = fromIntegral a6} in 
 4177   let {a7' = fromIntegral a7} in 
 4178   let {a8' = fromIntegral a8} in 
 4179   let {a9' = C2HSImp.fromBool a9} in 
 4180   withFdmSchemeDesc a10 $ \a10' -> 
 4181   preErrorCheck $ \a11' -> 
 4182   fdHestonHullWhiteVanillaEngineNoDividends'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 4183   peekPricingEngine res >>= \res' ->
 4184   errorCheck  a11'>>
 4185   return (res')
 4186 
 4187 
 4188 
 4189 -- |finite-differences pricing engine for vanilla options combining a Heston equity model with a Hull-White short-rate model, with discrete dividends
 4190 fdHestonHullWhiteVanillaEngineWithDividends :: (GenHestonModel hm) -> (HullWhiteProcess) -> ([Dividend]) -> (Double) -- ^corrEquityShortRate
 4191  -> (Word) -- ^tGrid
 4192  -> (Word) -- ^xGrid
 4193  -> (Word) -- ^vGrid
 4194  -> (Word) -- ^rGrid
 4195  -> (Word) -- ^dampingSteps
 4196  -> (Bool) -- ^controlVariate, upstream default: true
 4197  -> (FdmScheme) -> IO ((PricingEngine))
 4198 fdHestonHullWhiteVanillaEngineWithDividends a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 4199   withHestonModel a1 $ \a1' -> 
 4200   withGenStochasticProcess1D a2 $ \a2' -> 
 4201   withDividendArray a3 $ \(a3'1, a3'2) -> 
 4202   let {a4' = realToFrac a4} in 
 4203   let {a5' = fromIntegral a5} in 
 4204   let {a6' = fromIntegral a6} in 
 4205   let {a7' = fromIntegral a7} in 
 4206   let {a8' = fromIntegral a8} in 
 4207   let {a9' = fromIntegral a9} in 
 4208   let {a10' = C2HSImp.fromBool a10} in 
 4209   withFdmSchemeDesc a11 $ \a11' -> 
 4210   preErrorCheck $ \a12' -> 
 4211   fdHestonHullWhiteVanillaEngineWithDividends'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 4212   peekPricingEngine res >>= \res' ->
 4213   errorCheck  a12'>>
 4214   return (res')
 4215 
 4216 
 4217 
 4218 -- |Heston/Hull-White finite-difference engine; @[]@ selects no-dividend behavior.
 4219 fdHestonHullWhiteVanillaEngine :: GenHestonModel hm -> HullWhiteProcess -> [Dividend]
 4220   -> Double -> Word -> Word -> Word -> Word -> Word -> Bool -> FdmScheme -> IO PricingEngine
 4221 fdHestonHullWhiteVanillaEngine heston hullWhite dividends =
 4222   case dividends of
 4223     [] -> fdHestonHullWhiteVanillaEngineNoDividends heston hullWhite
 4224     _ -> fdHestonHullWhiteVanillaEngineWithDividends heston hullWhite dividends
 4225 
 4226 -- |binomial Tsiveriotis-Fernandes pricing engine for convertible bonds
 4227 binomialConvertibleEngine :: (BinomialTree) -> (GenGeneralizedBlackScholesProcess gbs) -> (Word) -- ^timeSteps
 4228  -> (GenQuote q) -- ^creditSpread
 4229  -> ([Dividend]) -- ^dividends
 4230  -> IO ((PricingEngine))
 4231 binomialConvertibleEngine a1 a2 a3 a4 a5 =
 4232   let {a1' = (fromIntegral . fromEnum) a1} in 
 4233   withGeneralizedBlackScholesProcess a2 $ \a2' -> 
 4234   let {a3' = fromIntegral a3} in 
 4235   withQuote a4 $ \a4' -> 
 4236   withDividendArray a5 $ \(a5'1, a5'2) -> 
 4237   preErrorCheck $ \a6' -> 
 4238   binomialConvertibleEngine'_ a1' a2' a3' a4' a5'1  a5'2 a6' >>= \res ->
 4239   peekPricingEngine res >>= \res' ->
 4240   errorCheck  a6'>>
 4241   return (res')
 4242 
 4243 
 4244 
 4245 -- |volatility is the quoted fwd yield volatility, not price vol
 4246 blackCallableFixedRateBondEngineFromVolatilityStructure :: (CallableBondVolatilityStructure) -> (GenYieldTermStructure y) -> IO ((PricingEngine))
 4247 blackCallableFixedRateBondEngineFromVolatilityStructure a1 a2 =
 4248   withGenTermStructure a1 $ \a1' -> 
 4249   withYieldTermStructure a2 $ \a2' -> 
 4250   preErrorCheck $ \a3' -> 
 4251   blackCallableFixedRateBondEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 4252   peekPricingEngine res >>= \res' ->
 4253   errorCheck  a3'>>
 4254   return (res')
 4255 
 4256 
 4257 
 4258 -- |volatility is the quoted fwd yield volatility, not price vol
 4259 blackCallableFixedRateBondEngine :: (GenQuote q) -> (GenYieldTermStructure y) -> IO ((PricingEngine))
 4260 blackCallableFixedRateBondEngine a1 a2 =
 4261   withQuote a1 $ \a1' -> 
 4262   withYieldTermStructure a2 $ \a2' -> 
 4263   preErrorCheck $ \a3' -> 
 4264   blackCallableFixedRateBondEngine'_ a1' a2' a3' >>= \res ->
 4265   peekPricingEngine res >>= \res' ->
 4266   errorCheck  a3'>>
 4267   return (res')
 4268 
 4269 
 4270 
 4271 -- |volatility is the quoted fwd yield volatility, not price vol
 4272 blackCallableZeroCouponBondEngineFromVolatilityStructure :: (CallableBondVolatilityStructure) -> (GenYieldTermStructure y) -> IO ((PricingEngine))
 4273 blackCallableZeroCouponBondEngineFromVolatilityStructure a1 a2 =
 4274   withGenTermStructure a1 $ \a1' -> 
 4275   withYieldTermStructure a2 $ \a2' -> 
 4276   preErrorCheck $ \a3' -> 
 4277   blackCallableZeroCouponBondEngineFromVolatilityStructure'_ a1' a2' a3' >>= \res ->
 4278   peekPricingEngine res >>= \res' ->
 4279   errorCheck  a3'>>
 4280   return (res')
 4281 
 4282 
 4283 
 4284 -- |volatility is the quoted fwd yield volatility, not price vol
 4285 blackCallableZeroCouponBondEngine :: (GenQuote q) -> (GenYieldTermStructure y) -> IO ((PricingEngine))
 4286 blackCallableZeroCouponBondEngine a1 a2 =
 4287   withQuote a1 $ \a1' -> 
 4288   withYieldTermStructure a2 $ \a2' -> 
 4289   preErrorCheck $ \a3' -> 
 4290   blackCallableZeroCouponBondEngine'_ a1' a2' a3' >>= \res ->
 4291   peekPricingEngine res >>= \res' ->
 4292   errorCheck  a3'>>
 4293   return (res')
 4294 
 4295 
 4296 
 4297 -- |numerical-lattice pricing engine for callable fixed-rate bonds, on an explicit time grid
 4298 treeCallableFixedRateBondEngineTimeGrid :: (GenShortRateModel sm) -> (TimeGrid) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 4299 treeCallableFixedRateBondEngineTimeGrid a1 a2 a3 =
 4300   withShortRateModel a1 $ \a1' -> 
 4301   withTimeGrid a2 $ \a2' -> 
 4302   withMaybeYieldTermStructure a3 $ \a3' -> 
 4303   preErrorCheck $ \a4' -> 
 4304   treeCallableFixedRateBondEngineTimeGrid'_ a1' a2' a3' a4' >>= \res ->
 4305   peekPricingEngine res >>= \res' ->
 4306   errorCheck  a4'>>
 4307   return (res')
 4308 
 4309 
 4310 
 4311 -- |numerical-lattice pricing engine for callable fixed-rate bonds
 4312 treeCallableFixedRateBondEngineTimeSteps :: (GenShortRateModel sm) -> (Word) -- ^timeSteps
 4313  -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 4314 treeCallableFixedRateBondEngineTimeSteps a1 a2 a3 =
 4315   withShortRateModel a1 $ \a1' -> 
 4316   let {a2' = fromIntegral a2} in 
 4317   withMaybeYieldTermStructure a3 $ \a3' -> 
 4318   preErrorCheck $ \a4' -> 
 4319   treeCallableFixedRateBondEngineTimeSteps'_ a1' a2' a3' a4' >>= \res ->
 4320   peekPricingEngine res >>= \res' ->
 4321   errorCheck  a4'>>
 4322   return (res')
 4323 
 4324 
 4325 
 4326 -- |numerical-lattice pricing engine for callable zero coupon bonds, on an explicit time grid
 4327 treeCallableZeroCouponBondEngineTimeGrid :: (GenShortRateModel sm) -> (TimeGrid) -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 4328 treeCallableZeroCouponBondEngineTimeGrid a1 a2 a3 =
 4329   withShortRateModel a1 $ \a1' -> 
 4330   withTimeGrid a2 $ \a2' -> 
 4331   withMaybeYieldTermStructure a3 $ \a3' -> 
 4332   preErrorCheck $ \a4' -> 
 4333   treeCallableZeroCouponBondEngineTimeGrid'_ a1' a2' a3' a4' >>= \res ->
 4334   peekPricingEngine res >>= \res' ->
 4335   errorCheck  a4'>>
 4336   return (res')
 4337 
 4338 
 4339 
 4340 -- |numerical-lattice pricing engine for callable zero coupon bonds
 4341 treeCallableZeroCouponBondEngineTimeSteps :: (GenShortRateModel sm) -> (Word) -- ^timeSteps
 4342  -> (Maybe (GenYieldTermStructure y)) -> IO ((PricingEngine))
 4343 treeCallableZeroCouponBondEngineTimeSteps a1 a2 a3 =
 4344   withShortRateModel a1 $ \a1' -> 
 4345   let {a2' = fromIntegral a2} in 
 4346   withMaybeYieldTermStructure a3 $ \a3' -> 
 4347   preErrorCheck $ \a4' -> 
 4348   treeCallableZeroCouponBondEngineTimeSteps'_ a1' a2' a3' a4' >>= \res ->
 4349   peekPricingEngine res >>= \res' ->
 4350   errorCheck  a4'>>
 4351   return (res')
 4352 
 4353 
 4354 
 4355 -- |Callable fixed-rate bond lattice engine using either a step count or an explicit grid.
 4356 treeCallableFixedRateBondEngine :: GenShortRateModel sm -> LatticeTime -> Maybe (GenYieldTermStructure y) -> IO PricingEngine
 4357 treeCallableFixedRateBondEngine model latticeTime curve =
 4358   case latticeTime of
 4359     TimeSteps steps -> treeCallableFixedRateBondEngineTimeSteps model steps curve
 4360     ExplicitTimeGrid grid -> treeCallableFixedRateBondEngineTimeGrid model grid curve
 4361 
 4362 -- |Callable zero-coupon bond lattice engine using either a step count or an explicit grid.
 4363 treeCallableZeroCouponBondEngine :: GenShortRateModel sm -> LatticeTime -> Maybe (GenYieldTermStructure y) -> IO PricingEngine
 4364 treeCallableZeroCouponBondEngine model latticeTime curve =
 4365   case latticeTime of
 4366     TimeSteps steps -> treeCallableZeroCouponBondEngineTimeSteps model steps curve
 4367     ExplicitTimeGrid grid -> treeCallableZeroCouponBondEngineTimeGrid model grid curve
 4368 
 4369 -- |intermediate value N'(d1) (or its sign-flipped equivalent) used internally to derive the calculator's Greeks
 4370 qlBlackCalculatorAlpha :: (GenBlackCalculator bc) -> IO ((Double))
 4371 qlBlackCalculatorAlpha a1 =
 4372   withBlackCalculator a1 $ \a1' -> 
 4373   preErrorCheck $ \a2' -> 
 4374   qlBlackCalculatorAlpha'_ a1' a2' >>= \res ->
 4375   let {res' = realToFrac res} in
 4376   errorCheck  a2'>>
 4377   return (res')
 4378 
 4379 
 4380 
 4381 -- |intermediate value N'(d2) (or its sign-flipped equivalent) used internally to derive the calculator's Greeks
 4382 qlBlackCalculatorBeta :: (GenBlackCalculator bc) -> IO ((Double))
 4383 qlBlackCalculatorBeta a1 =
 4384   withBlackCalculator a1 $ \a1' -> 
 4385   preErrorCheck $ \a2' -> 
 4386   qlBlackCalculatorBeta'_ a1' a2' >>= \res ->
 4387   let {res' = realToFrac res} in
 4388   errorCheck  a2'>>
 4389   return (res')
 4390 
 4391 
 4392 
 4393 -- |Black 1976 option-price calculator, from the option type and strike directly
 4394 blackCalculatorAtStrikeRaw :: (OptionType) -> (Double) -- ^strike
 4395  -> (Double) -- ^forward
 4396  -> (Double) -- ^stdDev
 4397  -> (Double) -- ^discount
 4398  -> IO ((BlackCalculator))
 4399 blackCalculatorAtStrikeRaw a1 a2 a3 a4 a5 =
 4400   let {a1' = fromEnumC a1} in 
 4401   let {a2' = realToFrac a2} in 
 4402   let {a3' = realToFrac a3} in 
 4403   let {a4' = realToFrac a4} in 
 4404   let {a5' = realToFrac a5} in 
 4405   preErrorCheck $ \a6' -> 
 4406   blackCalculatorAtStrikeRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 4407   peekBlackCalculator res >>= \res' ->
 4408   errorCheck  a6'>>
 4409   return (res')
 4410 
 4411 
 4412 
 4413 -- |Black 1976 option-price calculator, from a striked payoff
 4414 blackCalculatorFromPayoffRaw :: (StrikedPayoff) -> (Double) -- ^forward
 4415  -> (Double) -- ^stdDev
 4416  -> (Double) -- ^discount
 4417  -> IO ((BlackCalculator))
 4418 blackCalculatorFromPayoffRaw a1 a2 a3 a4 =
 4419   withStrikedPayoff a1 $ \a1' -> 
 4420   let {a2' = realToFrac a2} in 
 4421   let {a3' = realToFrac a3} in 
 4422   let {a4' = realToFrac a4} in 
 4423   preErrorCheck $ \a5' -> 
 4424   blackCalculatorFromPayoffRaw'_ a1' a2' a3' a4' a5' >>= \res ->
 4425   peekBlackCalculator res >>= \res' ->
 4426   errorCheck  a5'>>
 4427   return (res')
 4428 
 4429 
 4430 
 4431 -- |Sensitivity to change in the underlying spot price.
 4432 qlBlackCalculatorDelta :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4433  -> IO ((Double))
 4434 qlBlackCalculatorDelta a1 a2 =
 4435   withBlackCalculator a1 $ \a1' -> 
 4436   let {a2' = realToFrac a2} in 
 4437   preErrorCheck $ \a3' -> 
 4438   qlBlackCalculatorDelta'_ a1' a2' a3' >>= \res ->
 4439   let {res' = realToFrac res} in
 4440   errorCheck  a3'>>
 4441   return (res')
 4442 
 4443 
 4444 
 4445 -- |Sensitivity to change in the underlying forward price.
 4446 qlBlackCalculatorDeltaForward :: (GenBlackCalculator bc) -> IO ((Double))
 4447 qlBlackCalculatorDeltaForward a1 =
 4448   withBlackCalculator a1 $ \a1' -> 
 4449   preErrorCheck $ \a2' -> 
 4450   qlBlackCalculatorDeltaForward'_ a1' a2' >>= \res ->
 4451   let {res' = realToFrac res} in
 4452   errorCheck  a2'>>
 4453   return (res')
 4454 
 4455 
 4456 
 4457 -- |Sensitivity to dividend/growth rate.
 4458 qlBlackCalculatorDividendRho :: (GenBlackCalculator bc) -> (Double) -- ^maturity
 4459  -> IO ((Double))
 4460 qlBlackCalculatorDividendRho a1 a2 =
 4461   withBlackCalculator a1 $ \a1' -> 
 4462   let {a2' = realToFrac a2} in 
 4463   preErrorCheck $ \a3' -> 
 4464   qlBlackCalculatorDividendRho'_ a1' a2' a3' >>= \res ->
 4465   let {res' = realToFrac res} in
 4466   errorCheck  a3'>>
 4467   return (res')
 4468 
 4469 
 4470 
 4471 -- |Sensitivity in percent to a percent change in the underlying spot price.
 4472 qlBlackCalculatorElasticity :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4473  -> IO ((Double))
 4474 qlBlackCalculatorElasticity a1 a2 =
 4475   withBlackCalculator a1 $ \a1' -> 
 4476   let {a2' = realToFrac a2} in 
 4477   preErrorCheck $ \a3' -> 
 4478   qlBlackCalculatorElasticity'_ a1' a2' a3' >>= \res ->
 4479   let {res' = realToFrac res} in
 4480   errorCheck  a3'>>
 4481   return (res')
 4482 
 4483 
 4484 
 4485 -- |Sensitivity in percent to a percent change in the underlying forward price.
 4486 qlBlackCalculatorElasticityForward :: (GenBlackCalculator bc) -> IO ((Double))
 4487 qlBlackCalculatorElasticityForward a1 =
 4488   withBlackCalculator a1 $ \a1' -> 
 4489   preErrorCheck $ \a2' -> 
 4490   qlBlackCalculatorElasticityForward'_ a1' a2' >>= \res ->
 4491   let {res' = realToFrac res} in
 4492   errorCheck  a2'>>
 4493   return (res')
 4494 
 4495 
 4496 
 4497 -- |Second order derivative with respect to change in the underlying spot price.
 4498 qlBlackCalculatorGamma :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4499  -> IO ((Double))
 4500 qlBlackCalculatorGamma a1 a2 =
 4501   withBlackCalculator a1 $ \a1' -> 
 4502   let {a2' = realToFrac a2} in 
 4503   preErrorCheck $ \a3' -> 
 4504   qlBlackCalculatorGamma'_ a1' a2' a3' >>= \res ->
 4505   let {res' = realToFrac res} in
 4506   errorCheck  a3'>>
 4507   return (res')
 4508 
 4509 
 4510 
 4511 -- |Second order derivative with respect to change in the underlying forward price.
 4512 qlBlackCalculatorGammaForward :: (GenBlackCalculator bc) -> IO ((Double))
 4513 qlBlackCalculatorGammaForward a1 =
 4514   withBlackCalculator a1 $ \a1' -> 
 4515   preErrorCheck $ \a2' -> 
 4516   qlBlackCalculatorGammaForward'_ a1' a2' >>= \res ->
 4517   let {res' = realToFrac res} in
 4518   errorCheck  a2'>>
 4519   return (res')
 4520 
 4521 
 4522 
 4523 -- |Probability of being in the money in the asset martingale measure, i.e. N(d1). It is a risk-neutral probability, not the real world one.
 4524 qlBlackCalculatorItmAssetProbability :: (GenBlackCalculator bc) -> IO ((Double))
 4525 qlBlackCalculatorItmAssetProbability a1 =
 4526   withBlackCalculator a1 $ \a1' -> 
 4527   preErrorCheck $ \a2' -> 
 4528   qlBlackCalculatorItmAssetProbability'_ a1' a2' >>= \res ->
 4529   let {res' = realToFrac res} in
 4530   errorCheck  a2'>>
 4531   return (res')
 4532 
 4533 
 4534 
 4535 -- |Probability of being in the money in the bond martingale measure, i.e. N(d2). It is a risk-neutral probability, not the real world one.
 4536 qlBlackCalculatorItmCashProbability :: (GenBlackCalculator bc) -> IO ((Double))
 4537 qlBlackCalculatorItmCashProbability a1 =
 4538   withBlackCalculator a1 $ \a1' -> 
 4539   preErrorCheck $ \a2' -> 
 4540   qlBlackCalculatorItmCashProbability'_ a1' a2' >>= \res ->
 4541   let {res' = realToFrac res} in
 4542   errorCheck  a2'>>
 4543   return (res')
 4544 
 4545 
 4546 
 4547 -- |Sensitivity to discounting rate.
 4548 qlBlackCalculatorRho :: (GenBlackCalculator bc) -> (Double) -- ^maturity
 4549  -> IO ((Double))
 4550 qlBlackCalculatorRho a1 a2 =
 4551   withBlackCalculator a1 $ \a1' -> 
 4552   let {a2' = realToFrac a2} in 
 4553   preErrorCheck $ \a3' -> 
 4554   qlBlackCalculatorRho'_ a1' a2' a3' >>= \res ->
 4555   let {res' = realToFrac res} in
 4556   errorCheck  a3'>>
 4557   return (res')
 4558 
 4559 
 4560 
 4561 -- |Sensitivity to strike.
 4562 qlBlackCalculatorStrikeSensitivity :: (GenBlackCalculator bc) -> IO ((Double))
 4563 qlBlackCalculatorStrikeSensitivity a1 =
 4564   withBlackCalculator a1 $ \a1' -> 
 4565   preErrorCheck $ \a2' -> 
 4566   qlBlackCalculatorStrikeSensitivity'_ a1' a2' >>= \res ->
 4567   let {res' = realToFrac res} in
 4568   errorCheck  a2'>>
 4569   return (res')
 4570 
 4571 
 4572 
 4573 -- |gamma w.r.t. strike.
 4574 qlBlackCalculatorStrikeGamma :: (GenBlackCalculator bc) -> IO ((Double))
 4575 qlBlackCalculatorStrikeGamma a1 =
 4576   withBlackCalculator a1 $ \a1' -> 
 4577   preErrorCheck $ \a2' -> 
 4578   qlBlackCalculatorStrikeGamma'_ a1' a2' >>= \res ->
 4579   let {res' = realToFrac res} in
 4580   errorCheck  a2'>>
 4581   return (res')
 4582 
 4583 
 4584 
 4585 -- |Sensitivity to time to maturity.
 4586 qlBlackCalculatorTheta :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4587  -> (Double) -- ^maturity
 4588  -> IO ((Double))
 4589 qlBlackCalculatorTheta a1 a2 a3 =
 4590   withBlackCalculator a1 $ \a1' -> 
 4591   let {a2' = realToFrac a2} in 
 4592   let {a3' = realToFrac a3} in 
 4593   preErrorCheck $ \a4' -> 
 4594   qlBlackCalculatorTheta'_ a1' a2' a3' a4' >>= \res ->
 4595   let {res' = realToFrac res} in
 4596   errorCheck  a4'>>
 4597   return (res')
 4598 
 4599 
 4600 
 4601 -- |Sensitivity to time to maturity per day, assuming 365 day per year.
 4602 qlBlackCalculatorThetaPerDay :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4603  -> (Double) -- ^maturity
 4604  -> IO ((Double))
 4605 qlBlackCalculatorThetaPerDay a1 a2 a3 =
 4606   withBlackCalculator a1 $ \a1' -> 
 4607   let {a2' = realToFrac a2} in 
 4608   let {a3' = realToFrac a3} in 
 4609   preErrorCheck $ \a4' -> 
 4610   qlBlackCalculatorThetaPerDay'_ a1' a2' a3' a4' >>= \res ->
 4611   let {res' = realToFrac res} in
 4612   errorCheck  a4'>>
 4613   return (res')
 4614 
 4615 
 4616 
 4617 -- |the option's fair value
 4618 qlBlackCalculatorValue :: (GenBlackCalculator bc) -> IO ((Double))
 4619 qlBlackCalculatorValue a1 =
 4620   withBlackCalculator a1 $ \a1' -> 
 4621   preErrorCheck $ \a2' -> 
 4622   qlBlackCalculatorValue'_ a1' a2' >>= \res ->
 4623   let {res' = realToFrac res} in
 4624   errorCheck  a2'>>
 4625   return (res')
 4626 
 4627 
 4628 
 4629 -- |Sensitivity of vega to spot (Vanna).
 4630 blackVanna :: (GenBlackCalculator bc) -> (Double) -- ^spot
 4631  -> (Double) -- ^maturity
 4632  -> IO ((Double))
 4633 blackVanna a1 a2 a3 =
 4634   withBlackCalculator a1 $ \a1' -> 
 4635   let {a2' = realToFrac a2} in 
 4636   let {a3' = realToFrac a3} in 
 4637   preErrorCheck $ \a4' -> 
 4638   blackVanna'_ a1' a2' a3' a4' >>= \res ->
 4639   let {res' = realToFrac res} in
 4640   errorCheck  a4'>>
 4641   return (res')
 4642 
 4643 
 4644 
 4645 -- |Sensitivity to volatility.
 4646 qlBlackCalculatorVega :: (GenBlackCalculator bc) -> (Double) -- ^maturity
 4647  -> IO ((Double))
 4648 qlBlackCalculatorVega a1 a2 =
 4649   withBlackCalculator a1 $ \a1' -> 
 4650   let {a2' = realToFrac a2} in 
 4651   preErrorCheck $ \a3' -> 
 4652   qlBlackCalculatorVega'_ a1' a2' a3' >>= \res ->
 4653   let {res' = realToFrac res} in
 4654   errorCheck  a3'>>
 4655   return (res')
 4656 
 4657 
 4658 
 4659 -- |Sensitivity of vega to volatility (Volga).
 4660 qlBlackCalculatorVolga :: (GenBlackCalculator bc) -> (Double) -- ^maturity
 4661  -> IO ((Double))
 4662 qlBlackCalculatorVolga a1 a2 =
 4663   withBlackCalculator a1 $ \a1' -> 
 4664   let {a2' = realToFrac a2} in 
 4665   preErrorCheck $ \a3' -> 
 4666   qlBlackCalculatorVolga'_ a1' a2' a3' >>= \res ->
 4667   let {res' = realToFrac res} in
 4668   errorCheck  a3'>>
 4669   return (res')
 4670 
 4671 
 4672 
 4673 -- |Black-Scholes-Merton option-price calculator, from the option type and strike directly
 4674 blackScholesCalculatorAtStrikeRaw :: (OptionType) -> (Double) -- ^strike
 4675  -> (Double) -- ^spot
 4676  -> (Double) -- ^growth
 4677  -> (Double) -- ^stdDev
 4678  -> (Double) -- ^discount
 4679  -> IO ((BlackScholesCalculator))
 4680 blackScholesCalculatorAtStrikeRaw a1 a2 a3 a4 a5 a6 =
 4681   let {a1' = fromEnumC a1} in 
 4682   let {a2' = realToFrac a2} in 
 4683   let {a3' = realToFrac a3} in 
 4684   let {a4' = realToFrac a4} in 
 4685   let {a5' = realToFrac a5} in 
 4686   let {a6' = realToFrac a6} in 
 4687   preErrorCheck $ \a7' -> 
 4688   blackScholesCalculatorAtStrikeRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 4689   peekBlackScholesCalculator res >>= \res' ->
 4690   errorCheck  a7'>>
 4691   return (res')
 4692 
 4693 
 4694 
 4695 -- |Black-Scholes-Merton option-price calculator, from a striked payoff and spot price
 4696 blackScholesCalculatorFromPayoffRaw :: (StrikedPayoff) -> (Double) -- ^spot
 4697  -> (Double) -- ^growth
 4698  -> (Double) -- ^stdDev
 4699  -> (Double) -- ^discount
 4700  -> IO ((BlackScholesCalculator))
 4701 blackScholesCalculatorFromPayoffRaw a1 a2 a3 a4 a5 =
 4702   withStrikedPayoff a1 $ \a1' -> 
 4703   let {a2' = realToFrac a2} in 
 4704   let {a3' = realToFrac a3} in 
 4705   let {a4' = realToFrac a4} in 
 4706   let {a5' = realToFrac a5} in 
 4707   preErrorCheck $ \a6' -> 
 4708   blackScholesCalculatorFromPayoffRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 4709   peekBlackScholesCalculator res >>= \res' ->
 4710   errorCheck  a6'>>
 4711   return (res')
 4712 
 4713 
 4714 
 4715 -- |Sensitivity to change in the underlying spot price.
 4716 blackScholesDelta :: (BlackScholesCalculator) -> IO ((Double))
 4717 blackScholesDelta a1 =
 4718   withGenBlackCalculator a1 $ \a1' -> 
 4719   preErrorCheck $ \a2' -> 
 4720   blackScholesDelta'_ a1' a2' >>= \res ->
 4721   let {res' = realToFrac res} in
 4722   errorCheck  a2'>>
 4723   return (res')
 4724 
 4725 
 4726 
 4727 -- |Sensitivity in percent to a percent change in the underlying spot price.
 4728 blackScholesElasticity :: (BlackScholesCalculator) -> IO ((Double))
 4729 blackScholesElasticity a1 =
 4730   withGenBlackCalculator a1 $ \a1' -> 
 4731   preErrorCheck $ \a2' -> 
 4732   blackScholesElasticity'_ a1' a2' >>= \res ->
 4733   let {res' = realToFrac res} in
 4734   errorCheck  a2'>>
 4735   return (res')
 4736 
 4737 
 4738 
 4739 -- |Second order derivative with respect to change in the underlying spot price.
 4740 blackScholesGamma :: (BlackScholesCalculator) -> IO ((Double))
 4741 blackScholesGamma a1 =
 4742   withGenBlackCalculator a1 $ \a1' -> 
 4743   preErrorCheck $ \a2' -> 
 4744   blackScholesGamma'_ a1' a2' >>= \res ->
 4745   let {res' = realToFrac res} in
 4746   errorCheck  a2'>>
 4747   return (res')
 4748 
 4749 
 4750 
 4751 -- |Sensitivity to time to maturity.
 4752 blackScholesTheta :: (BlackScholesCalculator) -> (Double) -- ^maturity
 4753  -> IO ((Double))
 4754 blackScholesTheta a1 a2 =
 4755   withGenBlackCalculator a1 $ \a1' -> 
 4756   let {a2' = realToFrac a2} in 
 4757   preErrorCheck $ \a3' -> 
 4758   blackScholesTheta'_ a1' a2' a3' >>= \res ->
 4759   let {res' = realToFrac res} in
 4760   errorCheck  a3'>>
 4761   return (res')
 4762 
 4763 
 4764 
 4765 -- |Sensitivity to time to maturity per day (assuming 365 day in a year).
 4766 blackScholesThetaPerDay :: (BlackScholesCalculator) -> (Double) -- ^maturity
 4767  -> IO ((Double))
 4768 blackScholesThetaPerDay a1 a2 =
 4769   withGenBlackCalculator a1 $ \a1' -> 
 4770   let {a2' = realToFrac a2} in 
 4771   preErrorCheck $ \a3' -> 
 4772   blackScholesThetaPerDay'_ a1' a2' a3' >>= \res ->
 4773   let {res' = realToFrac res} in
 4774   errorCheck  a3'>>
 4775   return (res')
 4776 
 4777 
 4778 
 4779 -- |Bachelier (normal-model) analogue of 'BlackCalculator', for options on a rate rather than a
 4780 -- price. No subclass hierarchy upstream, unlike BlackCalculator\/BlackScholesCalculator, so this
 4781 -- is a single leaf type with its own methods rather than a t'GenBlackCalculator' instance.
 4782 bachelierCalculatorAtStrikeRaw :: (OptionType) -> (Double) -- ^strike
 4783  -> (Double) -- ^forward
 4784  -> (Double) -- ^stdDev
 4785  -> (Double) -- ^discount
 4786  -> IO ((BachelierCalculator))
 4787 bachelierCalculatorAtStrikeRaw a1 a2 a3 a4 a5 =
 4788   let {a1' = fromEnumC a1} in 
 4789   let {a2' = realToFrac a2} in 
 4790   let {a3' = realToFrac a3} in 
 4791   let {a4' = realToFrac a4} in 
 4792   let {a5' = realToFrac a5} in 
 4793   preErrorCheck $ \a6' -> 
 4794   bachelierCalculatorAtStrikeRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 4795   peekBachelierCalculator res >>= \res' ->
 4796   errorCheck  a6'>>
 4797   return (res')
 4798 
 4799 
 4800 
 4801 -- |Bachelier (normal-model) option-price calculator, from a striked payoff
 4802 bachelierCalculatorFromPayoffRaw :: (StrikedPayoff) -> (Double) -- ^forward
 4803  -> (Double) -- ^stdDev
 4804  -> (Double) -- ^discount
 4805  -> IO ((BachelierCalculator))
 4806 bachelierCalculatorFromPayoffRaw a1 a2 a3 a4 =
 4807   withStrikedPayoff a1 $ \a1' -> 
 4808   let {a2' = realToFrac a2} in 
 4809   let {a3' = realToFrac a3} in 
 4810   let {a4' = realToFrac a4} in 
 4811   preErrorCheck $ \a5' -> 
 4812   bachelierCalculatorFromPayoffRaw'_ a1' a2' a3' a4' a5' >>= \res ->
 4813   peekBachelierCalculator res >>= \res' ->
 4814   errorCheck  a5'>>
 4815   return (res')
 4816 
 4817 
 4818 
 4819 -- |intermediate value used internally to derive the calculator's Greeks
 4820 qlBachelierCalculatorAlpha :: (BachelierCalculator) -> IO ((Double))
 4821 qlBachelierCalculatorAlpha a1 =
 4822   withBachelierCalculator a1 $ \a1' -> 
 4823   preErrorCheck $ \a2' -> 
 4824   qlBachelierCalculatorAlpha'_ a1' a2' >>= \res ->
 4825   let {res' = realToFrac res} in
 4826   errorCheck  a2'>>
 4827   return (res')
 4828 
 4829 
 4830 
 4831 -- |intermediate value used internally to derive the calculator's Greeks
 4832 qlBachelierCalculatorBeta :: (BachelierCalculator) -> IO ((Double))
 4833 qlBachelierCalculatorBeta a1 =
 4834   withBachelierCalculator a1 $ \a1' -> 
 4835   preErrorCheck $ \a2' -> 
 4836   qlBachelierCalculatorBeta'_ a1' a2' >>= \res ->
 4837   let {res' = realToFrac res} in
 4838   errorCheck  a2'>>
 4839   return (res')
 4840 
 4841 
 4842 
 4843 -- |Sensitivity to change in the underlying spot price.
 4844 qlBachelierCalculatorDelta :: (BachelierCalculator) -> (Double) -- ^spot
 4845  -> IO ((Double))
 4846 qlBachelierCalculatorDelta a1 a2 =
 4847   withBachelierCalculator a1 $ \a1' -> 
 4848   let {a2' = realToFrac a2} in 
 4849   preErrorCheck $ \a3' -> 
 4850   qlBachelierCalculatorDelta'_ a1' a2' a3' >>= \res ->
 4851   let {res' = realToFrac res} in
 4852   errorCheck  a3'>>
 4853   return (res')
 4854 
 4855 
 4856 
 4857 -- |Sensitivity to change in the underlying forward price.
 4858 qlBachelierCalculatorDeltaForward :: (BachelierCalculator) -> IO ((Double))
 4859 qlBachelierCalculatorDeltaForward a1 =
 4860   withBachelierCalculator a1 $ \a1' -> 
 4861   preErrorCheck $ \a2' -> 
 4862   qlBachelierCalculatorDeltaForward'_ a1' a2' >>= \res ->
 4863   let {res' = realToFrac res} in
 4864   errorCheck  a2'>>
 4865   return (res')
 4866 
 4867 
 4868 
 4869 -- |Sensitivity to dividend/growth rate.
 4870 qlBachelierCalculatorDividendRho :: (BachelierCalculator) -> (Double) -- ^maturity
 4871  -> IO ((Double))
 4872 qlBachelierCalculatorDividendRho a1 a2 =
 4873   withBachelierCalculator a1 $ \a1' -> 
 4874   let {a2' = realToFrac a2} in 
 4875   preErrorCheck $ \a3' -> 
 4876   qlBachelierCalculatorDividendRho'_ a1' a2' a3' >>= \res ->
 4877   let {res' = realToFrac res} in
 4878   errorCheck  a3'>>
 4879   return (res')
 4880 
 4881 
 4882 
 4883 -- |Sensitivity in percent to a percent change in the underlying spot price.
 4884 qlBachelierCalculatorElasticity :: (BachelierCalculator) -> (Double) -- ^spot
 4885  -> IO ((Double))
 4886 qlBachelierCalculatorElasticity a1 a2 =
 4887   withBachelierCalculator a1 $ \a1' -> 
 4888   let {a2' = realToFrac a2} in 
 4889   preErrorCheck $ \a3' -> 
 4890   qlBachelierCalculatorElasticity'_ a1' a2' a3' >>= \res ->
 4891   let {res' = realToFrac res} in
 4892   errorCheck  a3'>>
 4893   return (res')
 4894 
 4895 
 4896 
 4897 -- |Sensitivity in percent to a percent change in the underlying forward price.
 4898 qlBachelierCalculatorElasticityForward :: (BachelierCalculator) -> IO ((Double))
 4899 qlBachelierCalculatorElasticityForward a1 =
 4900   withBachelierCalculator a1 $ \a1' -> 
 4901   preErrorCheck $ \a2' -> 
 4902   qlBachelierCalculatorElasticityForward'_ a1' a2' >>= \res ->
 4903   let {res' = realToFrac res} in
 4904   errorCheck  a2'>>
 4905   return (res')
 4906 
 4907 
 4908 
 4909 -- |Second order derivative with respect to change in the underlying spot price.
 4910 qlBachelierCalculatorGamma :: (BachelierCalculator) -> (Double) -- ^spot
 4911  -> IO ((Double))
 4912 qlBachelierCalculatorGamma a1 a2 =
 4913   withBachelierCalculator a1 $ \a1' -> 
 4914   let {a2' = realToFrac a2} in 
 4915   preErrorCheck $ \a3' -> 
 4916   qlBachelierCalculatorGamma'_ a1' a2' a3' >>= \res ->
 4917   let {res' = realToFrac res} in
 4918   errorCheck  a3'>>
 4919   return (res')
 4920 
 4921 
 4922 
 4923 -- |Second order derivative with respect to change in the underlying forward price.
 4924 qlBachelierCalculatorGammaForward :: (BachelierCalculator) -> IO ((Double))
 4925 qlBachelierCalculatorGammaForward a1 =
 4926   withBachelierCalculator a1 $ \a1' -> 
 4927   preErrorCheck $ \a2' -> 
 4928   qlBachelierCalculatorGammaForward'_ a1' a2' >>= \res ->
 4929   let {res' = realToFrac res} in
 4930   errorCheck  a2'>>
 4931   return (res')
 4932 
 4933 
 4934 
 4935 -- |Probability of being in the money in the asset martingale measure, i.e. N(d). It is a risk-neutral probability, not the real world one.
 4936 qlBachelierCalculatorItmAssetProbability :: (BachelierCalculator) -> IO ((Double))
 4937 qlBachelierCalculatorItmAssetProbability a1 =
 4938   withBachelierCalculator a1 $ \a1' -> 
 4939   preErrorCheck $ \a2' -> 
 4940   qlBachelierCalculatorItmAssetProbability'_ a1' a2' >>= \res ->
 4941   let {res' = realToFrac res} in
 4942   errorCheck  a2'>>
 4943   return (res')
 4944 
 4945 
 4946 
 4947 -- |Probability of being in the money in the bond martingale measure, i.e. N(d). It is a risk-neutral probability, not the real world one.
 4948 qlBachelierCalculatorItmCashProbability :: (BachelierCalculator) -> IO ((Double))
 4949 qlBachelierCalculatorItmCashProbability a1 =
 4950   withBachelierCalculator a1 $ \a1' -> 
 4951   preErrorCheck $ \a2' -> 
 4952   qlBachelierCalculatorItmCashProbability'_ a1' a2' >>= \res ->
 4953   let {res' = realToFrac res} in
 4954   errorCheck  a2'>>
 4955   return (res')
 4956 
 4957 
 4958 
 4959 -- |Sensitivity to discounting rate.
 4960 qlBachelierCalculatorRho :: (BachelierCalculator) -> (Double) -- ^maturity
 4961  -> IO ((Double))
 4962 qlBachelierCalculatorRho a1 a2 =
 4963   withBachelierCalculator a1 $ \a1' -> 
 4964   let {a2' = realToFrac a2} in 
 4965   preErrorCheck $ \a3' -> 
 4966   qlBachelierCalculatorRho'_ a1' a2' a3' >>= \res ->
 4967   let {res' = realToFrac res} in
 4968   errorCheck  a3'>>
 4969   return (res')
 4970 
 4971 
 4972 
 4973 -- |Sensitivity to strike.
 4974 qlBachelierCalculatorStrikeSensitivity :: (BachelierCalculator) -> IO ((Double))
 4975 qlBachelierCalculatorStrikeSensitivity a1 =
 4976   withBachelierCalculator a1 $ \a1' -> 
 4977   preErrorCheck $ \a2' -> 
 4978   qlBachelierCalculatorStrikeSensitivity'_ a1' a2' >>= \res ->
 4979   let {res' = realToFrac res} in
 4980   errorCheck  a2'>>
 4981   return (res')
 4982 
 4983 
 4984 
 4985 -- |gamma w.r.t. strike.
 4986 qlBachelierCalculatorStrikeGamma :: (BachelierCalculator) -> IO ((Double))
 4987 qlBachelierCalculatorStrikeGamma a1 =
 4988   withBachelierCalculator a1 $ \a1' -> 
 4989   preErrorCheck $ \a2' -> 
 4990   qlBachelierCalculatorStrikeGamma'_ a1' a2' >>= \res ->
 4991   let {res' = realToFrac res} in
 4992   errorCheck  a2'>>
 4993   return (res')
 4994 
 4995 
 4996 
 4997 -- |Sensitivity to time to maturity.
 4998 qlBachelierCalculatorTheta :: (BachelierCalculator) -> (Double) -- ^spot
 4999  -> (Double) -- ^maturity
 5000  -> IO ((Double))
 5001 qlBachelierCalculatorTheta a1 a2 a3 =
 5002   withBachelierCalculator a1 $ \a1' -> 
 5003   let {a2' = realToFrac a2} in 
 5004   let {a3' = realToFrac a3} in 
 5005   preErrorCheck $ \a4' -> 
 5006   qlBachelierCalculatorTheta'_ a1' a2' a3' a4' >>= \res ->
 5007   let {res' = realToFrac res} in
 5008   errorCheck  a4'>>
 5009   return (res')
 5010 
 5011 
 5012 
 5013 -- |Sensitivity to time to maturity per day, assuming 365 day per year.
 5014 qlBachelierCalculatorThetaPerDay :: (BachelierCalculator) -> (Double) -- ^spot
 5015  -> (Double) -- ^maturity
 5016  -> IO ((Double))
 5017 qlBachelierCalculatorThetaPerDay a1 a2 a3 =
 5018   withBachelierCalculator a1 $ \a1' -> 
 5019   let {a2' = realToFrac a2} in 
 5020   let {a3' = realToFrac a3} in 
 5021   preErrorCheck $ \a4' -> 
 5022   qlBachelierCalculatorThetaPerDay'_ a1' a2' a3' a4' >>= \res ->
 5023   let {res' = realToFrac res} in
 5024   errorCheck  a4'>>
 5025   return (res')
 5026 
 5027 
 5028 
 5029 -- |the option's fair value
 5030 qlBachelierCalculatorValue :: (BachelierCalculator) -> IO ((Double))
 5031 qlBachelierCalculatorValue a1 =
 5032   withBachelierCalculator a1 $ \a1' -> 
 5033   preErrorCheck $ \a2' -> 
 5034   qlBachelierCalculatorValue'_ a1' a2' >>= \res ->
 5035   let {res' = realToFrac res} in
 5036   errorCheck  a2'>>
 5037   return (res')
 5038 
 5039 
 5040 
 5041 -- |Sensitivity of vega to spot (Vanna).
 5042 bachelierVanna :: (BachelierCalculator) -> (Double) -- ^maturity
 5043  -> IO ((Double))
 5044 bachelierVanna a1 a2 =
 5045   withBachelierCalculator a1 $ \a1' -> 
 5046   let {a2' = realToFrac a2} in 
 5047   preErrorCheck $ \a3' -> 
 5048   bachelierVanna'_ a1' a2' a3' >>= \res ->
 5049   let {res' = realToFrac res} in
 5050   errorCheck  a3'>>
 5051   return (res')
 5052 
 5053 
 5054 
 5055 -- |Sensitivity to volatility.
 5056 qlBachelierCalculatorVega :: (BachelierCalculator) -> (Double) -- ^maturity
 5057  -> IO ((Double))
 5058 qlBachelierCalculatorVega a1 a2 =
 5059   withBachelierCalculator a1 $ \a1' -> 
 5060   let {a2' = realToFrac a2} in 
 5061   preErrorCheck $ \a3' -> 
 5062   qlBachelierCalculatorVega'_ a1' a2' a3' >>= \res ->
 5063   let {res' = realToFrac res} in
 5064   errorCheck  a3'>>
 5065   return (res')
 5066 
 5067 
 5068 
 5069 -- |Sensitivity of vega to volatility (Volga).
 5070 qlBachelierCalculatorVolga :: (BachelierCalculator) -> (Double) -- ^maturity
 5071  -> IO ((Double))
 5072 qlBachelierCalculatorVolga a1 a2 =
 5073   withBachelierCalculator a1 $ \a1' -> 
 5074   let {a2' = realToFrac a2} in 
 5075   preErrorCheck $ \a3' -> 
 5076   qlBachelierCalculatorVolga'_ a1' a2' a3' >>= \res ->
 5077   let {res' = realToFrac res} in
 5078   errorCheck  a3'>>
 5079   return (res')
 5080 
 5081 
 5082 
 5083 -- |The common Black and Bachelier option-calculator surface. Operations whose inputs differ
 5084 -- between the models, such as vanna, remain model-qualified functions.
 5085 class HasOptionCalculator a where
 5086   alpha :: a -> IO Double
 5087   beta :: a -> IO Double
 5088   delta :: a -> Double -> IO Double
 5089   deltaForward :: a -> IO Double
 5090   dividendRho :: a -> Double -> IO Double
 5091   elasticity :: a -> Double -> IO Double
 5092   elasticityForward :: a -> IO Double
 5093   gamma :: a -> Double -> IO Double
 5094   gammaForward :: a -> IO Double
 5095   itmAssetProbability :: a -> IO Double
 5096   itmCashProbability :: a -> IO Double
 5097   rho :: a -> Double -> IO Double
 5098   strikeSensitivity :: a -> IO Double
 5099   strikeGamma :: a -> IO Double
 5100   theta :: a -> Double -> Double -> IO Double
 5101   thetaPerDay :: a -> Double -> Double -> IO Double
 5102   value :: a -> IO Double
 5103   vega :: a -> Double -> IO Double
 5104   volga :: a -> Double -> IO Double
 5105 
 5106 instance HasOptionCalculator (GenBlackCalculator bc) where
 5107   alpha = qlBlackCalculatorAlpha
 5108   beta = qlBlackCalculatorBeta
 5109   delta = qlBlackCalculatorDelta
 5110   deltaForward = qlBlackCalculatorDeltaForward
 5111   dividendRho = qlBlackCalculatorDividendRho
 5112   elasticity = qlBlackCalculatorElasticity
 5113   elasticityForward = qlBlackCalculatorElasticityForward
 5114   gamma = qlBlackCalculatorGamma
 5115   gammaForward = qlBlackCalculatorGammaForward
 5116   itmAssetProbability = qlBlackCalculatorItmAssetProbability
 5117   itmCashProbability = qlBlackCalculatorItmCashProbability
 5118   rho = qlBlackCalculatorRho
 5119   strikeSensitivity = qlBlackCalculatorStrikeSensitivity
 5120   strikeGamma = qlBlackCalculatorStrikeGamma
 5121   theta = qlBlackCalculatorTheta
 5122   thetaPerDay = qlBlackCalculatorThetaPerDay
 5123   value = qlBlackCalculatorValue
 5124   vega = qlBlackCalculatorVega
 5125   volga = qlBlackCalculatorVolga
 5126 
 5127 instance HasOptionCalculator BachelierCalculator where
 5128   alpha = qlBachelierCalculatorAlpha
 5129   beta = qlBachelierCalculatorBeta
 5130   delta = qlBachelierCalculatorDelta
 5131   deltaForward = qlBachelierCalculatorDeltaForward
 5132   dividendRho = qlBachelierCalculatorDividendRho
 5133   elasticity = qlBachelierCalculatorElasticity
 5134   elasticityForward = qlBachelierCalculatorElasticityForward
 5135   gamma = qlBachelierCalculatorGamma
 5136   gammaForward = qlBachelierCalculatorGammaForward
 5137   itmAssetProbability = qlBachelierCalculatorItmAssetProbability
 5138   itmCashProbability = qlBachelierCalculatorItmCashProbability
 5139   rho = qlBachelierCalculatorRho
 5140   strikeSensitivity = qlBachelierCalculatorStrikeSensitivity
 5141   strikeGamma = qlBachelierCalculatorStrikeGamma
 5142   theta = qlBachelierCalculatorTheta
 5143   thetaPerDay = qlBachelierCalculatorThetaPerDay
 5144   value = qlBachelierCalculatorValue
 5145   vega = qlBachelierCalculatorVega
 5146   volga = qlBachelierCalculatorVolga
 5147 
 5148 -- |computes the strike given the option's Black-Scholes delta (in an FX-style delta/vol quotation)
 5149 blackDeltaCalculator :: (OptionType) -> (DeltaType) -> (Double) -- ^spot
 5150  -> (Double) -- ^dDiscount (domestic discount factor)
 5151  -> (Double) -- ^fDiscount (foreign discount factor)
 5152  -> (Double) -- ^stdDev
 5153  -> IO ((BlackDeltaCalculator))
 5154 blackDeltaCalculator a1 a2 a3 a4 a5 a6 =
 5155   let {a1' = fromEnumC a1} in 
 5156   let {a2' = fromEnumC a2} in 
 5157   let {a3' = realToFrac a3} in 
 5158   let {a4' = realToFrac a4} in 
 5159   let {a5' = realToFrac a5} in 
 5160   let {a6' = realToFrac a6} in 
 5161   preErrorCheck $ \a7' -> 
 5162   blackDeltaCalculator'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5163   peekBlackDeltaCalculator res >>= \res' ->
 5164   errorCheck  a7'>>
 5165   return (res')
 5166 
 5167 
 5168 
 5169 -- |the option delta under the calculator's chosen convention, for the given strike
 5170 deltaFromStrike :: (BlackDeltaCalculator) -> (Double) -- ^strike
 5171  -> IO ((Double))
 5172 deltaFromStrike a1 a2 =
 5173   withBlackDeltaCalculator a1 $ \a1' -> 
 5174   let {a2' = realToFrac a2} in 
 5175   preErrorCheck $ \a3' -> 
 5176   deltaFromStrike'_ a1' a2' a3' >>= \res ->
 5177   let {res' = realToFrac res} in
 5178   errorCheck  a3'>>
 5179   return (res')
 5180 
 5181 
 5182 
 5183 -- |the strike price corresponding to the given option delta (under the calculator's chosen convention)
 5184 strikeFromDelta :: (BlackDeltaCalculator) -> (Double) -- ^delta
 5185  -> IO ((Double))
 5186 strikeFromDelta a1 a2 =
 5187   withBlackDeltaCalculator a1 $ \a1' -> 
 5188   let {a2' = realToFrac a2} in 
 5189   preErrorCheck $ \a3' -> 
 5190   strikeFromDelta'_ a1' a2' a3' >>= \res ->
 5191   let {res' = realToFrac res} in
 5192   errorCheck  a3'>>
 5193   return (res')
 5194 
 5195 
 5196 
 5197 -- |the at-the-money strike under the given ATM convention, independent of the strike passed at construction
 5198 atmStrike :: (BlackDeltaCalculator) -> (AtmType) -> IO ((Double))
 5199 atmStrike a1 a2 =
 5200   withBlackDeltaCalculator a1 $ \a1' -> 
 5201   let {a2' = fromEnumC a2} in 
 5202   preErrorCheck $ \a3' -> 
 5203   atmStrike'_ a1' a2' a3' >>= \res ->
 5204   let {res' = realToFrac res} in
 5205   errorCheck  a3'>>
 5206   return (res')
 5207 
 5208 
 5209 
 5210 -- |Black 1976 formula /Warning/ instead of volatility it uses standard deviation, i.e. volatility*sqrt(timeToMaturity)
 5211 blackFormula :: (OptionType) -> (Double) -- ^strike
 5212  -> (Double) -- ^forward
 5213  -> (Double) -- ^stdDev
 5214  -> (Double) -- ^discount
 5215  -> (Double) -- ^displacement
 5216  -> IO ((Double))
 5217 blackFormula a1 a2 a3 a4 a5 a6 =
 5218   let {a1' = fromEnumC a1} in 
 5219   let {a2' = realToFrac a2} in 
 5220   let {a3' = realToFrac a3} in 
 5221   let {a4' = realToFrac a4} in 
 5222   let {a5' = realToFrac a5} in 
 5223   let {a6' = realToFrac a6} in 
 5224   preErrorCheck $ \a7' -> 
 5225   blackFormula'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5226   let {res' = realToFrac res} in
 5227   errorCheck  a7'>>
 5228   return (res')
 5229 
 5230 
 5231 
 5232 -- |Black 1976 probability of being in the money (in the bond martingale measure), i.e. N(d2). It is a risk-neutral probability, not the real world one. /Warning/ instead of volatility it uses standard deviation, i.e. volatility*sqrt(timeToMaturity)
 5233 blackCashItmProbability :: (OptionType) -> (Double) -> (Double) -- ^forward
 5234  -> (Double) -- ^stdDev
 5235  -> (Double) -- ^displacement
 5236  -> IO ((Double))
 5237 blackCashItmProbability a1 a2 a3 a4 a5 =
 5238   let {a1' = fromEnumC a1} in 
 5239   let {a2' = realToFrac a2} in 
 5240   let {a3' = realToFrac a3} in 
 5241   let {a4' = realToFrac a4} in 
 5242   let {a5' = realToFrac a5} in 
 5243   preErrorCheck $ \a6' -> 
 5244   blackCashItmProbability'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5245   let {res' = realToFrac res} in
 5246   errorCheck  a6'>>
 5247   return (res')
 5248 
 5249 
 5250 
 5251 -- |Black 1976 implied standard deviation, i.e. volatility*sqrt(timeToMaturity)
 5252 blackImpliedStdDev :: (OptionType) -> (Double) -- ^strike
 5253  -> (Double) -- ^forward
 5254  -> (Double) -- ^blackPrice
 5255  -> (Double) -- ^discount
 5256  -> (Double) -- ^displacement
 5257  -> (Double) -- ^guess
 5258  -> (Double) -- ^accuracy
 5259  -> (Word) -- ^maxIterations
 5260  -> IO ((Double))
 5261 blackImpliedStdDev a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 5262   let {a1' = fromEnumC a1} in 
 5263   let {a2' = realToFrac a2} in 
 5264   let {a3' = realToFrac a3} in 
 5265   let {a4' = realToFrac a4} in 
 5266   let {a5' = realToFrac a5} in 
 5267   let {a6' = realToFrac a6} in 
 5268   let {a7' = realToFrac a7} in 
 5269   let {a8' = realToFrac a8} in 
 5270   let {a9' = fromIntegral a9} in 
 5271   preErrorCheck $ \a10' -> 
 5272   blackImpliedStdDev'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 5273   let {res' = realToFrac res} in
 5274   errorCheck  a10'>>
 5275   return (res')
 5276 
 5277 
 5278 
 5279 -- |Approximated Black 1976 implied standard deviation, i.e. volatility*sqrt(timeToMaturity).It is calculated using Brenner and Subrahmanyan (1988) and Feinstein (1988) approximation for at-the-money forward option, with the extended moneyness approximation by Corrado and Miller (1996)
 5280 blackImpliedStdDevApproximation :: (OptionType) -> (Double) -- ^strike
 5281  -> (Double) -- ^forward
 5282  -> (Double) -- ^blackPrice
 5283  -> (Double) -- ^discount
 5284  -> (Double) -- ^displacement
 5285  -> IO ((Double))
 5286 blackImpliedStdDevApproximation a1 a2 a3 a4 a5 a6 =
 5287   let {a1' = fromEnumC a1} in 
 5288   let {a2' = realToFrac a2} in 
 5289   let {a3' = realToFrac a3} in 
 5290   let {a4' = realToFrac a4} in 
 5291   let {a5' = realToFrac a5} in 
 5292   let {a6' = realToFrac a6} in 
 5293   preErrorCheck $ \a7' -> 
 5294   blackImpliedStdDevApproximation'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5295   let {res' = realToFrac res} in
 5296   errorCheck  a7'>>
 5297   return (res')
 5298 
 5299 
 5300 
 5301 -- |Black 1976 formula for standard deviation derivative /Warning/ instead of volatility it uses standard deviation, i.e. volatility*sqrt(timeToMaturity), and it returns the derivative with respect to the standard deviation. If T is the time to maturity Black vega would be blackStdDevDerivative(strike, forward, stdDev)*sqrt(T)
 5302 blackStdDevDerivative :: (Double) -- ^strike
 5303  -> (Double) -- ^forward
 5304  -> (Double) -- ^stdDev
 5305  -> (Double) -- ^discount
 5306  -> (Double) -- ^displacement
 5307  -> IO ((Double))
 5308 blackStdDevDerivative a1 a2 a3 a4 a5 =
 5309   let {a1' = realToFrac a1} in 
 5310   let {a2' = realToFrac a2} in 
 5311   let {a3' = realToFrac a3} in 
 5312   let {a4' = realToFrac a4} in 
 5313   let {a5' = realToFrac a5} in 
 5314   preErrorCheck $ \a6' -> 
 5315   blackStdDevDerivative'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5316   let {res' = realToFrac res} in
 5317   errorCheck  a6'>>
 5318   return (res')
 5319 
 5320 
 5321 
 5322 -- |Black 1976 formula for derivative with respect to implied vol, this is basically the vega, but if you want 1% change multiply by 1%
 5323 blackVolDerivative :: (Double) -- ^strike
 5324  -> (Double) -- ^forward
 5325  -> (Double) -- ^stdDev
 5326  -> (Double) -- ^expiry
 5327  -> (Double) -- ^discount
 5328  -> (Double) -- ^displacement
 5329  -> IO ((Double))
 5330 blackVolDerivative a1 a2 a3 a4 a5 a6 =
 5331   let {a1' = realToFrac a1} in 
 5332   let {a2' = realToFrac a2} in 
 5333   let {a3' = realToFrac a3} in 
 5334   let {a4' = realToFrac a4} in 
 5335   let {a5' = realToFrac a5} in 
 5336   let {a6' = realToFrac a6} in 
 5337   preErrorCheck $ \a7' -> 
 5338   blackVolDerivative'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5339   let {res' = realToFrac res} in
 5340   errorCheck  a7'>>
 5341   return (res')
 5342 
 5343 
 5344 
 5345 -- |Black style formula when forward is normal rather than log-normal. This is essentially the model of Bachelier. /Warning/ Bachelier model needs absolute volatility, not percentage volatility. Standard deviation is absoluteVolatility*sqrt(timeToMaturity)
 5346 bachelierBlackFormula :: (OptionType) -> (Double) -- ^strike
 5347  -> (Double) -- ^forward
 5348  -> (Double) -- ^stdDev
 5349  -> (Double) -- ^discount
 5350  -> IO ((Double))
 5351 bachelierBlackFormula a1 a2 a3 a4 a5 =
 5352   let {a1' = fromEnumC a1} in 
 5353   let {a2' = realToFrac a2} in 
 5354   let {a3' = realToFrac a3} in 
 5355   let {a4' = realToFrac a4} in 
 5356   let {a5' = realToFrac a5} in 
 5357   preErrorCheck $ \a6' -> 
 5358   bachelierBlackFormula'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5359   let {res' = realToFrac res} in
 5360   errorCheck  a6'>>
 5361   return (res')
 5362 
 5363 
 5364 
 5365 -- |Black 1976 formula for the derivative with respect to the forward. /Warning/ instead of volatility it uses standard deviation, i.e. volatility*sqrt(timeToMaturity)
 5366 blackForwardDerivative :: (OptionType) -> (Double) -- ^strike
 5367  -> (Double) -- ^forward
 5368  -> (Double) -- ^stdDev
 5369  -> (Double) -- ^discount
 5370  -> (Double) -- ^displacement
 5371  -> IO ((Double))
 5372 blackForwardDerivative a1 a2 a3 a4 a5 a6 =
 5373   let {a1' = fromEnumC a1} in 
 5374   let {a2' = realToFrac a2} in 
 5375   let {a3' = realToFrac a3} in 
 5376   let {a4' = realToFrac a4} in 
 5377   let {a5' = realToFrac a5} in 
 5378   let {a6' = realToFrac a6} in 
 5379   preErrorCheck $ \a7' -> 
 5380   blackForwardDerivative'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5381   let {res' = realToFrac res} in
 5382   errorCheck  a7'>>
 5383   return (res')
 5384 
 5385 
 5386 
 5387 -- |Approximated Black 1976 implied standard deviation following Chambers and Nawalkha, /The Financial Review/ 2001, 89-100. The at-the-money option price must be known to use this method.
 5388 blackImpliedStdDevChambers :: (OptionType) -> (Double) -- ^strike
 5389  -> (Double) -- ^forward
 5390  -> (Double) -- ^blackPrice
 5391  -> (Double) -- ^blackAtmPrice
 5392  -> (Double) -- ^discount
 5393  -> (Double) -- ^displacement
 5394  -> IO ((Double))
 5395 blackImpliedStdDevChambers a1 a2 a3 a4 a5 a6 a7 =
 5396   let {a1' = fromEnumC a1} in 
 5397   let {a2' = realToFrac a2} in 
 5398   let {a3' = realToFrac a3} in 
 5399   let {a4' = realToFrac a4} in 
 5400   let {a5' = realToFrac a5} in 
 5401   let {a6' = realToFrac a6} in 
 5402   let {a7' = realToFrac a7} in 
 5403   preErrorCheck $ \a8' -> 
 5404   blackImpliedStdDevChambers'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 5405   let {res' = realToFrac res} in
 5406   errorCheck  a8'>>
 5407   return (res')
 5408 
 5409 
 5410 
 5411 -- |Approximated Black 1976 implied standard deviation following Radoicic and Stefanica, /An Explicit Implicit Volatility Formula/
 5412 blackImpliedStdDevApproximationRs :: (OptionType) -> (Double) -- ^strike
 5413  -> (Double) -- ^forward
 5414  -> (Double) -- ^blackPrice
 5415  -> (Double) -- ^discount
 5416  -> (Double) -- ^displacement
 5417  -> IO ((Double))
 5418 blackImpliedStdDevApproximationRs a1 a2 a3 a4 a5 a6 =
 5419   let {a1' = fromEnumC a1} in 
 5420   let {a2' = realToFrac a2} in 
 5421   let {a3' = realToFrac a3} in 
 5422   let {a4' = realToFrac a4} in 
 5423   let {a5' = realToFrac a5} in 
 5424   let {a6' = realToFrac a6} in 
 5425   preErrorCheck $ \a7' -> 
 5426   blackImpliedStdDevApproximationRs'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5427   let {res' = realToFrac res} in
 5428   errorCheck  a7'>>
 5429   return (res')
 5430 
 5431 
 5432 
 5433 -- |Black 1976 implied standard deviation by the Li-Rational-Substitution solver, started from the Radoicic-Stefanica approximation. Pass 'Nothing' for the guess to let QuantLib pick the starting point.
 5434 blackImpliedStdDevLiRs :: (OptionType) -> (Double) -- ^strike
 5435  -> (Double) -- ^forward
 5436  -> (Double) -- ^blackPrice
 5437  -> (Double) -- ^discount
 5438  -> (Double) -- ^displacement
 5439  -> (Maybe Double) -- ^guess
 5440  -> (Double) -- ^omega
 5441  -> (Double) -- ^accuracy
 5442  -> (Word) -- ^maxIterations
 5443  -> IO ((Double))
 5444 blackImpliedStdDevLiRs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 5445   let {a1' = fromEnumC a1} in 
 5446   let {a2' = realToFrac a2} in 
 5447   let {a3' = realToFrac a3} in 
 5448   let {a4' = realToFrac a4} in 
 5449   let {a5' = realToFrac a5} in 
 5450   let {a6' = realToFrac a6} in 
 5451   let {a7' = fromMaybeDouble a7} in 
 5452   let {a8' = realToFrac a8} in 
 5453   let {a9' = realToFrac a9} in 
 5454   let {a10' = fromIntegral a10} in 
 5455   preErrorCheck $ \a11' -> 
 5456   blackImpliedStdDevLiRs'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 5457   let {res' = realToFrac res} in
 5458   errorCheck  a11'>>
 5459   return (res')
 5460 
 5461 
 5462 
 5463 -- |Black 1976 probability of being in the money in the asset martingale measure, i.e. N(d1). It is a risk-neutral probability, not the real world one.
 5464 blackAssetItmProbability :: (OptionType) -> (Double) -- ^strike
 5465  -> (Double) -- ^forward
 5466  -> (Double) -- ^stdDev
 5467  -> (Double) -- ^displacement
 5468  -> IO ((Double))
 5469 blackAssetItmProbability a1 a2 a3 a4 a5 =
 5470   let {a1' = fromEnumC a1} in 
 5471   let {a2' = realToFrac a2} in 
 5472   let {a3' = realToFrac a3} in 
 5473   let {a4' = realToFrac a4} in 
 5474   let {a5' = realToFrac a5} in 
 5475   preErrorCheck $ \a6' -> 
 5476   blackAssetItmProbability'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5477   let {res' = realToFrac res} in
 5478   errorCheck  a6'>>
 5479   return (res')
 5480 
 5481 
 5482 
 5483 -- |Black 1976 formula for the second derivative with respect to the standard deviation. /Warning/ instead of volatility it uses standard deviation, i.e. volatility*sqrt(timeToMaturity)
 5484 blackStdDevSecondDerivative :: (Double) -- ^strike
 5485  -> (Double) -- ^forward
 5486  -> (Double) -- ^stdDev
 5487  -> (Double) -- ^discount
 5488  -> (Double) -- ^displacement
 5489  -> IO ((Double))
 5490 blackStdDevSecondDerivative a1 a2 a3 a4 a5 =
 5491   let {a1' = realToFrac a1} in 
 5492   let {a2' = realToFrac a2} in 
 5493   let {a3' = realToFrac a3} in 
 5494   let {a4' = realToFrac a4} in 
 5495   let {a5' = realToFrac a5} in 
 5496   preErrorCheck $ \a6' -> 
 5497   blackStdDevSecondDerivative'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5498   let {res' = realToFrac res} in
 5499   errorCheck  a6'>>
 5500   return (res')
 5501 
 5502 
 5503 
 5504 -- |Bachelier formula for the derivative with respect to the forward. /Warning/ the Bachelier model needs absolute volatility, not percentage volatility; standard deviation is absoluteVolatility*sqrt(timeToMaturity)
 5505 bachelierForwardDerivative :: (OptionType) -> (Double) -- ^strike
 5506  -> (Double) -- ^forward
 5507  -> (Double) -- ^stdDev
 5508  -> (Double) -- ^discount
 5509  -> IO ((Double))
 5510 bachelierForwardDerivative a1 a2 a3 a4 a5 =
 5511   let {a1' = fromEnumC a1} in 
 5512   let {a2' = realToFrac a2} in 
 5513   let {a3' = realToFrac a3} in 
 5514   let {a4' = realToFrac a4} in 
 5515   let {a5' = realToFrac a5} in 
 5516   preErrorCheck $ \a6' -> 
 5517   bachelierForwardDerivative'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5518   let {res' = realToFrac res} in
 5519   errorCheck  a6'>>
 5520   return (res')
 5521 
 5522 
 5523 
 5524 -- |Bachelier implied (absolute) volatility by the analytic formula of Jaeckel (2017), /Implied Normal Volatility/. Unlike the Black implied-standard-deviation functions this takes the time to expiry and returns a volatility, not a standard deviation.
 5525 bachelierImpliedVol :: (OptionType) -> (Double) -- ^strike
 5526  -> (Double) -- ^forward
 5527  -> (Double) -- ^tte
 5528  -> (Double) -- ^bachelierPrice
 5529  -> (Double) -- ^discount
 5530  -> IO ((Double))
 5531 bachelierImpliedVol a1 a2 a3 a4 a5 a6 =
 5532   let {a1' = fromEnumC a1} in 
 5533   let {a2' = realToFrac a2} in 
 5534   let {a3' = realToFrac a3} in 
 5535   let {a4' = realToFrac a4} in 
 5536   let {a5' = realToFrac a5} in 
 5537   let {a6' = realToFrac a6} in 
 5538   preErrorCheck $ \a7' -> 
 5539   bachelierImpliedVol'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5540   let {res' = realToFrac res} in
 5541   errorCheck  a7'>>
 5542   return (res')
 5543 
 5544 
 5545 
 5546 -- |Bachelier implied (absolute) volatility by the analytic approximation of Choi, Kim and Kwak (2009). Unlike the Black implied-standard-deviation functions this takes the time to expiry and returns a volatility, not a standard deviation.
 5547 bachelierImpliedVolChoi :: (OptionType) -> (Double) -- ^strike
 5548  -> (Double) -- ^forward
 5549  -> (Double) -- ^tte
 5550  -> (Double) -- ^bachelierPrice
 5551  -> (Double) -- ^discount
 5552  -> IO ((Double))
 5553 bachelierImpliedVolChoi a1 a2 a3 a4 a5 a6 =
 5554   let {a1' = fromEnumC a1} in 
 5555   let {a2' = realToFrac a2} in 
 5556   let {a3' = realToFrac a3} in 
 5557   let {a4' = realToFrac a4} in 
 5558   let {a5' = realToFrac a5} in 
 5559   let {a6' = realToFrac a6} in 
 5560   preErrorCheck $ \a7' -> 
 5561   bachelierImpliedVolChoi'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 5562   let {res' = realToFrac res} in
 5563   errorCheck  a7'>>
 5564   return (res')
 5565 
 5566 
 5567 
 5568 -- |Bachelier formula for the standard deviation derivative. /Warning/ it returns the derivative with respect to the standard deviation; Bachelier vega is this times sqrt(T).
 5569 bachelierStdDevDerivative :: (Double) -- ^strike
 5570  -> (Double) -- ^forward
 5571  -> (Double) -- ^stdDev
 5572  -> (Double) -- ^discount
 5573  -> IO ((Double))
 5574 bachelierStdDevDerivative a1 a2 a3 a4 =
 5575   let {a1' = realToFrac a1} in 
 5576   let {a2' = realToFrac a2} in 
 5577   let {a3' = realToFrac a3} in 
 5578   let {a4' = realToFrac a4} in 
 5579   preErrorCheck $ \a5' -> 
 5580   bachelierStdDevDerivative'_ a1' a2' a3' a4' a5' >>= \res ->
 5581   let {res' = realToFrac res} in
 5582   errorCheck  a5'>>
 5583   return (res')
 5584 
 5585 
 5586 
 5587 -- |Bachelier probability of being in the money in the asset martingale measure, i.e. N(d). It is a risk-neutral probability, not the real world one.
 5588 bachelierAssetItmProbability :: (OptionType) -> (Double) -- ^strike
 5589  -> (Double) -- ^forward
 5590  -> (Double) -- ^stdDev
 5591  -> IO ((Double))
 5592 bachelierAssetItmProbability a1 a2 a3 a4 =
 5593   let {a1' = fromEnumC a1} in 
 5594   let {a2' = realToFrac a2} in 
 5595   let {a3' = realToFrac a3} in 
 5596   let {a4' = realToFrac a4} in 
 5597   preErrorCheck $ \a5' -> 
 5598   bachelierAssetItmProbability'_ a1' a2' a3' a4' a5' >>= \res ->
 5599   let {res' = realToFrac res} in
 5600   errorCheck  a5'>>
 5601   return (res')
 5602 
 5603 
 5604 
 5605 -- |default theta-per-day calculation
 5606 defaultThetaPerDay :: (Double) -- ^theta
 5607  -> IO ((Double))
 5608 defaultThetaPerDay a1 =
 5609   let {a1' = realToFrac a1} in 
 5610   preErrorCheck $ \a2' -> 
 5611   defaultThetaPerDay'_ a1' a2' >>= \res ->
 5612   let {res' = realToFrac res} in
 5613   errorCheck  a2'>>
 5614   return (res')
 5615 
 5616 
 5617 
 5618 -- |lognormal SABR volatility, no validity checks on the parameters
 5619 unsafeSabrLogNormalVolatility :: (Double) -- ^strike
 5620  -> (Double) -- ^forward
 5621  -> (Double) -- ^expiryTime
 5622  -> (Double) -- ^alpha
 5623  -> (Double) -- ^beta
 5624  -> (Double) -- ^nu
 5625  -> (Double) -- ^rho
 5626  -> IO ((Double))
 5627 unsafeSabrLogNormalVolatility a1 a2 a3 a4 a5 a6 a7 =
 5628   let {a1' = realToFrac a1} in 
 5629   let {a2' = realToFrac a2} in 
 5630   let {a3' = realToFrac a3} in 
 5631   let {a4' = realToFrac a4} in 
 5632   let {a5' = realToFrac a5} in 
 5633   let {a6' = realToFrac a6} in 
 5634   let {a7' = realToFrac a7} in 
 5635   preErrorCheck $ \a8' -> 
 5636   unsafeSabrLogNormalVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 5637   let {res' = realToFrac res} in
 5638   errorCheck  a8'>>
 5639   return (res')
 5640 
 5641 
 5642 
 5643 -- |shifted SABR volatility (lognormal or normal), no validity checks on the parameters
 5644 unsafeShiftedSabrVolatility :: (Double) -- ^strike
 5645  -> (Double) -- ^forward
 5646  -> (Double) -- ^expiryTime
 5647  -> (Double) -- ^alpha
 5648  -> (Double) -- ^beta
 5649  -> (Double) -- ^nu
 5650  -> (Double) -- ^rho
 5651  -> (Double) -- ^shift
 5652  -> (VolatilityType) -- ^volatilityType
 5653  -> IO ((Double))
 5654 unsafeShiftedSabrVolatility a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 5655   let {a1' = realToFrac a1} in 
 5656   let {a2' = realToFrac a2} in 
 5657   let {a3' = realToFrac a3} in 
 5658   let {a4' = realToFrac a4} in 
 5659   let {a5' = realToFrac a5} in 
 5660   let {a6' = realToFrac a6} in 
 5661   let {a7' = realToFrac a7} in 
 5662   let {a8' = realToFrac a8} in 
 5663   let {a9' = (fromIntegral . fromEnum) a9} in 
 5664   preErrorCheck $ \a10' -> 
 5665   unsafeShiftedSabrVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 5666   let {res' = realToFrac res} in
 5667   errorCheck  a10'>>
 5668   return (res')
 5669 
 5670 
 5671 
 5672 -- |normal SABR volatility, no validity checks on the parameters
 5673 unsafeSabrNormalVolatility :: (Double) -- ^strike
 5674  -> (Double) -- ^forward
 5675  -> (Double) -- ^expiryTime
 5676  -> (Double) -- ^alpha
 5677  -> (Double) -- ^beta
 5678  -> (Double) -- ^nu
 5679  -> (Double) -- ^rho
 5680  -> IO ((Double))
 5681 unsafeSabrNormalVolatility a1 a2 a3 a4 a5 a6 a7 =
 5682   let {a1' = realToFrac a1} in 
 5683   let {a2' = realToFrac a2} in 
 5684   let {a3' = realToFrac a3} in 
 5685   let {a4' = realToFrac a4} in 
 5686   let {a5' = realToFrac a5} in 
 5687   let {a6' = realToFrac a6} in 
 5688   let {a7' = realToFrac a7} in 
 5689   preErrorCheck $ \a8' -> 
 5690   unsafeSabrNormalVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 5691   let {res' = realToFrac res} in
 5692   errorCheck  a8'>>
 5693   return (res')
 5694 
 5695 
 5696 
 5697 -- |SABR volatility (lognormal or normal), no validity checks on the parameters
 5698 unsafeSabrVolatility :: (Double) -- ^strike
 5699  -> (Double) -- ^forward
 5700  -> (Double) -- ^expiryTime
 5701  -> (Double) -- ^alpha
 5702  -> (Double) -- ^beta
 5703  -> (Double) -- ^nu
 5704  -> (Double) -- ^rho
 5705  -> (VolatilityType) -- ^volatilityType
 5706  -> IO ((Double))
 5707 unsafeSabrVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
 5708   let {a1' = realToFrac a1} in 
 5709   let {a2' = realToFrac a2} in 
 5710   let {a3' = realToFrac a3} in 
 5711   let {a4' = realToFrac a4} in 
 5712   let {a5' = realToFrac a5} in 
 5713   let {a6' = realToFrac a6} in 
 5714   let {a7' = realToFrac a7} in 
 5715   let {a8' = (fromIntegral . fromEnum) a8} in 
 5716   preErrorCheck $ \a9' -> 
 5717   unsafeSabrVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 5718   let {res' = realToFrac res} in
 5719   errorCheck  a9'>>
 5720   return (res')
 5721 
 5722 
 5723 
 5724 -- |SABR volatility (lognormal or normal), with validity checks on the parameters
 5725 sabrVolatility :: (Double) -- ^strike
 5726  -> (Double) -- ^forward
 5727  -> (Double) -- ^expiryTime
 5728  -> (Double) -- ^alpha
 5729  -> (Double) -- ^beta
 5730  -> (Double) -- ^nu
 5731  -> (Double) -- ^rho
 5732  -> (VolatilityType) -- ^volatilityType
 5733  -> IO ((Double))
 5734 sabrVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
 5735   let {a1' = realToFrac a1} in 
 5736   let {a2' = realToFrac a2} in 
 5737   let {a3' = realToFrac a3} in 
 5738   let {a4' = realToFrac a4} in 
 5739   let {a5' = realToFrac a5} in 
 5740   let {a6' = realToFrac a6} in 
 5741   let {a7' = realToFrac a7} in 
 5742   let {a8' = (fromIntegral . fromEnum) a8} in 
 5743   preErrorCheck $ \a9' -> 
 5744   sabrVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 5745   let {res' = realToFrac res} in
 5746   errorCheck  a9'>>
 5747   return (res')
 5748 
 5749 
 5750 
 5751 -- |shifted SABR volatility (lognormal or normal), with validity checks on the parameters
 5752 shiftedSabrVolatility :: (Double) -- ^strike
 5753  -> (Double) -- ^forward
 5754  -> (Double) -- ^expiryTime
 5755  -> (Double) -- ^alpha
 5756  -> (Double) -- ^beta
 5757  -> (Double) -- ^nu
 5758  -> (Double) -- ^rho
 5759  -> (Double) -- ^shift
 5760  -> (VolatilityType) -- ^volatilityType
 5761  -> IO ((Double))
 5762 shiftedSabrVolatility a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 5763   let {a1' = realToFrac a1} in 
 5764   let {a2' = realToFrac a2} in 
 5765   let {a3' = realToFrac a3} in 
 5766   let {a4' = realToFrac a4} in 
 5767   let {a5' = realToFrac a5} in 
 5768   let {a6' = realToFrac a6} in 
 5769   let {a7' = realToFrac a7} in 
 5770   let {a8' = realToFrac a8} in 
 5771   let {a9' = (fromIntegral . fromEnum) a9} in 
 5772   preErrorCheck $ \a10' -> 
 5773   shiftedSabrVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 5774   let {res' = realToFrac res} in
 5775   errorCheck  a10'>>
 5776   return (res')
 5777 
 5778 
 5779 
 5780 -- |lognormal SABR volatility using the Floc'h-Kennedy formula, with validity checks on the parameters
 5781 sabrFlochKennedyVolatility :: (Double) -- ^strike
 5782  -> (Double) -- ^forward
 5783  -> (Double) -- ^expiryTime
 5784  -> (Double) -- ^alpha
 5785  -> (Double) -- ^beta
 5786  -> (Double) -- ^nu
 5787  -> (Double) -- ^rho
 5788  -> IO ((Double))
 5789 sabrFlochKennedyVolatility a1 a2 a3 a4 a5 a6 a7 =
 5790   let {a1' = realToFrac a1} in 
 5791   let {a2' = realToFrac a2} in 
 5792   let {a3' = realToFrac a3} in 
 5793   let {a4' = realToFrac a4} in 
 5794   let {a5' = realToFrac a5} in 
 5795   let {a6' = realToFrac a6} in 
 5796   let {a7' = realToFrac a7} in 
 5797   preErrorCheck $ \a8' -> 
 5798   sabrFlochKennedyVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 5799   let {res' = realToFrac res} in
 5800   errorCheck  a8'>>
 5801   return (res')
 5802 
 5803 
 5804 
 5805 -- |validate SABR parameters, throwing if they are not acceptable
 5806 validateSabrParameters :: (Double) -- ^alpha
 5807  -> (Double) -- ^beta
 5808  -> (Double) -- ^nu
 5809  -> (Double) -- ^rho
 5810  -> IO ()
 5811 validateSabrParameters a1 a2 a3 a4 =
 5812   let {a1' = realToFrac a1} in 
 5813   let {a2' = realToFrac a2} in 
 5814   let {a3' = realToFrac a3} in 
 5815   let {a4' = realToFrac a4} in 
 5816   preErrorCheck $ \a5' -> 
 5817   validateSabrParameters'_ a1' a2' a3' a4' a5' >>
 5818   errorCheck  a5'>>
 5819   return ()
 5820 
 5821 
 5822 
 5823 -- |initial guess (alpha, beta, nu, rho) for SABR calibration, per Le Floc'h and Kennedy
 5824 sabrGuess :: (Double) -- ^k_m
 5825  -> (Double) -- ^vol_m
 5826  -> (Double) -- ^k_0
 5827  -> (Double) -- ^vol_0
 5828  -> (Double) -- ^k_p
 5829  -> (Double) -- ^vol_p
 5830  -> (Double) -- ^forward
 5831  -> (Double) -- ^expiryTime
 5832  -> (Double) -- ^beta
 5833  -> (Double) -- ^shift
 5834  -> (VolatilityType) -- ^volatilityType
 5835  -> IO (([Double]))
 5836 sabrGuess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 5837   let {a1' = realToFrac a1} in 
 5838   let {a2' = realToFrac a2} in 
 5839   let {a3' = realToFrac a3} in 
 5840   let {a4' = realToFrac a4} in 
 5841   let {a5' = realToFrac a5} in 
 5842   let {a6' = realToFrac a6} in 
 5843   let {a7' = realToFrac a7} in 
 5844   let {a8' = realToFrac a8} in 
 5845   let {a9' = realToFrac a9} in 
 5846   let {a10' = realToFrac a10} in 
 5847   let {a11' = (fromIntegral . fromEnum) a11} in 
 5848   preDoubleArray $ \(a12'1, a12'2) -> 
 5849   preErrorCheck $ \a13' -> 
 5850   sabrGuess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12'1  a12'2 a13' >>
 5851   peekDoubleArray  a12'1  a12'2>>= \a12'' -> 
 5852   errorCheck  a13'>>
 5853   return (a12'')
 5854 
 5855 
 5856 
 5857 -- |Black 1976 option-price calculator.
 5858 blackCalculator :: StrikeSpec -> Double -> Double -> Double -> IO BlackCalculator
 5859 blackCalculator spec = case spec of
 5860   Strike t k -> blackCalculatorAtStrikeRaw t k
 5861   StrikePayoff p -> blackCalculatorFromPayoffRaw p
 5862 
 5863 -- |Black-Scholes-Merton option-price calculator.
 5864 blackScholesCalculator :: StrikeSpec -> Double -> Double -> Double -> Double
 5865   -> IO BlackScholesCalculator
 5866 blackScholesCalculator spec = case spec of
 5867   Strike t k -> blackScholesCalculatorAtStrikeRaw t k
 5868   StrikePayoff p -> blackScholesCalculatorFromPayoffRaw p
 5869 
 5870 -- |Bachelier (normal-model) option-price calculator.
 5871 bachelierCalculator :: StrikeSpec -> Double -> Double -> Double -> IO BachelierCalculator
 5872 bachelierCalculator spec = case spec of
 5873   Strike t k -> bachelierCalculatorAtStrikeRaw t k
 5874   StrikePayoff p -> bachelierCalculatorFromPayoffRaw p
 5875 
 5876 -- |Fractional Riccati solver. Pade is most accurate for strongly negative correlation.
 5877 data RoughHestonApproximation = AdamsPredictorCorrector | Pade | Lifted Word deriving (Eq, Show, Read)
 5878 -- |Construction-time Fourier integration configuration for Rough Heston (1.44).
 5879 data FourierIntegration
 5880   = FourierGaussLaguerre Word | FourierGaussLegendre Word
 5881   | FourierGaussChebyshev Word | FourierGaussChebyshev2nd Word
 5882   | FourierGaussLobatto Double Double Word Bool
 5883   | FourierGaussKronrod Double Word | FourierSimpson Double Word | FourierTrapezoid Double Word
 5884   | FourierDiscreteSimpson Word | FourierDiscreteTrapezoid Word
 5885   | FourierExpSinh Double | FourierTanhSinh Double
 5886   deriving (Eq, Show, Read)
 5887 roughApproximation :: RoughHestonApproximation -> (Int, Word)
 5888 roughApproximation AdamsPredictorCorrector = (0, 20)
 5889 roughApproximation Pade = (1, 20)
 5890 roughApproximation (Lifted factors) = (2, factors)
 5891 fourierConfiguration :: FourierIntegration -> (Int, Word, Double, Double, Bool)
 5892 fourierConfiguration integration = case integration of
 5893   FourierGaussLaguerre n -> (0, n, 0, 0, False)
 5894   FourierGaussLegendre n -> (1, n, 0, 0, False)
 5895   FourierGaussChebyshev n -> (2, n, 0, 0, False)
 5896   FourierGaussChebyshev2nd n -> (3, n, 0, 0, False)
 5897   FourierGaussLobatto r a n c -> (4, n, r, a, c)
 5898   FourierGaussKronrod a n -> (5, n, 0, a, False)
 5899   FourierSimpson a n -> (6, n, 0, a, False)
 5900   FourierTrapezoid a n -> (7, n, 0, a, False)
 5901   FourierDiscreteSimpson n -> (8, n, 0, 0, False)
 5902   FourierDiscreteTrapezoid n -> (9, n, 0, 0, False)
 5903   FourierExpSinh r -> (10, 0, r, 0, False)
 5904   FourierTanhSinh r -> (11, 0, r, 0, False)
 5905 
 5906 -- |European vanilla engine with Gauss-Laguerre integration (1.44).
 5907 -- Upstream defaults are order 128 and 256 Riccati steps; Adams costs O(steps^2).
 5908 analyticRoughHestonEngine :: RoughHestonModel -- ^Calibrated model
 5909   -> Word -- ^Gauss-Laguerre integration order
 5910   -> Word -- ^Riccati time steps
 5911   -> RoughHestonApproximation -- ^Riccati approximation and lifted factor count
 5912   -> IO AnalyticRoughHestonEngine
 5913 analyticRoughHestonEngine model order steps approximation =
 5914   let (method, factors) = roughApproximation approximation
 5915   in roughHestonEngineRaw model order steps method factors
 5916 -- |Native fixed-order construction.
 5917 roughHestonEngineRaw :: (RoughHestonModel) -- ^model
 5918  -> (Word) -- ^integrationOrder
 5919  -> (Word) -- ^timeSteps
 5920  -> (Int) -- ^approximation
 5921  -> (Word) -- ^nFactors
 5922  -> IO ((AnalyticRoughHestonEngine))
 5923 roughHestonEngineRaw a1 a2 a3 a4 a5 =
 5924   withRoughHestonModel a1 $ \a1' -> 
 5925   let {a2' = fromIntegral a2} in 
 5926   let {a3' = fromIntegral a3} in 
 5927   let {a4' = fromIntegral a4} in 
 5928   let {a5' = fromIntegral a5} in 
 5929   preErrorCheck $ \a6' -> 
 5930   roughHestonEngineRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 5931   peekAnalyticRoughHestonEngine res >>= \res' ->
 5932   errorCheck  a6'>>
 5933   return (res')
 5934 
 5935 
 5936 
 5937 -- |European engine with full Fourier integration controls (1.44).
 5938 -- Upstream defaults: steps 256, epsilon 1e-25, dampening alpha -0.5; alpha must be in (-1, 0).
 5939 analyticRoughHestonEngineWithIntegration :: RoughHestonModel -- ^Calibrated model
 5940   -> FourierIntegration -- ^Integration algorithm and tolerances/order
 5941   -> Word -- ^Riccati time steps
 5942   -> Double -- ^Andersen-Piterbarg integration-limit epsilon
 5943   -> Double -- ^Dampening alpha, strictly between -1 and 0
 5944   -> RoughHestonApproximation -- ^Riccati approximation and lifted factor count
 5945   -> IO AnalyticRoughHestonEngine
 5946 analyticRoughHestonEngineWithIntegration model integration steps epsilon dampening approximation =
 5947   let (algorithm, count, relative, absolute, convergence) = fourierConfiguration integration
 5948       (method, factors) = roughApproximation approximation
 5949   in roughHestonEngineIntegrationRaw model algorithm count relative absolute convergence steps epsilon dampening method factors
 5950 -- |Native integration construction.
 5951 roughHestonEngineIntegrationRaw :: (RoughHestonModel) -- ^model
 5952  -> (Int) -- ^algorithm
 5953  -> (Word) -- ^count
 5954  -> (Double) -- ^relative
 5955  -> (Double) -- ^absolute
 5956  -> (Bool) -- ^convergence
 5957  -> (Word) -- ^timeSteps
 5958  -> (Double) -- ^epsilon
 5959  -> (Double) -- ^alpha
 5960  -> (Int) -- ^approximation
 5961  -> (Word) -- ^nFactors
 5962  -> IO ((AnalyticRoughHestonEngine))
 5963 roughHestonEngineIntegrationRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 5964   withRoughHestonModel a1 $ \a1' -> 
 5965   let {a2' = fromIntegral a2} in 
 5966   let {a3' = fromIntegral a3} in 
 5967   let {a4' = realToFrac a4} in 
 5968   let {a5' = realToFrac a5} in 
 5969   let {a6' = C2HSImp.fromBool a6} in 
 5970   let {a7' = fromIntegral a7} in 
 5971   let {a8' = realToFrac a8} in 
 5972   let {a9' = realToFrac a9} in 
 5973   let {a10' = fromIntegral a10} in 
 5974   let {a11' = fromIntegral a11} in 
 5975   preErrorCheck $ \a12' -> 
 5976   roughHestonEngineIntegrationRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 5977   peekAnalyticRoughHestonEngine res >>= \res' ->
 5978   errorCheck  a12'>>
 5979   return (res')
 5980 
 5981 
 5982 
 5983 -- |Normalized log-forward chF at time in years (1.44).
 5984 roughHestonCharacteristicFunction :: (AnalyticRoughHestonEngine) -- ^engine
 5985  -> (Complex Double) -- ^frequency
 5986  -> (Double) -- ^time
 5987  -> IO ((Complex Double))
 5988 roughHestonCharacteristicFunction a1 a2 a3 =
 5989   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 5990   let {(a2'1, a2'2) = withComplex a2} in 
 5991   let {a3' = realToFrac a3} in 
 5992   preComplex $ \(a4'1, a4'2) -> 
 5993   preErrorCheck $ \a5' -> 
 5994   roughHestonCharacteristicFunction'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' >>
 5995   peekComplex  a4'1  a4'2>>= \a4'' -> 
 5996   errorCheck  a5'>>
 5997   return (a4'')
 5998 
 5999 
 6000 
 6001 -- |Normalized log-forward lnChF at time in years (1.44).
 6002 roughHestonLogCharacteristicFunction :: (AnalyticRoughHestonEngine) -- ^engine
 6003  -> (Complex Double) -- ^frequency
 6004  -> (Double) -- ^time
 6005  -> IO ((Complex Double))
 6006 roughHestonLogCharacteristicFunction a1 a2 a3 =
 6007   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 6008   let {(a2'1, a2'2) = withComplex a2} in 
 6009   let {a3' = realToFrac a3} in 
 6010   preComplex $ \(a4'1, a4'2) -> 
 6011   preErrorCheck $ \a5' -> 
 6012   roughHestonLogCharacteristicFunction'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' >>
 6013   peekComplex  a4'1  a4'2>>= \a4'' -> 
 6014   errorCheck  a5'>>
 6015   return (a4'')
 6016 
 6017 
 6018 
 6019 -- |Normalized log-forward riccatiSolution at time in years (1.44).
 6020 roughHestonRiccatiSolution :: (AnalyticRoughHestonEngine) -- ^engine
 6021  -> (Complex Double) -- ^frequency
 6022  -> (Double) -- ^time
 6023  -> IO ((Complex Double))
 6024 roughHestonRiccatiSolution a1 a2 a3 =
 6025   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 6026   let {(a2'1, a2'2) = withComplex a2} in 
 6027   let {a3' = realToFrac a3} in 
 6028   preComplex $ \(a4'1, a4'2) -> 
 6029   preErrorCheck $ \a5' -> 
 6030   roughHestonRiccatiSolution'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' >>
 6031   peekComplex  a4'1  a4'2>>= \a4'' -> 
 6032   errorCheck  a5'>>
 6033   return (a4'')
 6034 
 6035 
 6036 
 6037 -- |Fourier evaluations in the most recent pricing calculation (1.44).
 6038 roughHestonNumberOfEvaluations :: (AnalyticRoughHestonEngine) -- ^engine
 6039  -> IO ((Word))
 6040 roughHestonNumberOfEvaluations a1 =
 6041   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 6042   preErrorCheck $ \a2' -> 
 6043   roughHestonNumberOfEvaluations'_ a1' a2' >>= \res ->
 6044   let {res' = fromIntegral res} in
 6045   errorCheck  a2'>>
 6046   return (res')
 6047 
 6048 
 6049 
 6050 -- |Native direct European pricing.
 6051 roughHestonPriceDateRaw :: (AnalyticRoughHestonEngine) -- ^engine
 6052  -> (PlainVanillaPayoff) -- ^payoff
 6053  -> (Day) -- ^maturity
 6054  -> IO ((Double))
 6055 roughHestonPriceDateRaw a1 a2 a3 =
 6056   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 6057   withPlainVanillaPayoff a2 $ \a2' -> 
 6058   withDay a3 $ \a3' -> 
 6059   preErrorCheck $ \a4' -> 
 6060   roughHestonPriceDateRaw'_ a1' a2' a3' a4' >>= \res ->
 6061   let {res' = realToFrac res} in
 6062   errorCheck  a4'>>
 6063   return (res')
 6064 
 6065 
 6066 
 6067 -- |Native direct European pricing.
 6068 roughHestonPriceTimeRaw :: (AnalyticRoughHestonEngine) -- ^engine
 6069  -> (PlainVanillaPayoff) -- ^payoff
 6070  -> (Double) -- ^maturity
 6071  -> IO ((Double))
 6072 roughHestonPriceTimeRaw a1 a2 a3 =
 6073   withAnalyticRoughHestonEngine a1 $ \a1' -> 
 6074   withPlainVanillaPayoff a2 $ \a2' -> 
 6075   let {a3' = realToFrac a3} in 
 6076   preErrorCheck $ \a4' -> 
 6077   roughHestonPriceTimeRaw'_ a1' a2' a3' a4' >>= \res ->
 6078   let {res' = realToFrac res} in
 6079   errorCheck  a4'>>
 6080   return (res')
 6081 
 6082 
 6083 
 6084 -- |Direct European plain-vanilla pricing at a maturity date or time in years (1.44).
 6085 roughHestonPriceVanillaPayoff :: AnalyticRoughHestonEngine -- ^Engine
 6086   -> PlainVanillaPayoff -- ^Call/put and strike
 6087   -> TermPoint -- ^Maturity; time is relative to the model risk-free curve's reference date
 6088   -> IO Double
 6089 roughHestonPriceVanillaPayoff engine payoff maturity = case maturity of
 6090   DatePoint date -> roughHestonPriceDateRaw engine payoff date
 6091   TimePoint time -> roughHestonPriceTimeRaw engine payoff time
 6092 
 6093 -- |MTM cross-currency discounting (1.44). Spot is domestic currency per foreign currency.
 6094 -- Historical reset observations come from ExchangeRateManager; live leg cash flows need their own FX reset pricer.
 6095 discountingMtmCrossCurrencyBasisSwapEngine :: (Currency) -- ^domesticCcy
 6096  -> (GenYieldTermStructure y1) -- ^domesticCurve
 6097  -> (Currency) -- ^foreignCcy
 6098  -> (GenYieldTermStructure y2) -- ^foreignCurve
 6099  -> (GenQuote q) -- ^spotFx
 6100  -> (Maybe Bool) -- ^includeSettlementDateFlows
 6101  -> (Maybe Day) -- ^settlementDate
 6102  -> (Maybe Day) -- ^npvDate
 6103  -> (Maybe Day) -- ^spotFxSettleDate
 6104  -> IO ((PricingEngine))
 6105 discountingMtmCrossCurrencyBasisSwapEngine a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 6106   withCurrency a1 $ \a1' -> 
 6107   withYieldTermStructure a2 $ \a2' -> 
 6108   withCurrency a3 $ \a3' -> 
 6109   withYieldTermStructure a4 $ \a4' -> 
 6110   withQuote a5 $ \a5' -> 
 6111   let {a6' = fromMaybeBool a6} in 
 6112   withMaybeDay a7 $ \a7' -> 
 6113   withMaybeDay a8 $ \a8' -> 
 6114   withMaybeDay a9 $ \a9' -> 
 6115   preErrorCheck $ \a10' -> 
 6116   discountingMtmCrossCurrencyBasisSwapEngine'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 6117   peekPricingEngine res >>= \res' ->
 6118   errorCheck  a10'>>
 6119   return (res')
 6120 
 6121 
 6122 
 6123 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
 6124 
 6125 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingBondEngine"
 6126   discountingBondEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6127 
 6128 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingPerpetualFuturesEngine"
 6129   qlDiscountingPerpetualFuturesEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6130 
 6131 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRiskyBondEngine"
 6132   riskyBondEngine'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6133 
 6134 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingSwapEngine"
 6135   discountingSwapEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6136 
 6137 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingFxForwardEngine"
 6138   discountingFxForwardEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6139 
 6140 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingConstNotionalCrossCurrencySwapEngine"
 6141   discountingConstNotionalCrossCurrencySwapEngine'_ :: ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6142 
 6143 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlCounterpartyAdjSwapEngine"
 6144   counterpartyAdjSwapEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6145 
 6146 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticBarrierEngine"
 6147   analyticBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6148 
 6149 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticTwoAssetBarrierEngine"
 6150   analyticTwoAssetBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6151 
 6152 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticSoftBarrierEngine"
 6153   analyticSoftBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6154 
 6155 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticSimpleChooserEngine"
 6156   analyticSimpleChooserEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6157 
 6158 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticComplexChooserEngine"
 6159   analyticComplexChooserEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6160 
 6161 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticTwoAssetCorrelationEngine"
 6162   analyticTwoAssetCorrelationEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6163 
 6164 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticEuropeanMargrabeEngine"
 6165   analyticEuropeanMargrabeEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6166 
 6167 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticAmericanMargrabeEngine"
 6168   analyticAmericanMargrabeEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6169 
 6170 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticWriterExtensibleOptionEngine"
 6171   analyticWriterExtensibleOptionEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6172 
 6173 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHolderExtensibleOptionEngine"
 6174   analyticHolderExtensibleOptionEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6175 
 6176 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticPartialTimeBarrierOptionEngine"
 6177   analyticPartialTimeBarrierOptionEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6178 
 6179 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticBinaryBarrierEngine"
 6180   analyticBinaryBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6181 
 6182 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBinomialBarrierEngine"
 6183   binomialBarrierEngine'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6184 
 6185 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlVannaVolgaBarrierEngine"
 6186   vannaVolgaBarrierEngine'_ :: ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6187 
 6188 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDoubleBarrierEngine"
 6189   analyticDoubleBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6190 
 6191 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlVannaVolgaDoubleBarrierEngine"
 6192   vannaVolgaDoubleBarrierEngine'_ :: ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CDeltaVolQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6193 
 6194 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBinomialDoubleBarrierEngine"
 6195   binomialDoubleBarrierEngine'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6196 
 6197 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDoubleBarrierEngine"
 6198   mcDoubleBarrierEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6199 
 6200 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticCliquetEngine"
 6201   analyticCliquetEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6202 
 6203 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticCompoundOptionEngine"
 6204   analyticCompoundOptionEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6205 
 6206 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousFixedLookbackEngine"
 6207   analyticContinuousFixedLookbackEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6208 
 6209 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousFloatingLookbackEngine"
 6210   analyticContinuousFloatingLookbackEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6211 
 6212 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousPartialFloatingLookbackEngine"
 6213   analyticContinuousPartialFloatingLookbackEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6214 
 6215 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousPartialFixedLookbackEngine"
 6216   analyticContinuousPartialFixedLookbackEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6217 
 6218 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousGeometricAveragePriceAsianEngine"
 6219   analyticContinuousGeometricAveragePriceAsianEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6220 
 6221 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticContinuousGeometricAveragePriceAsianHestonEngine"
 6222   analyticContinuousGeometricAveragePriceAsianHestonEngine'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6223 
 6224 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDiscreteGeometricAveragePriceAsianHestonEngine"
 6225   analyticDiscreteGeometricAveragePriceAsianHestonEngine'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6226 
 6227 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCLookbackFixedEngine"
 6228   mcLookbackFixedEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6229 
 6230 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCLookbackFloatingEngine"
 6231   mcLookbackFloatingEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6232 
 6233 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCLookbackPartialFixedEngine"
 6234   mcLookbackPartialFixedEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6235 
 6236 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCLookbackPartialFloatingEngine"
 6237   mcLookbackPartialFloatingEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6238 
 6239 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDigitalAmericanEngine"
 6240   analyticDigitalAmericanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6241 
 6242 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDigitalAmericanKOEngine"
 6243   analyticDigitalAmericanKoEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6244 
 6245 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDiscreteGeometricAveragePriceAsianEngine"
 6246   analyticDiscreteGeometricAveragePriceAsianEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6247 
 6248 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDiscreteGeometricAverageStrikeAsianEngine"
 6249   analyticDiscreteGeometricAverageStrikeAsianEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6250 
 6251 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTurnbullWakemanAsianEngine"
 6252   turnbullWakemanAsianEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6253 
 6254 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticDividendEuropeanEngine"
 6255   analyticDividendEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6256 
 6257 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticEuropeanEngine"
 6258   analyticEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6259 
 6260 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticPerformanceEngine"
 6261   analyticPerformanceEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6262 
 6263 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlForwardEuropeanEngine"
 6264   forwardEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6265 
 6266 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlForwardBaroneAdesiWhaleyEngine"
 6267   forwardBaroneAdesiWhaleyEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6268 
 6269 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlForwardBjerksundStenslandEngine"
 6270   forwardBjerksundStenslandEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6271 
 6272 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlForwardFdBlackScholesVanillaEngine"
 6273   forwardFdBlackScholesVanillaEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6274 
 6275 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCForwardEuropeanBSEngine1"
 6276   mcForwardEuropeanBsEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6277 
 6278 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCForwardEuropeanHestonEngine1"
 6279   mcForwardEuropeanHestonEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6280 
 6281 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonForwardEuropeanEngine"
 6282   analyticHestonForwardEuropeanEngine'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6283 
 6284 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantoEuropeanEngine"
 6285   quantoEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6286 
 6287 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantoForwardEuropeanEngine"
 6288   quantoForwardEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6289 
 6290 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantoForwardPerformanceEuropeanEngine"
 6291   quantoForwardPerformanceEuropeanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6292 
 6293 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantoBarrierEngine"
 6294   quantoBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6295 
 6296 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantoDoubleBarrierEngine"
 6297   quantoDoubleBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6298 
 6299 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCapFloorEngine1"
 6300   blackCapFloorEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (COptionletVolatilityStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6301 
 6302 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCapFloorEngine"
 6303   blackCapFloorEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6304 
 6305 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackSwaptionEngine"
 6306   blackSwaptionEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))
 6307 
 6308 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlHaganIrregularSwaptionEngine"
 6309   haganIrregularSwaptionEngine'_ :: ((C2HSImp.Ptr (CSwaptionVolatilityStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6310 
 6311 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackSwaptionEngine1"
 6312   blackSwaptionEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CSwaptionVolatilityStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6313 
 6314 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCapFloorEngine1"
 6315   bachelierCapFloorEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (COptionletVolatilityStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6316 
 6317 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCapFloorEngine"
 6318   bachelierCapFloorEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6319 
 6320 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlYoYInflationBlackCapFloorEngine"
 6321   yoyInflationBlackCapFloorEngine'_ :: ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYoYOptionletVolatilitySurface')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6322 
 6323 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlYoYInflationUnitDisplacedBlackCapFloorEngine"
 6324   yoyInflationUnitDisplacedBlackCapFloorEngine'_ :: ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYoYOptionletVolatilitySurface')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6325 
 6326 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlYoYInflationBachelierCapFloorEngine"
 6327   yoyInflationBachelierCapFloorEngine'_ :: ((C2HSImp.Ptr (CYoYInflationIndex')) -> ((C2HSImp.Ptr (CYoYOptionletVolatilitySurface')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6328 
 6329 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlInterpolatingCPICapFloorEngine"
 6330   interpolatingCpiCapFloorEngine'_ :: ((C2HSImp.Ptr (CCPICapFloorTermPriceSurface')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6331 
 6332 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierSwaptionEngine"
 6333   bachelierSwaptionEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6334 
 6335 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierSwaptionEngine1"
 6336   bachelierSwaptionEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CSwaptionVolatilityStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6337 
 6338 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticBSMHullWhiteEngine"
 6339   analyticBsmHullWhiteEngine'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CHullWhite')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6340 
 6341 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticCapFloorEngine"
 6342   analyticCapFloorEngine'_ :: ((C2HSImp.Ptr (CAffineModel')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6343 
 6344 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussian1dCapFloorEngine"
 6345   gaussian1dCapFloorEngine'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6346 
 6347 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticGJRGARCHEngine"
 6348   analyticGjrGarchEngine'_ :: ((C2HSImp.Ptr (CGJRGARCHModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6349 
 6350 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonEngine"
 6351   analyticHestonEngineTolerance'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6352 
 6353 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticH1HWEngine"
 6354   analyticH1HwEngineOrder'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6355 
 6356 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonHullWhiteEngine"
 6357   analyticHestonHullWhiteEngineOrder'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6358 
 6359 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesEngine"
 6360   batesEngineOrder'_ :: ((C2HSImp.Ptr (CBatesModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6361 
 6362 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFFTVanillaEngine"
 6363   fftVanillaEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6364 
 6365 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlG2SwaptionEngine"
 6366   g2SwaptionEngine'_ :: ((C2HSImp.Ptr (CG2')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6367 
 6368 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlJumpDiffusionEngine"
 6369   jumpDiffusionEngine'_ :: ((C2HSImp.Ptr (CMerton76Process')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6370 
 6371 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCapFloorEngine"
 6372   treeCapFloorEngineTimeSteps'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6373 
 6374 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeSwaptionEngine"
 6375   treeSwaptionEngineTimeSteps'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6376 
 6377 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeVanillaSwapEngine"
 6378   treeVanillaSwapEngineTimeSteps'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6379 
 6380 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlVarianceGammaEngine"
 6381   varianceGammaEngine'_ :: ((C2HSImp.Ptr (CVarianceGammaProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6382 
 6383 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonEngine1"
 6384   analyticHestonEngineOrder'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6385 
 6386 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonEngineOptimalControlVariate"
 6387   analyticHestonEngineOptimalControlVariate'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CInt)))))))
 6388 
 6389 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticHestonHullWhiteEngine1"
 6390   analyticHestonHullWhiteEngineTolerance'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6391 
 6392 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticH1HWEngine1"
 6393   analyticH1HwEngineTolerance'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6394 
 6395 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesEngine1"
 6396   batesEngineTolerance'_ :: ((C2HSImp.Ptr (CBatesModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6397 
 6398 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBaroneAdesiWhaleyApproximationEngine"
 6399   baroneAdesiWhaleyApproximationEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6400 
 6401 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDetJumpEngine1"
 6402   batesDetJumpEngineTolerance'_ :: ((C2HSImp.Ptr (CBatesDetJumpModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6403 
 6404 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDetJumpEngine"
 6405   batesDetJumpEngineOrder'_ :: ((C2HSImp.Ptr (CBatesDetJumpModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6406 
 6407 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDoubleExpDetJumpEngine1"
 6408   batesDoubleExpDetJumpEngineTolerance'_ :: ((C2HSImp.Ptr (CBatesDoubleExpDetJumpModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6409 
 6410 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDoubleExpDetJumpEngine"
 6411   batesDoubleExpDetJumpEngineOrder'_ :: ((C2HSImp.Ptr (CBatesDoubleExpDetJumpModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6412 
 6413 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDoubleExpEngine1"
 6414   batesDoubleExpEngineTolerance'_ :: ((C2HSImp.Ptr (CBatesDoubleExpModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6415 
 6416 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBatesDoubleExpEngine"
 6417   batesDoubleExpEngineOrder'_ :: ((C2HSImp.Ptr (CBatesDoubleExpModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6418 
 6419 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBjerksundStenslandApproximationEngine"
 6420   bjerksundStenslandApproximationEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6421 
 6422 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQdPlusAmericanEngine"
 6423   qdPlusAmericanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))
 6424 
 6425 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQdFpAmericanEngine"
 6426   qdFpAmericanEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6427 
 6428 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlContinuousArithmeticAsianVecerEngine"
 6429   continuousArithmeticAsianVecerEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6430 
 6431 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCdsOptionEngine"
 6432   blackCdsOptionEngine'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6433 
 6434 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIntegralCdsEngine"
 6435   integralCdsEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6436 
 6437 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIntegralEngine"
 6438   integralEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6439 
 6440 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlJamshidianSwaptionEngine"
 6441   jamshidianSwaptionEngine'_ :: ((C2HSImp.Ptr (COneFactorAffineModel')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6442 
 6443 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussian1dSwaptionEngine"
 6444   gaussian1dSwaptionEngine'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6445 
 6446 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussian1dNonstandardSwaptionEngine"
 6447   gaussian1dNonstandardSwaptionEngine'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6448 
 6449 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussian1dFloatFloatSwaptionEngine"
 6450   gaussian1dFloatFloatSwaptionEngine'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6451 
 6452 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussian1dJamshidianSwaptionEngine"
 6453   gaussian1dJamshidianSwaptionEngine'_ :: ((C2HSImp.Ptr (CGaussian1dModel')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6454 
 6455 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlJuQuadraticApproximationEngine"
 6456   juQuadraticApproximationEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6457 
 6458 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlKirkEngine"
 6459   kirkEngine'_ :: ((C2HSImp.Ptr (CBlackProcess')) -> ((C2HSImp.Ptr (CBlackProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6460 
 6461 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMidPointCdsEngine"
 6462   midPointCdsEngine'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6463 
 6464 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMidPointCDOEngine"
 6465   midPointCdoEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6466 
 6467 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIntegralCDOEngine"
 6468   integralCdoEngine'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6469 
 6470 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIntegralNtdEngine"
 6471   integralNtdEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6472 
 6473 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIsdaCdsEngine"
 6474   isdaCdsEngine'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6475 
 6476 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlReplicatingVarianceSwapEngine"
 6477   replicatingVarianceSwapEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6478 
 6479 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlStulzEngine"
 6480   stulzEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6481 
 6482 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBjerksundStenslandSpreadEngine"
 6483   bjerksundStenslandSpreadEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6484 
 6485 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlOperatorSplittingSpreadEngine"
 6486   operatorSplittingSpreadEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6487 
 6488 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlPearsonSpreadEngine"
 6489   pearsonSpreadEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6490 
 6491 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlGaussianCopulaSpreadEngine"
 6492   gaussianCopulaSpreadEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))
 6493 
 6494 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlChoiBasketEngine"
 6495   qlChoiBasketEngine'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6496 
 6497 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDengLiZhouBasketEngine"
 6498   qlDengLiZhouBasketEngine'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))
 6499 
 6500 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlSingleFactorBsmBasketEngine"
 6501   qlSingleFactorBsmBasketEngine'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6502 
 6503 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlLfmSwaptionEngine"
 6504   lfmSwaptionEngine'_ :: ((C2HSImp.Ptr (CLiborForwardModel')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6505 
 6506 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCapFloorEngine1"
 6507   treeCapFloorEngineTimeGrid'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6508 
 6509 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeSwaptionEngine1"
 6510   treeSwaptionEngineTimeGrid'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6511 
 6512 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeVanillaSwapEngine1"
 6513   treeVanillaSwapEngineTimeGrid'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6514 
 6515 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdmQuantoHelper"
 6516   fdmQuantoHelper'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFdmQuantoHelper)))))))))
 6517 
 6518 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdmQuantoHelperQuantoAdjustment"
 6519   quantoAdjustment'_ :: ((C2HSImp.Ptr (CFdmQuantoHelper)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
 6520 
 6521 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFd2dBlackScholesVanillaEngine"
 6522   fd2dBlackScholesVanillaEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6523 
 6524 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdndimBlackScholesVanillaEngine"
 6525   qlFdndimBlackScholesVanillaEngine'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6526 
 6527 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdndimBlackScholesVanillaEngine1"
 6528   qlFdndimBlackScholesVanillaEngine1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6529 
 6530 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdG2SwaptionEngine"
 6531   fdG2SwaptionEngine'_ :: ((C2HSImp.Ptr (CG2')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6532 
 6533 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHullWhiteSwaptionEngine"
 6534   fdHullWhiteSwaptionEngine'_ :: ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6535 
 6536 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesBarrierEngine"
 6537   fdBlackScholesBarrierEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6538 
 6539 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonBarrierEngine"
 6540   fdHestonBarrierEngineNoDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6541 
 6542 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonBarrierEngine1"
 6543   fdHestonBarrierEngineWithDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6544 
 6545 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonDoubleBarrierEngine"
 6546   fdHestonDoubleBarrierEngine'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6547 
 6548 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCHestonHullWhiteEngine1"
 6549   mcHestonHullWhiteEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHybridHestonHullWhiteProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6550 
 6551 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCAmericanEngine1"
 6552   mcAmericanEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))))))))
 6553 
 6554 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCBarrierEngine1"
 6555   mcBarrierEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))))
 6556 
 6557 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDigitalEngine1"
 6558   mcDigitalEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6559 
 6560 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDiscreteArithmeticAPEngine1"
 6561   mcDiscreteArithmeticApEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6562 
 6563 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDiscreteArithmeticASEngine1"
 6564   mcDiscreteArithmeticAsEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6565 
 6566 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDiscreteGeometricAPEngine1"
 6567   mcDiscreteGeometricApEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6568 
 6569 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDiscreteArithmeticAPHestonEngine1"
 6570   mcDiscreteArithmeticApHestonEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6571 
 6572 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCDiscreteGeometricAPHestonEngine1"
 6573   mcDiscreteGeometricApHestonEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6574 
 6575 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCEuropeanEngine1"
 6576   mcEuropeanEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6577 
 6578 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCEuropeanGJRGARCHEngine1"
 6579   mcEuropeanGjrGarchEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGJRGARCHProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6580 
 6581 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCEuropeanHestonEngine1"
 6582   mcEuropeanHestonEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6583 
 6584 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlIntegralHestonVarianceOptionEngine"
 6585   integralHestonVarianceOptionEngine'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))
 6586 
 6587 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCHullWhiteCapFloorEngine1"
 6588   mcHullWhiteCapFloorEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CHullWhite')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6589 
 6590 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCHimalayaEngine1"
 6591   mcHimalayaEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CStochasticProcessArray')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6592 
 6593 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCPagodaEngine1"
 6594   mcPagodaEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CStochasticProcessArray')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6595 
 6596 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCEuropeanBasketEngine1"
 6597   mcEuropeanBasketEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CStochasticProcessArray')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6598 
 6599 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCEverestEngine1"
 6600   mcEverestEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CStochasticProcessArray')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6601 
 6602 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCAmericanBasketEngine1"
 6603   mcAmericanBasketEngine'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CStochasticProcessArray')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))))
 6604 
 6605 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCPerformanceEngine1"
 6606   mcPerformanceEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6607 
 6608 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlMCVarianceSwapEngine1"
 6609   mcVarianceSwapEngine'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6610 
 6611 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBinomialVanillaEngine"
 6612   binomialVanillaEngine'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6613 
 6614 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesAsianEngine"
 6615   fdBlackScholesAsianEngine'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))
 6616 
 6617 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesVanillaEngine"
 6618   fdBlackScholesVanillaEngineNoDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6619 
 6620 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesVanillaEngine1"
 6621   fdBlackScholesVanillaEngineWithDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6622 
 6623 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesVanillaEngine2"
 6624   fdBlackScholesVanillaEngineQuantoNoDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> ((C2HSImp.Ptr (CFdmQuantoHelper)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6625 
 6626 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesVanillaEngine3"
 6627   fdBlackScholesVanillaEngineQuantoWithDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> ((C2HSImp.Ptr (CFdmQuantoHelper)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6628 
 6629 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonVanillaEngine"
 6630   fdHestonVanillaEngineNoDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6631 
 6632 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonVanillaEngine1"
 6633   fdHestonVanillaEngineWithDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6634 
 6635 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlCOSHestonEngine"
 6636   cosHestonEngine'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6637 
 6638 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticPDFHestonEngine"
 6639   analyticPdfHestonEngine'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6640 
 6641 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBatesVanillaEngine"
 6642   fdBatesVanillaEngineNoDividends'_ :: ((C2HSImp.Ptr (CBatesModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6643 
 6644 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBatesVanillaEngine1"
 6645   fdBatesVanillaEngineWithDividends'_ :: ((C2HSImp.Ptr (CBatesModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))
 6646 
 6647 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesShoutEngine"
 6648   fdBlackScholesShoutEngineNoDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))
 6649 
 6650 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdBlackScholesShoutEngine1"
 6651   fdBlackScholesShoutEngineWithDividends'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))
 6652 
 6653 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonVanillaEngine2"
 6654   fdHestonVanillaEngineQuantoNoDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CFdmQuantoHelper)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))
 6655 
 6656 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonVanillaEngine3"
 6657   fdHestonVanillaEngineQuantoWithDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> ((C2HSImp.Ptr (CFdmQuantoHelper)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))))
 6658 
 6659 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonHullWhiteVanillaEngine"
 6660   fdHestonHullWhiteVanillaEngineNoDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhiteProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))
 6661 
 6662 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlFdHestonHullWhiteVanillaEngine1"
 6663   fdHestonHullWhiteVanillaEngineWithDividends'_ :: ((C2HSImp.Ptr (CHestonModel')) -> ((C2HSImp.Ptr (CHullWhiteProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFdmSchemeDesc)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))))))))
 6664 
 6665 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBinomialConvertibleEngine"
 6666   binomialConvertibleEngine'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))))))
 6667 
 6668 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCallableFixedRateBondEngine1"
 6669   blackCallableFixedRateBondEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CCallableBondVolatilityStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6670 
 6671 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCallableFixedRateBondEngine"
 6672   blackCallableFixedRateBondEngine'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6673 
 6674 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCallableZeroCouponBondEngine1"
 6675   blackCallableZeroCouponBondEngineFromVolatilityStructure'_ :: ((C2HSImp.Ptr (CCallableBondVolatilityStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6676 
 6677 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCallableZeroCouponBondEngine"
 6678   blackCallableZeroCouponBondEngine'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine'))))))
 6679 
 6680 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCallableFixedRateBondEngine1"
 6681   treeCallableFixedRateBondEngineTimeGrid'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6682 
 6683 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCallableFixedRateBondEngine"
 6684   treeCallableFixedRateBondEngineTimeSteps'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6685 
 6686 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCallableZeroCouponBondEngine1"
 6687   treeCallableZeroCouponBondEngineTimeGrid'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6688 
 6689 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlTreeCallableZeroCouponBondEngine"
 6690   treeCallableZeroCouponBondEngineTimeSteps'_ :: ((C2HSImp.Ptr (CShortRateModel')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))
 6691 
 6692 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorAlpha"
 6693   qlBlackCalculatorAlpha'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6694 
 6695 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorBeta"
 6696   qlBlackCalculatorBeta'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6697 
 6698 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculator1"
 6699   blackCalculatorAtStrikeRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBlackCalculator')))))))))
 6700 
 6701 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculator"
 6702   blackCalculatorFromPayoffRaw'_ :: ((QlStrikedTypePayoff) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBlackCalculator'))))))))
 6703 
 6704 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorDelta"
 6705   qlBlackCalculatorDelta'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6706 
 6707 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorDeltaForward"
 6708   qlBlackCalculatorDeltaForward'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6709 
 6710 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorDividendRho"
 6711   qlBlackCalculatorDividendRho'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6712 
 6713 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorElasticity"
 6714   qlBlackCalculatorElasticity'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6715 
 6716 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorElasticityForward"
 6717   qlBlackCalculatorElasticityForward'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6718 
 6719 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorGamma"
 6720   qlBlackCalculatorGamma'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6721 
 6722 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorGammaForward"
 6723   qlBlackCalculatorGammaForward'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6724 
 6725 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorItmAssetProbability"
 6726   qlBlackCalculatorItmAssetProbability'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6727 
 6728 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorItmCashProbability"
 6729   qlBlackCalculatorItmCashProbability'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6730 
 6731 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorRho"
 6732   qlBlackCalculatorRho'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6733 
 6734 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorStrikeSensitivity"
 6735   qlBlackCalculatorStrikeSensitivity'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6736 
 6737 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorStrikeGamma"
 6738   qlBlackCalculatorStrikeGamma'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6739 
 6740 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorTheta"
 6741   qlBlackCalculatorTheta'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6742 
 6743 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorThetaPerDay"
 6744   qlBlackCalculatorThetaPerDay'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6745 
 6746 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorValue"
 6747   qlBlackCalculatorValue'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6748 
 6749 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorVanna"
 6750   blackVanna'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6751 
 6752 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorVega"
 6753   qlBlackCalculatorVega'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6754 
 6755 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackCalculatorVolga"
 6756   qlBlackCalculatorVolga'_ :: ((C2HSImp.Ptr (CBlackCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6757 
 6758 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculator1"
 6759   blackScholesCalculatorAtStrikeRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBlackScholesCalculator'))))))))))
 6760 
 6761 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculator"
 6762   blackScholesCalculatorFromPayoffRaw'_ :: ((QlStrikedTypePayoff) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBlackScholesCalculator')))))))))
 6763 
 6764 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculatorDelta"
 6765   blackScholesDelta'_ :: ((C2HSImp.Ptr (CBlackScholesCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6766 
 6767 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculatorElasticity"
 6768   blackScholesElasticity'_ :: ((C2HSImp.Ptr (CBlackScholesCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6769 
 6770 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculatorGamma"
 6771   blackScholesGamma'_ :: ((C2HSImp.Ptr (CBlackScholesCalculator')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6772 
 6773 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculatorTheta"
 6774   blackScholesTheta'_ :: ((C2HSImp.Ptr (CBlackScholesCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6775 
 6776 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackScholesCalculatorThetaPerDay"
 6777   blackScholesThetaPerDay'_ :: ((C2HSImp.Ptr (CBlackScholesCalculator')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6778 
 6779 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculator1"
 6780   bachelierCalculatorAtStrikeRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBachelierCalculator)))))))))
 6781 
 6782 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculator"
 6783   bachelierCalculatorFromPayoffRaw'_ :: ((QlStrikedTypePayoff) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBachelierCalculator))))))))
 6784 
 6785 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorAlpha"
 6786   qlBachelierCalculatorAlpha'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6787 
 6788 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorBeta"
 6789   qlBachelierCalculatorBeta'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6790 
 6791 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorDelta"
 6792   qlBachelierCalculatorDelta'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6793 
 6794 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorDeltaForward"
 6795   qlBachelierCalculatorDeltaForward'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6796 
 6797 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorDividendRho"
 6798   qlBachelierCalculatorDividendRho'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6799 
 6800 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorElasticity"
 6801   qlBachelierCalculatorElasticity'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6802 
 6803 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorElasticityForward"
 6804   qlBachelierCalculatorElasticityForward'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6805 
 6806 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorGamma"
 6807   qlBachelierCalculatorGamma'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6808 
 6809 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorGammaForward"
 6810   qlBachelierCalculatorGammaForward'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6811 
 6812 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorItmAssetProbability"
 6813   qlBachelierCalculatorItmAssetProbability'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6814 
 6815 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorItmCashProbability"
 6816   qlBachelierCalculatorItmCashProbability'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6817 
 6818 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorRho"
 6819   qlBachelierCalculatorRho'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6820 
 6821 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorStrikeSensitivity"
 6822   qlBachelierCalculatorStrikeSensitivity'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6823 
 6824 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorStrikeGamma"
 6825   qlBachelierCalculatorStrikeGamma'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6826 
 6827 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorTheta"
 6828   qlBachelierCalculatorTheta'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6829 
 6830 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorThetaPerDay"
 6831   qlBachelierCalculatorThetaPerDay'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6832 
 6833 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorValue"
 6834   qlBachelierCalculatorValue'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6835 
 6836 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorVanna"
 6837   bachelierVanna'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6838 
 6839 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorVega"
 6840   qlBachelierCalculatorVega'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6841 
 6842 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBachelierCalculatorVolga"
 6843   qlBachelierCalculatorVolga'_ :: ((C2HSImp.Ptr (CBachelierCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6844 
 6845 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackDeltaCalculator"
 6846   blackDeltaCalculator'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBlackDeltaCalculator))))))))))
 6847 
 6848 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackDeltaCalculatorDeltaFromStrike"
 6849   deltaFromStrike'_ :: ((C2HSImp.Ptr (CBlackDeltaCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6850 
 6851 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackDeltaCalculatorStrikeFromDelta"
 6852   strikeFromDelta'_ :: ((C2HSImp.Ptr (CBlackDeltaCalculator)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6853 
 6854 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlBlackDeltaCalculatorAtmStrike"
 6855   atmStrike'_ :: ((C2HSImp.Ptr (CBlackDeltaCalculator)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 6856 
 6857 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormula"
 6858   blackFormula'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6859 
 6860 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaCashItmProbability"
 6861   blackCashItmProbability'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6862 
 6863 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaImpliedStdDev"
 6864   blackImpliedStdDev'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))))
 6865 
 6866 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaImpliedStdDevApproximation"
 6867   blackImpliedStdDevApproximation'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6868 
 6869 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaStdDevDerivative"
 6870   blackStdDevDerivative'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6871 
 6872 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaVolDerivative"
 6873   blackVolDerivative'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6874 
 6875 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormula"
 6876   bachelierBlackFormula'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6877 
 6878 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaForwardDerivative"
 6879   blackForwardDerivative'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6880 
 6881 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaImpliedStdDevChambers"
 6882   blackImpliedStdDevChambers'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))
 6883 
 6884 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaImpliedStdDevApproximationRS"
 6885   blackImpliedStdDevApproximationRs'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6886 
 6887 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaImpliedStdDevLiRS"
 6888   blackImpliedStdDevLiRs'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))))
 6889 
 6890 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaAssetItmProbability"
 6891   blackAssetItmProbability'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6892 
 6893 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBlackFormulaStdDevSecondDerivative"
 6894   blackStdDevSecondDerivative'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6895 
 6896 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormulaForwardDerivative"
 6897   bachelierForwardDerivative'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 6898 
 6899 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormulaImpliedVol"
 6900   bachelierImpliedVol'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6901 
 6902 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormulaImpliedVolChoi"
 6903   bachelierImpliedVolChoi'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 6904 
 6905 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormulaStdDevDerivative"
 6906   bachelierStdDevDerivative'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
 6907 
 6908 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibBachelierBlackFormulaAssetItmProbability"
 6909   bachelierAssetItmProbability'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
 6910 
 6911 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlQuantLibDefaultThetaPerDay"
 6912   defaultThetaPerDay'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 6913 
 6914 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlUnsafeSabrLogNormalVolatility"
 6915   unsafeSabrLogNormalVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))
 6916 
 6917 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlUnsafeShiftedSabrVolatility"
 6918   unsafeShiftedSabrVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))))
 6919 
 6920 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlUnsafeSabrNormalVolatility"
 6921   unsafeSabrNormalVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))
 6922 
 6923 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlUnsafeSabrVolatility"
 6924   unsafeSabrVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))
 6925 
 6926 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlSabrVolatility"
 6927   sabrVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))
 6928 
 6929 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlShiftedSabrVolatility"
 6930   shiftedSabrVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))))
 6931 
 6932 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlSabrFlochKennedyVolatility"
 6933   sabrFlochKennedyVolatility'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))
 6934 
 6935 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlValidateSabrParameters"
 6936   validateSabrParameters'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))))
 6937 
 6938 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlSabrGuess"
 6939   sabrGuess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))))))))))))
 6940 
 6941 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticRoughHestonEngine"
 6942   roughHestonEngineRaw'_ :: ((C2HSImp.Ptr (CRoughHestonModel')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CAnalyticRoughHestonEngine')))))))))
 6943 
 6944 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlAnalyticRoughHestonEngineWithIntegration"
 6945   roughHestonEngineIntegrationRaw'_ :: ((C2HSImp.Ptr (CRoughHestonModel')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CAnalyticRoughHestonEngine')))))))))))))))
 6946 
 6947 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonchF"
 6948   roughHestonCharacteristicFunction'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))))))
 6949 
 6950 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonlnChF"
 6951   roughHestonLogCharacteristicFunction'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))))))
 6952 
 6953 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonriccatiSolution"
 6954   roughHestonRiccatiSolution'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))))))
 6955 
 6956 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonNumberOfEvaluations"
 6957   roughHestonNumberOfEvaluations'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CUInt)))
 6958 
 6959 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonPriceDate"
 6960   roughHestonPriceDateRaw'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> ((QlPlainVanillaPayoff) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6961 
 6962 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlRoughHestonPriceTime"
 6963   roughHestonPriceTimeRaw'_ :: ((C2HSImp.Ptr (CAnalyticRoughHestonEngine')) -> ((QlPlainVanillaPayoff) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 6964 
 6965 foreign import ccall safe "QuantLib/PricingEngine.chs.h qlDiscountingMtMCrossCurrencyBasisSwapEngine"
 6966   discountingMtmCrossCurrencyBasisSwapEngine'_ :: ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCurrency)) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPricingEngine')))))))))))))