-- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./QuantLib/Instrument/Option.chs" #-}
{-# LANGUAGE FlexibleInstances #-}
module QuantLib.Instrument.Option
  (
    -- * Types
    -- ** Option hierarchy
    GenOption
  , Option
  , GenOneAssetOption
  , OneAssetOption
  , GenMultiAssetOption
  , MultiAssetOption
  , CdsOption
  , BarrierOption
  , DoubleBarrierOption
  , EverestOption
  , MargrabeOption
  , QuantoBarrierOption
  , QuantoDoubleBarrierOption
  , QuantoForwardVanillaOption
  , QuantoVanillaOption
  , SoftBarrierOption
  , VanillaOption

    -- ** Exercises
  , ExerciseType(..)
  , Exercise(..)
  , EuropeanExercise(..)
  , BermudanExercise(..)
  , SwingExercise(..)

    -- ** Option conventions
  , OptionType(..)
  , PositionType(..)

    -- ** Payoffs
  , StrikedPayoff(..)
  , PlainVanillaPayoff(..)
  , PercentageStrikePayoff(..)
  , BasketPayoff(..)
  , Payoff(..)
  , TypePayoff(..)

    -- * Constructors
    -- ** Hierarchy conversion
  , asOption
  , asOneAssetOption

    -- ** Payoffs and exercises
  , strikedPayoff
  , plainVanillaPayoff
  , percentageStrikePayoff
  , withCustomPayoff
  , withCustomStrikedPayoff
  , withCustomBasketPayoff
  , swingExercise

    -- ** Barrier, chooser and multi-asset options
  , barrierOption
  , partialTimeBarrierOption
  , doubleBarrierOption
  , softBarrierOption
  , forwardVanillaOption
  , compoundOption
  , margrabeOption
  , simpleChooserOption
  , complexChooserOption
  , twoAssetCorrelationOption
  , writerExtensibleOption
  , holderExtensibleOption

    -- ** Vanilla, quanto and path-dependent options
  , multiAssetOption
  , oneAssetOption
  , quantoBarrierOption
  , quantoDoubleBarrierOption
  , quantoForwardVanillaOption
  , quantoVanillaOption
  , twoAssetBarrierOption
  , vanillaOption
  , basketOption
  , himalayaOption
  , pagodaOption
  , cliquetOption
  , continuousAveragingAsianOption
  , continuousFixedLookbackOption
  , continuousFloatingLookbackOption
  , continuousPartialFixedLookbackOption
  , continuousPartialFloatingLookbackOption
  , everestOption
  , discreteAveragingAsianOption
  , vanillaStorageOption
  , vanillaSwingOption
  , europeanOption

    -- * Inspectors
    -- ** Implied volatility
  , HasImpliedVol(..)
  , doubleBarrierOptionImpliedVolatility
  , softBarrierOptionImpliedVolatility
    -- ** Sensitivities and probabilities
  , HasGreeks(..)
  , HasQuanto(..)
  , firstAssetDelta
  , secondAssetDelta
  , firstAssetGamma
  , secondAssetGamma
  , deltaForward
  , elasticity
  , itmCashProbability
  , strikeSensitivity
  , thetaPerDay
  , yield

  ) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Ptr as C2HSImp








import QuantLib.Internal
import QuantLib.Instrument(AverageType, BarrierType, DoubleBarrierType, PartialBarrierRange)
import QuantLib.Internal.Type
import QuantLib.Internal.Common
import Data.List.NonEmpty(NonEmpty, toList)


{-# LINE 127 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 128 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 129 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 130 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 131 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 132 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 133 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 134 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 135 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 136 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 137 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 138 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 139 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 140 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 141 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 142 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 143 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 144 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 145 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 146 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 147 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 148 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 149 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 150 "./QuantLib/Instrument/Option.chs" #-}


{-# LINE 151 "./QuantLib/Instrument/Option.chs" #-}


-- |Quanto version of a forward-starting (strike-resetting) vanilla option.
quantoForwardVanillaOption :: (Double) -- ^moneyness
 -> (Day) -- ^resetDate
 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoForwardVanillaOption))
quantoForwardVanillaOption :: Double
-> Day
-> StrikedPayoff
-> Exercise
-> IO QuantoForwardVanillaOption
quantoForwardVanillaOption Double
a1 Day
a2 StrikedPayoff
a3 Exercise
a4 =
  let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in 
  Day
-> (CInt -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a2 ((CInt -> IO QuantoForwardVanillaOption)
 -> IO QuantoForwardVanillaOption)
-> (CInt -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. (a -> b) -> a -> b
$ \CInt
a2' -> 
  StrikedPayoff
-> (QlStrikedTypePayoff -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a. StrikedPayoff -> (QlStrikedTypePayoff -> IO a) -> IO a
withStrikedPayoff StrikedPayoff
a3 ((QlStrikedTypePayoff -> IO QuantoForwardVanillaOption)
 -> IO QuantoForwardVanillaOption)
-> (QlStrikedTypePayoff -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. (a -> b) -> a -> b
$ \QlStrikedTypePayoff
a3' -> 
  Exercise
-> (QlExercise -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a. Exercise -> (QlExercise -> IO a) -> IO a
withExercise Exercise
a4 ((QlExercise -> IO QuantoForwardVanillaOption)
 -> IO QuantoForwardVanillaOption)
-> (QlExercise -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. (a -> b) -> a -> b
$ \QlExercise
a4' -> 
  (Ptr (Ptr CChar) -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO QuantoForwardVanillaOption)
 -> IO QuantoForwardVanillaOption)
-> (Ptr (Ptr CChar) -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a5' -> 
  CDouble
-> CInt
-> QlStrikedTypePayoff
-> QlExercise
-> Ptr (Ptr CChar)
-> IO (Ptr CQuantoForwardVanillaOption')
quantoForwardVanillaOption'_ CDouble
a1' CInt
a2' QlStrikedTypePayoff
a3' QlExercise
a4' Ptr (Ptr CChar)
a5' IO (Ptr CQuantoForwardVanillaOption')
-> (Ptr CQuantoForwardVanillaOption'
    -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CQuantoForwardVanillaOption'
res ->
  Ptr CQuantoForwardVanillaOption' -> IO QuantoForwardVanillaOption
peekQuantoForwardVanillaOption Ptr CQuantoForwardVanillaOption'
res IO QuantoForwardVanillaOption
-> (QuantoForwardVanillaOption -> IO QuantoForwardVanillaOption)
-> IO QuantoForwardVanillaOption
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \QuantoForwardVanillaOption
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a5'IO ()
-> IO QuantoForwardVanillaOption -> IO QuantoForwardVanillaOption
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  QuantoForwardVanillaOption -> IO QuantoForwardVanillaOption
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (QuantoForwardVanillaOption
res')

{-# LINE 156 "./QuantLib/Instrument/Option.chs" #-}


-- |Quanto version of a vanilla option on a single asset.
quantoVanillaOption :: (StrikedPayoff) -> (Exercise) -> IO ((QuantoVanillaOption))
quantoVanillaOption a1 a2 =
  withStrikedPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  quantoVanillaOption'_ a1' a2' a3' >>= \res ->
  peekQuantoVanillaOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 159 "./QuantLib/Instrument/Option.chs" #-}


-- |Vanilla option (no discrete dividends, no barriers) on a single asset.
vanillaOption :: (StrikedPayoff) -> (Exercise) -> IO ((VanillaOption))
vanillaOption a1 a2 =
  withStrikedPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  vanillaOption'_ a1' a2' a3' >>= \res ->
  peekVanillaOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 162 "./QuantLib/Instrument/Option.chs" #-}


-- |Barrier option on a single asset.
barrierOption :: (BarrierType) -> (Double) -- ^barrier
 -> (Double) -- ^rebate
 -> (StrikedPayoff) -> (Exercise) -> IO ((BarrierOption))
barrierOption a1 a2 a3 a4 a5 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  withStrikedPayoff a4 $ \a4' -> 
  withExercise a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  barrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekBarrierOption res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 167 "./QuantLib/Instrument/Option.chs" #-}


-- |Barrier option on a single asset that is only monitored for part of its life (a partial-time barrier).
partialTimeBarrierOption :: (BarrierType) -> (PartialBarrierRange) -> (Double) -- ^barrier
 -> (Double) -- ^rebate
 -> (Day) -- ^coverEventDate
 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
partialTimeBarrierOption a1 a2 a3 a4 a5 a6 a7 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = (fromIntegral . fromEnum) a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  withDay a5 $ \a5' -> 
  withStrikedPayoff a6 $ \a6' -> 
  withExercise a7 $ \a7' -> 
  preErrorCheck $ \a8' -> 
  partialTimeBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a8'>>
  return (res')

{-# LINE 174 "./QuantLib/Instrument/Option.chs" #-}


-- |Double-barrier option on a single asset, with a lower and an upper barrier.
doubleBarrierOption :: (DoubleBarrierType) -> (Double) -- ^barrierLo
 -> (Double) -- ^barrierHi
 -> (Double) -- ^rebate
 -> (StrikedPayoff) -> (Exercise) -> IO ((DoubleBarrierOption))
doubleBarrierOption a1 a2 a3 a4 a5 a6 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  withStrikedPayoff a5 $ \a5' -> 
  withExercise a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  doubleBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekDoubleBarrierOption res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 180 "./QuantLib/Instrument/Option.chs" #-}


-- |Soft barrier option on a single asset: knocked in/out proportionally over a barrier range [barrierLo, barrierHi], rather than in full at a single hard barrier. European exercise only.
softBarrierOption :: (BarrierType) -> (Double) -- ^barrierLo
 -> (Double) -- ^barrierHi
 -> (StrikedPayoff) -> (Exercise) -> IO ((SoftBarrierOption))
softBarrierOption a1 a2 a3 a4 a5 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  withStrikedPayoff a4 $ \a4' -> 
  withExercise a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  softBarrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekSoftBarrierOption res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 185 "./QuantLib/Instrument/Option.chs" #-}


-- |Implied Black-Scholes volatility that reproduces the given price for a SoftBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
softBarrierOptionImpliedVolatility :: (SoftBarrierOption) -> (Double) -- ^price
 -> (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> (Double) -- ^minVol
 -> (Double) -- ^maxVol
 -> IO ((Double))
softBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 =
  withSoftBarrierOption a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withGeneralizedBlackScholesProcess a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  preErrorCheck $ \a8' -> 
  softBarrierOptionImpliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a8'>>
  return (res')

{-# LINE 194 "./QuantLib/Instrument/Option.chs" #-}


-- |Forward-starting (strike-resetting) version of a vanilla option.
forwardVanillaOption :: (Double) -- ^moneyness
 -> (Day) -- ^resetDate
 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
forwardVanillaOption a1 a2 a3 a4 =
  let {a1' = realToFrac a1} in 
  withDay a2 $ \a2' -> 
  withStrikedPayoff a3 $ \a3' -> 
  withExercise a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  forwardVanillaOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 199 "./QuantLib/Instrument/Option.chs" #-}


-- |Compound option (an option on another option) on a single asset. The mother option is the compound option itself; the daughter option is its underlying.
compoundOption :: (StrikedPayoff) -- ^motherPayoff
 -> (Exercise) -- ^motherExercise
 -> (StrikedPayoff) -- ^daughterPayoff
 -> (Exercise) -- ^daughterExercise
 -> IO ((OneAssetOption))
compoundOption a1 a2 a3 a4 =
  withStrikedPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  withStrikedPayoff a3 $ \a3' -> 
  withExercise a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  compoundOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 206 "./QuantLib/Instrument/Option.chs" #-}


-- |Simple chooser option on a single asset: the holder chooses, on the choosing date, whether the option is a call or a put; both share the same strike and exercise date.
simpleChooserOption :: (Day) -- ^choosingDate
 -> (Double) -- ^strike
 -> (Exercise) -> IO ((OneAssetOption))
simpleChooserOption a1 a2 a3 =
  withDay a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  simpleChooserOption'_ a1' a2' a3' a4' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 211 "./QuantLib/Instrument/Option.chs" #-}


-- |Complex chooser option: on the choosing date the holder selects between a call and a put with independent strikes and exercise dates.
complexChooserOption :: (Day) -- ^choosingDate
 -> (Double) -- ^strikeCall
 -> (Double) -- ^strikePut
 -> (Exercise) -- ^exerciseCall
 -> (Exercise) -- ^exercisePut
 -> IO ((OneAssetOption))
complexChooserOption a1 a2 a3 a4 a5 =
  withDay a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  withExercise a4 $ \a4' -> 
  withExercise a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  complexChooserOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 219 "./QuantLib/Instrument/Option.chs" #-}


-- |Writer-extensible option on a single asset: if out of the money at the first exercise, it is extended to a second exercise with an amended payoff.
writerExtensibleOption :: (PlainVanillaPayoff) -- ^payoff1
 -> (Exercise) -- ^exercise1
 -> (PlainVanillaPayoff) -- ^payoff2
 -> (Exercise) -- ^exercise2
 -> IO ((OneAssetOption))
writerExtensibleOption a1 a2 a3 a4 =
  withPlainVanillaPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  withPlainVanillaPayoff a3 $ \a3' -> 
  withExercise a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  writerExtensibleOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 226 "./QuantLib/Instrument/Option.chs" #-}


-- |Holder-extensible option: the holder may pay @premium@ at the first exercise to replace its payoff with an option at @secondExpiryDate@ and @secondStrike@.
holderExtensibleOption :: (OptionType) -- ^type
 -> (Double) -- ^premium
 -> (Day) -- ^secondExpiryDate
 -> (Double) -- ^secondStrike
 -> (StrikedPayoff) -- ^payoff
 -> (Exercise) -- ^exercise
 -> IO ((OneAssetOption))
holderExtensibleOption a1 a2 a3 a4 a5 a6 =
  let {a1' = fromEnumC a1} in 
  let {a2' = realToFrac a2} in 
  withDay a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  withStrikedPayoff a5 $ \a5' -> 
  withExercise a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  holderExtensibleOption'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 235 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a MargrabeOption's value to the price of the first asset.
firstAssetDelta :: (MargrabeOption) -> IO ((Double))
firstAssetDelta a1 =
  withMargrabeOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  firstAssetDelta'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 238 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a MargrabeOption's value to the price of the second asset.
secondAssetDelta :: (MargrabeOption) -> IO ((Double))
secondAssetDelta a1 =
  withMargrabeOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  secondAssetDelta'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 241 "./QuantLib/Instrument/Option.chs" #-}


-- |Second derivative of a MargrabeOption's value with respect to the price of the first asset.
firstAssetGamma :: (MargrabeOption) -> IO ((Double))
firstAssetGamma a1 =
  withMargrabeOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  firstAssetGamma'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 244 "./QuantLib/Instrument/Option.chs" #-}


-- |Second derivative of a MargrabeOption's value with respect to the price of the second asset.
secondAssetGamma :: (MargrabeOption) -> IO ((Double))
secondAssetGamma a1 =
  withMargrabeOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  secondAssetGamma'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 247 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of the option's value to the forward price of the underlying.
deltaForward :: (GenOneAssetOption oo) -> IO ((Double))
deltaForward a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  deltaForward'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 250 "./QuantLib/Instrument/Option.chs" #-}


-- |Percentage change in the option's value per percentage change in the underlying price.
elasticity :: (GenOneAssetOption oo) -> IO ((Double))
elasticity a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  elasticity'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 253 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of the option's value to the strike price.
strikeSensitivity :: (GenOneAssetOption oo) -> IO ((Double))
strikeSensitivity a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  strikeSensitivity'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 256 "./QuantLib/Instrument/Option.chs" #-}


-- |Theta divided by the number of days elapsed per day (as opposed to per year).
thetaPerDay :: (GenOneAssetOption oo) -> IO ((Double))
thetaPerDay a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  thetaPerDay'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 259 "./QuantLib/Instrument/Option.chs" #-}


-- |Margrabe option on two assets: the right to exchange Q2 units of the second asset for Q1 units of the first at expiration.
margrabeOption :: (Int) -- ^Q1
 -> (Int) -- ^Q2
 -> (Exercise) -> IO ((MargrabeOption))
margrabeOption a1 a2 a3 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  margrabeOption'_ a1' a2' a3' a4' >>= \res ->
  peekMargrabeOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 264 "./QuantLib/Instrument/Option.chs" #-}


-- |Barrier option on two assets: the first asset's value is compared to the strike to determine the payoff, while the second asset's value is monitored against the barrier.
twoAssetBarrierOption :: (BarrierType) -> (Double) -- ^barrier
 -> (StrikedPayoff) -> (Exercise) -> IO ((Instrument))
twoAssetBarrierOption a1 a2 a3 a4 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  withStrikedPayoff a3 $ \a3' -> 
  withExercise a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  twoAssetBarrierOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekInstrument res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 269 "./QuantLib/Instrument/Option.chs" #-}


-- |Base construction for an option on multiple assets.
multiAssetOption :: (Payoff) -> (Exercise) -> IO ((MultiAssetOption))
multiAssetOption a1 a2 =
  withPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  multiAssetOption'_ a1' a2' a3' >>= \res ->
  peekMultiAssetOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 272 "./QuantLib/Instrument/Option.chs" #-}


-- |Two-asset correlation option: pays a payoff based on the second asset's value against strike2 at exercise, but only if the first asset is also in the money against strike1; otherwise pays 0.
twoAssetCorrelationOption :: (OptionType) -- ^type
 -> (Double) -- ^strike1
 -> (Double) -- ^strike2
 -> (Exercise) -> IO ((MultiAssetOption))
twoAssetCorrelationOption a1 a2 a3 a4 =
  let {a1' = fromEnumC a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  withExercise a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  twoAssetCorrelationOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekMultiAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 278 "./QuantLib/Instrument/Option.chs" #-}


-- |Probability of the option expiring in-the-money in a cash-or-nothing sense.
itmCashProbability :: (GenOneAssetOption oo) -> IO ((Double))
itmCashProbability a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  itmCashProbability'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 281 "./QuantLib/Instrument/Option.chs" #-}


-- |Base construction for an option on a single asset.
oneAssetOption :: (Payoff) -> (Exercise) -> IO ((OneAssetOption))
oneAssetOption a1 a2 =
  withPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  oneAssetOption'_ a1' a2' a3' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 284 "./QuantLib/Instrument/Option.chs" #-}


-- |Quanto version of a barrier option on a single asset.
quantoBarrierOption :: (BarrierType) -> (Double) -- ^barrier
 -> (Double) -- ^rebate
 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoBarrierOption))
quantoBarrierOption a1 a2 a3 a4 a5 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  withStrikedPayoff a4 $ \a4' -> 
  withExercise a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  quantoBarrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekQuantoBarrierOption res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 290 "./QuantLib/Instrument/Option.chs" #-}


-- |Quanto version of a double-barrier option on a single asset, with a lower and an upper barrier.
quantoDoubleBarrierOption :: (DoubleBarrierType) -> (Double) -- ^barrierLo
 -> (Double) -- ^barrierHi
 -> (Double) -- ^rebate
 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoDoubleBarrierOption))
quantoDoubleBarrierOption a1 a2 a3 a4 a5 a6 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  withStrikedPayoff a5 $ \a5' -> 
  withExercise a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  quantoDoubleBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekQuantoDoubleBarrierOption res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 297 "./QuantLib/Instrument/Option.chs" #-}


-- |Basket option on a number of assets, combined by the given basket payoff (e.g. min/max/spread/average).
basketOption :: (BasketPayoff) -> (Exercise) -> IO ((MultiAssetOption))
basketOption a1 a2 =
  withBasketPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  basketOption'_ a1' a2' a3' >>= \res ->
  peekMultiAssetOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 300 "./QuantLib/Instrument/Option.chs" #-}


-- |Himalaya option: at the end of each of a series of periods, the best-performing asset in the basket is added to the average and dropped from the basket; the payoff is the max of the strike and the final average of best performers.
qlHimalayaOption :: ([Day]) -- ^fixingDates
 -> (Double) -- ^strike
 -> IO ((MultiAssetOption))
qlHimalayaOption a1 a2 =
  withDayArray a1 $ \(a1'1, a1'2) -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlHimalayaOption'_ a1'1  a1'2 a2' a3' >>= \res ->
  peekMultiAssetOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 305 "./QuantLib/Instrument/Option.chs" #-}


-- |Roofed Asian option on a number of assets: pays the given fraction of the minimum of the roof and the positive portfolio performance, or nothing if the performance is negative.
qlPagodaOption :: ([Day]) -- ^fixingDates
 -> (Double) -- ^roof
 -> (Double) -- ^fraction
 -> IO ((MultiAssetOption))
qlPagodaOption a1 a2 a3 =
  withDayArray a1 $ \(a1'1, a1'2) -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  qlPagodaOption'_ a1'1  a1'2 a2' a3' a4' >>= \res ->
  peekMultiAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 311 "./QuantLib/Instrument/Option.chs" #-}


himalayaOption :: NonEmpty Day -> Double -> IO MultiAssetOption
himalayaOption dates strike = qlHimalayaOption (toList dates) strike

pagodaOption :: NonEmpty Day -> Double -> Double -> IO MultiAssetOption
pagodaOption dates roof fraction = qlPagodaOption (toList dates) roof fraction

-- |Cliquet (ratchet) option: a series of forward-starting options where each period's strike is set to a fixed percentage of the spot price at the start of that period.
cliquetOption :: (PercentageStrikePayoff) -> (EuropeanExercise) -- ^maturity
 -> ([Day]) -- ^resetDates
 -> IO ((OneAssetOption))
cliquetOption :: PercentageStrikePayoff
-> EuropeanExercise -> [Day] -> IO OneAssetOption
cliquetOption PercentageStrikePayoff
a1 EuropeanExercise
a2 [Day]
a3 =
  PercentageStrikePayoff
-> (QlPercentageStrikePayoff -> IO OneAssetOption)
-> IO OneAssetOption
forall a.
PercentageStrikePayoff
-> (QlPercentageStrikePayoff -> IO a) -> IO a
withPercentageStrikePayoff PercentageStrikePayoff
a1 ((QlPercentageStrikePayoff -> IO OneAssetOption)
 -> IO OneAssetOption)
-> (QlPercentageStrikePayoff -> IO OneAssetOption)
-> IO OneAssetOption
forall a b. (a -> b) -> a -> b
$ \QlPercentageStrikePayoff
a1' -> 
  EuropeanExercise
-> (QlEuropeanExercise -> IO OneAssetOption) -> IO OneAssetOption
forall a. EuropeanExercise -> (QlEuropeanExercise -> IO a) -> IO a
withEuropeanExercise EuropeanExercise
a2 ((QlEuropeanExercise -> IO OneAssetOption) -> IO OneAssetOption)
-> (QlEuropeanExercise -> IO OneAssetOption) -> IO OneAssetOption
forall a b. (a -> b) -> a -> b
$ \QlEuropeanExercise
a2' -> 
  [Day]
-> ((CUInt, Ptr CInt) -> IO OneAssetOption) -> IO OneAssetOption
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a3 (((CUInt, Ptr CInt) -> IO OneAssetOption) -> IO OneAssetOption)
-> ((CUInt, Ptr CInt) -> IO OneAssetOption) -> IO OneAssetOption
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CInt
a3'2) -> 
  (Ptr (Ptr CChar) -> IO OneAssetOption) -> IO OneAssetOption
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO OneAssetOption) -> IO OneAssetOption)
-> (Ptr (Ptr CChar) -> IO OneAssetOption) -> IO OneAssetOption
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a4' -> 
  QlPercentageStrikePayoff
-> QlEuropeanExercise
-> CUInt
-> Ptr CInt
-> Ptr (Ptr CChar)
-> IO (Ptr COneAssetOption')
cliquetOption'_ QlPercentageStrikePayoff
a1' QlEuropeanExercise
a2' CUInt
a3'1  Ptr CInt
a3'2 Ptr (Ptr CChar)
a4' IO (Ptr COneAssetOption')
-> (Ptr COneAssetOption' -> IO OneAssetOption) -> IO OneAssetOption
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr COneAssetOption'
res ->
  Ptr COneAssetOption' -> IO OneAssetOption
peekOneAssetOption Ptr COneAssetOption'
res IO OneAssetOption
-> (OneAssetOption -> IO OneAssetOption) -> IO OneAssetOption
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \OneAssetOption
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a4'IO () -> IO OneAssetOption -> IO OneAssetOption
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  OneAssetOption -> IO OneAssetOption
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (OneAssetOption
res')

{-# LINE 322 "./QuantLib/Instrument/Option.chs" #-}


-- |Continuous-averaging Asian option on a single asset, for an unseasoned (fresh) option where averaging has not yet started.
continuousAveragingAsianOption :: (AverageType) -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
continuousAveragingAsianOption a1 a2 a3 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  withStrikedPayoff a2 $ \a2' -> 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  continuousAveragingAsianOption'_ a1' a2' a3' a4' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 325 "./QuantLib/Instrument/Option.chs" #-}


-- |Continuous-fixed lookback option: the payoff uses the fixed strike against the minimum/maximum price observed over the option's life.
continuousFixedLookbackOption :: (Double) -- ^currentMinmax
 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
continuousFixedLookbackOption a1 a2 a3 =
  let {a1' = realToFrac a1} in 
  withStrikedPayoff a2 $ \a2' -> 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  continuousFixedLookbackOption'_ a1' a2' a3' a4' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 329 "./QuantLib/Instrument/Option.chs" #-}


-- |Continuous-floating lookback option: the strike is set to the minimum/maximum price observed over the option's life.
continuousFloatingLookbackOption :: (Double) -- ^currentMinmax
 -> (TypePayoff) -> (Exercise) -> IO ((OneAssetOption))
continuousFloatingLookbackOption a1 a2 a3 =
  let {a1' = realToFrac a1} in 
  withTypePayoff a2 $ \a2' -> 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  continuousFloatingLookbackOption'_ a1' a2' a3' a4' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 333 "./QuantLib/Instrument/Option.chs" #-}


-- |Partial-time floating-strike lookback option: the lookback period runs from inception to @lookbackPeriodEnd@, cheaper than a full floating lookback. @lambda@ scales the strike relative to the observed extremum. Priced analytically by Heynen and Kat (1994).
continuousPartialFloatingLookbackOption :: (Double) -- ^currentMinmax
 -> (Double) -- ^lambda
 -> (Day) -- ^lookbackPeriodEnd
 -> (TypePayoff) -> (Exercise) -> IO ((OneAssetOption))
continuousPartialFloatingLookbackOption a1 a2 a3 a4 a5 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  withDay a3 $ \a3' -> 
  withTypePayoff a4 $ \a4' -> 
  withExercise a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  continuousPartialFloatingLookbackOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 339 "./QuantLib/Instrument/Option.chs" #-}


-- |Partial-time fixed-strike lookback option: the lookback period runs from @lookbackPeriodStart@ to expiry, cheaper than a full fixed lookback. Priced analytically by Heynen and Kat (1994).
continuousPartialFixedLookbackOption :: (Day) -- ^lookbackPeriodStart
 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
continuousPartialFixedLookbackOption a1 a2 a3 =
  withDay a1 $ \a1' -> 
  withStrikedPayoff a2 $ \a2' -> 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  continuousPartialFixedLookbackOption'_ a1' a2' a3' a4' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 343 "./QuantLib/Instrument/Option.chs" #-}


-- |The excess return over @guarantee@, realized on the worst-performing of a basket of assets and paid out on @notional@ at exercise.
everestOption :: (Double) -- ^notional
 -> (Double) -- ^guarantee
 -> (Exercise) -> IO ((EverestOption))
everestOption a1 a2 a3 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  withExercise a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  everestOption'_ a1' a2' a3' a4' >>= \res ->
  peekEverestOption res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 348 "./QuantLib/Instrument/Option.chs" #-}


-- |The realized yield on the notional, i.e. NPV\/(notional*discount) - 1.
yield :: (EverestOption) -> IO ((Double))
yield a1 =
  withEverestOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  yield'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 351 "./QuantLib/Instrument/Option.chs" #-}


-- |Discrete-averaging Asian option on a single asset, taking the running sum/product of past fixings plus a list of future fixing dates.
discreteAveragingAsianOption :: (AverageType) -> (Double) -- ^runningAccumulator, the running sum or products of past fixings
 -> (Word) -- ^pastFixings
 -> ([Day]) -- ^fixingDates
 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
discreteAveragingAsianOption a1 a2 a3 a4 a5 a6 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = fromIntegral a3} in 
  withDayArray a4 $ \(a4'1, a4'2) -> 
  withStrikedPayoff a5 $ \a5' -> 
  withExercise a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  discreteAveragingAsianOption'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 357 "./QuantLib/Instrument/Option.chs" #-}


-- |Storage option (e.g. a gas storage facility): a payoff-free instrument exercisable on a Bermudan schedule, with a maximum capacity, load/withdrawal rate, and per-period rate of change.
vanillaStorageOption :: (BermudanExercise) -> (Double) -- capacity
 -> (Double) -- ^load
 -> (Double) -- ^changeRate
 -> IO ((OneAssetOption))
vanillaStorageOption a1 a2 a3 a4 =
  withBermudanExercise a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  preErrorCheck $ \a5' -> 
  vanillaStorageOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 363 "./QuantLib/Instrument/Option.chs" #-}


-- |Swing option: a payoff exercisable a bounded number of times (between minExerciseRights and maxExerciseRights) at the dates of a SwingExercise.
vanillaSwingOption :: (StrikedPayoff) -> (SwingExercise) -> (Word) -- ^minExerciseRights
 -> (Word) -- ^maxExerciseRights
 -> IO ((OneAssetOption))
vanillaSwingOption a1 a2 a3 a4 =
  withStrikedPayoff a1 $ \a1' -> 
  withSwingExercise a2 $ \a2' -> 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  preErrorCheck $ \a5' -> 
  vanillaSwingOption'_ a1' a2' a3' a4' a5' >>= \res ->
  peekOneAssetOption res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 368 "./QuantLib/Instrument/Option.chs" #-}


-- |European (single-exercise-date) vanilla option on a single asset.
europeanOption :: (StrikedPayoff) -> (Exercise) -> IO ((VanillaOption))
europeanOption a1 a2 =
  withStrikedPayoff a1 $ \a1' -> 
  withExercise a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  europeanOption'_ a1' a2' a3' >>= \res ->
  peekVanillaOption res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 371 "./QuantLib/Instrument/Option.chs" #-}


class HasGreeks a where
  delta :: a -> IO Double
  gamma :: a -> IO Double
  rho :: a -> IO Double
  theta :: a -> IO Double
  vega :: a -> IO Double
  dividendRho :: a -> IO Double

instance HasGreeks MultiAssetOption where
  delta = qlMultiAssetOptionDelta
  gamma = qlMultiAssetOptionGamma
  rho = qlMultiAssetOptionRho
  theta = qlMultiAssetOptionTheta
  vega = qlMultiAssetOptionVega
  dividendRho = qlMultiAssetOptionDividendRho

instance HasGreeks OneAssetOption where
  delta :: OneAssetOption -> IO Double
delta = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionDelta
  gamma :: OneAssetOption -> IO Double
gamma = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionGamma
  rho :: OneAssetOption -> IO Double
rho = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionRho
  theta :: OneAssetOption -> IO Double
theta = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionTheta
  vega :: OneAssetOption -> IO Double
vega = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionVega
  dividendRho :: OneAssetOption -> IO Double
dividendRho = OneAssetOption -> IO Double
forall oo. GenOneAssetOption oo -> IO Double
qlOneAssetOptionDividendRho

-- |Sensitivity of a multi-asset option's value to the price of its underlying assets.
qlMultiAssetOptionDelta :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionDelta :: forall mo. GenMultiAssetOption mo -> IO Double
qlMultiAssetOptionDelta GenMultiAssetOption mo
a1 =
  GenMultiAssetOption mo
-> (Ptr CMultiAssetOption' -> IO Double) -> IO Double
forall mo b.
GenMultiAssetOption mo -> (Ptr CMultiAssetOption' -> IO b) -> IO b
withMultiAssetOption GenMultiAssetOption mo
a1 ((Ptr CMultiAssetOption' -> IO Double) -> IO Double)
-> (Ptr CMultiAssetOption' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CMultiAssetOption'
a1' -> 
  (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' -> 
  Ptr CMultiAssetOption' -> Ptr (Ptr CChar) -> IO CDouble
qlMultiAssetOptionDelta'_ Ptr CMultiAssetOption'
a1' Ptr (Ptr CChar)
a2' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
  let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a2'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')

{-# LINE 398 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a multi-asset option's value to the dividend yield of its underlying assets.
qlMultiAssetOptionDividendRho :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionDividendRho a1 =
  withMultiAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlMultiAssetOptionDividendRho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 401 "./QuantLib/Instrument/Option.chs" #-}


-- |Second derivative of a multi-asset option's value with respect to the price of its underlying assets.
qlMultiAssetOptionGamma :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionGamma a1 =
  withMultiAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlMultiAssetOptionGamma'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 404 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a multi-asset option's value to the risk-free interest rate.
qlMultiAssetOptionRho :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionRho a1 =
  withMultiAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlMultiAssetOptionRho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 407 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a multi-asset option's value to the passage of time.
qlMultiAssetOptionTheta :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionTheta a1 =
  withMultiAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlMultiAssetOptionTheta'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 410 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a multi-asset option's value to the volatility of its underlying assets.
qlMultiAssetOptionVega :: (GenMultiAssetOption mo) -> IO ((Double))
qlMultiAssetOptionVega a1 =
  withMultiAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlMultiAssetOptionVega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 413 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a single-asset option's value to the price of its underlying.
qlOneAssetOptionDelta :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionDelta a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionDelta'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 416 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a single-asset option's value to the dividend yield of its underlying.
qlOneAssetOptionDividendRho :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionDividendRho a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionDividendRho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 419 "./QuantLib/Instrument/Option.chs" #-}


-- |Second derivative of a single-asset option's value with respect to the price of its underlying.
qlOneAssetOptionGamma :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionGamma a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionGamma'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 422 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a single-asset option's value to the risk-free interest rate.
qlOneAssetOptionRho :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionRho a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionRho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 425 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a single-asset option's value to the passage of time.
qlOneAssetOptionTheta :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionTheta a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionTheta'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 428 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a single-asset option's value to the volatility of its underlying.
qlOneAssetOptionVega :: (GenOneAssetOption oo) -> IO ((Double))
qlOneAssetOptionVega a1 =
  withOneAssetOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOneAssetOptionVega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 431 "./QuantLib/Instrument/Option.chs" #-}


class HasQuanto a where
  qrho :: a -> IO Double
  qvega :: a -> IO Double
  qlambda :: a -> IO Double
instance HasQuanto QuantoBarrierOption where
  qrho = qlQuantoBarrierOptionQrho
  qvega = qlQuantoBarrierOptionQvega
  qlambda = qlQuantoBarrierOptionQlambda
instance HasQuanto QuantoDoubleBarrierOption where
  qrho :: QuantoDoubleBarrierOption -> IO Double
qrho = QuantoDoubleBarrierOption -> IO Double
qlQuantoDoubleBarrierOptionQrho
  qvega :: QuantoDoubleBarrierOption -> IO Double
qvega = QuantoDoubleBarrierOption -> IO Double
qlQuantoDoubleBarrierOptionQvega
  qlambda :: QuantoDoubleBarrierOption -> IO Double
qlambda = QuantoDoubleBarrierOption -> IO Double
qlQuantoDoubleBarrierOptionQlambda
instance HasQuanto QuantoForwardVanillaOption where
  qrho :: QuantoForwardVanillaOption -> IO Double
qrho = QuantoForwardVanillaOption -> IO Double
qlQuantoForwardVanillaOptionQrho
  qvega :: QuantoForwardVanillaOption -> IO Double
qvega = QuantoForwardVanillaOption -> IO Double
qlQuantoForwardVanillaOptionQvega
  qlambda :: QuantoForwardVanillaOption -> IO Double
qlambda = QuantoForwardVanillaOption -> IO Double
qlQuantoForwardVanillaOptionQlambda
instance HasQuanto QuantoVanillaOption where
  qrho :: QuantoVanillaOption -> IO Double
qrho = QuantoVanillaOption -> IO Double
qlQuantoVanillaOptionQrho
  qvega :: QuantoVanillaOption -> IO Double
qvega = QuantoVanillaOption -> IO Double
qlQuantoVanillaOptionQvega
  qlambda :: QuantoVanillaOption -> IO Double
qlambda = QuantoVanillaOption -> IO Double
qlQuantoVanillaOptionQlambda

class HasImpliedVol a where
-- /Warning/ currently, this method returns the Black-Scholes implied volatility using analytic formulas for European options and a finite-difference method for American and Bermudan options. It will give unconsistent results if the pricing was performed with any other methods (such as jump-diffusion models.)Warningoptions with a gamma that changes sign (e.g., binary options) have values that are not monotonic in the volatility. In these cases, the calculation can fail and the result (if any) is almost meaningless. Another possible source of failure is to have a target value that is not attainable with any volatility, e.g., a target value lower than the intrinsic value in the case of American options.
  impliedVolatility :: a
    -> Double -- ^price
    -> GeneralizedBlackScholesProcess -- ^process
    -> [Dividend] -- ^dividends
    -> Double -- ^accuracy
    -> Word -- ^maxEvaluations
    -> Double -- ^minVol
    -> Double -- ^maxVol
    -> IO Double
instance HasImpliedVol VanillaOption where
  impliedVolatility :: VanillaOption
-> Double
-> GeneralizedBlackScholesProcess
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
impliedVolatility = VanillaOption
-> Double
-> GeneralizedBlackScholesProcess
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
forall gbs.
VanillaOption
-> Double
-> GenGeneralizedBlackScholesProcess gbs
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
qlVanillaOptionImpliedVolatility
instance HasImpliedVol BarrierOption where
  impliedVolatility :: BarrierOption
-> Double
-> GeneralizedBlackScholesProcess
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
impliedVolatility = BarrierOption
-> Double
-> GeneralizedBlackScholesProcess
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
forall gbs.
BarrierOption
-> Double
-> GenGeneralizedBlackScholesProcess gbs
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
qlBarrierOptionImpliedVolatility

-- |Sensitivity of a QuantoBarrierOption's value to the correlation-driven quanto adjustment's foreign rate.
qlQuantoBarrierOptionQrho :: (QuantoBarrierOption) -> IO ((Double))
qlQuantoBarrierOptionQrho :: QuantoBarrierOption -> IO Double
qlQuantoBarrierOptionQrho QuantoBarrierOption
a1 =
  QuantoBarrierOption
-> (Ptr CQuantoBarrierOption' -> IO Double) -> IO Double
forall b.
QuantoBarrierOption -> (Ptr CQuantoBarrierOption' -> IO b) -> IO b
withQuantoBarrierOption QuantoBarrierOption
a1 ((Ptr CQuantoBarrierOption' -> IO Double) -> IO Double)
-> (Ptr CQuantoBarrierOption' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CQuantoBarrierOption'
a1' -> 
  (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' -> 
  Ptr CQuantoBarrierOption' -> Ptr (Ptr CChar) -> IO CDouble
qlQuantoBarrierOptionQrho'_ Ptr CQuantoBarrierOption'
a1' Ptr (Ptr CChar)
a2' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
  let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a2'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')

{-# LINE 471 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoBarrierOption's value to the exchange-rate volatility.
qlQuantoBarrierOptionQvega :: (QuantoBarrierOption) -> IO ((Double))
qlQuantoBarrierOptionQvega a1 =
  withQuantoBarrierOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoBarrierOptionQvega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 474 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoBarrierOption's value to the correlation between the underlying and the exchange rate.
qlQuantoBarrierOptionQlambda :: (QuantoBarrierOption) -> IO ((Double))
qlQuantoBarrierOptionQlambda a1 =
  withQuantoBarrierOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoBarrierOptionQlambda'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 477 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoDoubleBarrierOption's value to the correlation-driven quanto adjustment's foreign rate.
qlQuantoDoubleBarrierOptionQrho :: (QuantoDoubleBarrierOption) -> IO ((Double))
qlQuantoDoubleBarrierOptionQrho a1 =
  withQuantoDoubleBarrierOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoDoubleBarrierOptionQrho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 480 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoDoubleBarrierOption's value to the exchange-rate volatility.
qlQuantoDoubleBarrierOptionQvega :: (QuantoDoubleBarrierOption) -> IO ((Double))
qlQuantoDoubleBarrierOptionQvega a1 =
  withQuantoDoubleBarrierOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoDoubleBarrierOptionQvega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 483 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoDoubleBarrierOption's value to the correlation between the underlying and the exchange rate.
qlQuantoDoubleBarrierOptionQlambda :: (QuantoDoubleBarrierOption) -> IO ((Double))
qlQuantoDoubleBarrierOptionQlambda a1 =
  withQuantoDoubleBarrierOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoDoubleBarrierOptionQlambda'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 486 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoForwardVanillaOption's value to the correlation-driven quanto adjustment's foreign rate.
qlQuantoForwardVanillaOptionQrho :: (QuantoForwardVanillaOption) -> IO ((Double))
qlQuantoForwardVanillaOptionQrho a1 =
  withQuantoForwardVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoForwardVanillaOptionQrho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 489 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoForwardVanillaOption's value to the exchange-rate volatility.
qlQuantoForwardVanillaOptionQvega :: (QuantoForwardVanillaOption) -> IO ((Double))
qlQuantoForwardVanillaOptionQvega a1 =
  withQuantoForwardVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoForwardVanillaOptionQvega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 492 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoForwardVanillaOption's value to the correlation between the underlying and the exchange rate.
qlQuantoForwardVanillaOptionQlambda :: (QuantoForwardVanillaOption) -> IO ((Double))
qlQuantoForwardVanillaOptionQlambda a1 =
  withQuantoForwardVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoForwardVanillaOptionQlambda'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 495 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoVanillaOption's value to the correlation-driven quanto adjustment's foreign rate.
qlQuantoVanillaOptionQrho :: (QuantoVanillaOption) -> IO ((Double))
qlQuantoVanillaOptionQrho a1 =
  withQuantoVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoVanillaOptionQrho'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 498 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoVanillaOption's value to the exchange-rate volatility.
qlQuantoVanillaOptionQvega :: (QuantoVanillaOption) -> IO ((Double))
qlQuantoVanillaOptionQvega a1 =
  withQuantoVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoVanillaOptionQvega'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 501 "./QuantLib/Instrument/Option.chs" #-}


-- |Sensitivity of a QuantoVanillaOption's value to the correlation between the underlying and the exchange rate.
qlQuantoVanillaOptionQlambda :: (QuantoVanillaOption) -> IO ((Double))
qlQuantoVanillaOptionQlambda a1 =
  withQuantoVanillaOption a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlQuantoVanillaOptionQlambda'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 504 "./QuantLib/Instrument/Option.chs" #-}


-- |Implied Black-Scholes volatility that reproduces the given price for a VanillaOption, computed analytically for European exercise and by finite differences for American/Bermudan; may be unreliable for a gamma that changes sign or a price unattainable at any volatility.
qlVanillaOptionImpliedVolatility :: (VanillaOption) -> (Double) -- ^price
 -> (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -- ^dividends
 -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> (Double) -- ^minVol
 -> (Double) -- ^maxVol
 -> IO ((Double))
qlVanillaOptionImpliedVolatility :: forall gbs.
VanillaOption
-> Double
-> GenGeneralizedBlackScholesProcess gbs
-> [Dividend]
-> Double
-> Word
-> Double
-> Double
-> IO Double
qlVanillaOptionImpliedVolatility VanillaOption
a1 Double
a2 GenGeneralizedBlackScholesProcess gbs
a3 [Dividend]
a4 Double
a5 Word
a6 Double
a7 Double
a8 =
  VanillaOption -> (Ptr CVanillaOption' -> IO Double) -> IO Double
forall b. VanillaOption -> (Ptr CVanillaOption' -> IO b) -> IO b
withVanillaOption VanillaOption
a1 ((Ptr CVanillaOption' -> IO Double) -> IO Double)
-> (Ptr CVanillaOption' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CVanillaOption'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  GenGeneralizedBlackScholesProcess gbs
-> (Ptr CGeneralizedBlackScholesProcess' -> IO Double) -> IO Double
forall gbs b.
GenGeneralizedBlackScholesProcess gbs
-> (Ptr CGeneralizedBlackScholesProcess' -> IO b) -> IO b
withGeneralizedBlackScholesProcess GenGeneralizedBlackScholesProcess gbs
a3 ((Ptr CGeneralizedBlackScholesProcess' -> IO Double) -> IO Double)
-> (Ptr CGeneralizedBlackScholesProcess' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CGeneralizedBlackScholesProcess'
a3' -> 
  [Dividend]
-> ((CUInt, Ptr (Ptr CDividend)) -> IO Double) -> IO Double
forall b.
[Dividend] -> ((CUInt, Ptr (Ptr CDividend)) -> IO b) -> IO b
withDividendArray [Dividend]
a4 (((CUInt, Ptr (Ptr CDividend)) -> IO Double) -> IO Double)
-> ((CUInt, Ptr (Ptr CDividend)) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \(CUInt
a4'1, Ptr (Ptr CDividend)
a4'2) -> 
  let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in 
  let {a6' :: CUInt
a6' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a6} in 
  let {a7' :: CDouble
a7' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a7} in 
  let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in 
  (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' -> 
  Ptr CVanillaOption'
-> CDouble
-> Ptr CGeneralizedBlackScholesProcess'
-> CUInt
-> Ptr (Ptr CDividend)
-> CDouble
-> CUInt
-> CDouble
-> CDouble
-> Ptr (Ptr CChar)
-> IO CDouble
qlVanillaOptionImpliedVolatility'_ Ptr CVanillaOption'
a1' CDouble
a2' Ptr CGeneralizedBlackScholesProcess'
a3' CUInt
a4'1  Ptr (Ptr CDividend)
a4'2 CDouble
a5' CUInt
a6' CDouble
a7' CDouble
a8' Ptr (Ptr CChar)
a9' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
  let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a9'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')

{-# LINE 514 "./QuantLib/Instrument/Option.chs" #-}


-- |Implied Black-Scholes volatility that reproduces the given price for a BarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
qlBarrierOptionImpliedVolatility :: (BarrierOption) -> (Double) -- ^price
 -> (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -- ^dividends
 -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> (Double) -- ^minVol
 -> (Double) -- ^maxVol
 -> IO ((Double))
qlBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
  withBarrierOption a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withGeneralizedBlackScholesProcess a3 $ \a3' -> 
  withDividendArray a4 $ \(a4'1, a4'2) -> 
  let {a5' = realToFrac a5} in 
  let {a6' = fromIntegral a6} in 
  let {a7' = realToFrac a7} in 
  let {a8' = realToFrac a8} in 
  preErrorCheck $ \a9' -> 
  qlBarrierOptionImpliedVolatility'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a9'>>
  return (res')

{-# LINE 524 "./QuantLib/Instrument/Option.chs" #-}


-- |Implied Black-Scholes volatility that reproduces the given price for a DoubleBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
doubleBarrierOptionImpliedVolatility :: (DoubleBarrierOption) -> (Double) -- ^price
 -> (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> (Double) -- ^minVol
 -> (Double) -- ^maxVol
 -> IO ((Double))
doubleBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 =
  withDoubleBarrierOption a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withGeneralizedBlackScholesProcess a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  preErrorCheck $ \a8' -> 
  doubleBarrierOptionImpliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a8'>>
  return (res')

{-# LINE 533 "./QuantLib/Instrument/Option.chs" #-}


-- vim: set ff=unix ts=8 sts=2 sw=2 et:

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOption"
  quantoForwardVanillaOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoForwardVanillaOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOption"
  quantoVanillaOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoVanillaOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaOption"
  vanillaOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVanillaOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBarrierOption"
  barrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBarrierOption')))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlPartialTimeBarrierOption"
  partialTimeBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDoubleBarrierOption"
  doubleBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDoubleBarrierOption'))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSoftBarrierOption"
  softBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSoftBarrierOption')))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSoftBarrierOptionImpliedVolatility"
  softBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CSoftBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlForwardVanillaOption"
  forwardVanillaOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlCompoundOption"
  compoundOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSimpleChooserOption"
  simpleChooserOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlComplexChooserOption"
  complexChooserOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlExercise) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlWriterExtensibleOption"
  writerExtensibleOption'_ :: ((QlPlainVanillaPayoff) -> ((QlExercise) -> ((QlPlainVanillaPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlHolderExtensibleOption"
  holderExtensibleOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionDelta1"
  firstAssetDelta'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionDelta2"
  secondAssetDelta'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionGamma1"
  firstAssetGamma'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionGamma2"
  secondAssetGamma'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDeltaForward"
  deltaForward'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionElasticity"
  elasticity'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionStrikeSensitivity"
  strikeSensitivity'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionThetaPerDay"
  thetaPerDay'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOption"
  margrabeOption'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMargrabeOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlTwoAssetBarrierOption"
  twoAssetBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInstrument'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOption"
  multiAssetOption'_ :: ((QlPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlTwoAssetCorrelationOption"
  twoAssetCorrelationOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionItmCashProbability"
  itmCashProbability'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOption"
  oneAssetOption'_ :: ((QlPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOption"
  quantoBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoBarrierOption')))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOption"
  quantoDoubleBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoDoubleBarrierOption'))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBasketOption"
  basketOption'_ :: ((QlBasketPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlHimalayaOption"
  qlHimalayaOption'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlPagodaOption"
  qlPagodaOption'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlCliquetOption"
  cliquetOption'_ :: ((QlPercentageStrikePayoff) -> ((QlEuropeanExercise) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousAveragingAsianOption"
  continuousAveragingAsianOption'_ :: (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousFixedLookbackOption"
  continuousFixedLookbackOption'_ :: (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousFloatingLookbackOption"
  continuousFloatingLookbackOption'_ :: (C2HSImp.CDouble -> ((QlTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousPartialFloatingLookbackOption"
  continuousPartialFloatingLookbackOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousPartialFixedLookbackOption"
  continuousPartialFixedLookbackOption'_ :: (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlEverestOption"
  everestOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CEverestOption')))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlEverestOptionYield"
  yield'_ :: ((C2HSImp.Ptr (CEverestOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDiscreteAveragingAsianOption"
  discreteAveragingAsianOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaStorageOption"
  vanillaStorageOption'_ :: ((QlBermudanExercise) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaSwingOption"
  vanillaSwingOption'_ :: ((QlStrikedTypePayoff) -> ((QlSwingExercise) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlEuropeanOption"
  europeanOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVanillaOption'))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionDelta"
  qlMultiAssetOptionDelta'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionDividendRho"
  qlMultiAssetOptionDividendRho'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionGamma"
  qlMultiAssetOptionGamma'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionRho"
  qlMultiAssetOptionRho'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionTheta"
  qlMultiAssetOptionTheta'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionVega"
  qlMultiAssetOptionVega'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDelta"
  qlOneAssetOptionDelta'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDividendRho"
  qlOneAssetOptionDividendRho'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionGamma"
  qlOneAssetOptionGamma'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionRho"
  qlOneAssetOptionRho'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionTheta"
  qlOneAssetOptionTheta'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionVega"
  qlOneAssetOptionVega'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQrho"
  qlQuantoBarrierOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQvega"
  qlQuantoBarrierOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQlambda"
  qlQuantoBarrierOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQrho"
  qlQuantoDoubleBarrierOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQvega"
  qlQuantoDoubleBarrierOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQlambda"
  qlQuantoDoubleBarrierOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQrho"
  qlQuantoForwardVanillaOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQvega"
  qlQuantoForwardVanillaOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQlambda"
  qlQuantoForwardVanillaOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQrho"
  qlQuantoVanillaOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQvega"
  qlQuantoVanillaOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQlambda"
  qlQuantoVanillaOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaOptionImpliedVolatility"
  qlVanillaOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CVanillaOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBarrierOptionImpliedVolatility"
  qlBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))))

foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDoubleBarrierOptionImpliedVolatility"
  doubleBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CDoubleBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))