| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
QuantLib.Instrument.Option
Synopsis
- type GenOption o = GenInstrument (AnyOf COption' o)
- type Option = GenOption COption
- type GenOneAssetOption oo = GenOption (AnyOf COneAssetOption' oo)
- type OneAssetOption = GenOneAssetOption COneAssetOption
- type GenMultiAssetOption mo = GenOption (AnyOf CMultiAssetOption' mo)
- type MultiAssetOption = GenMultiAssetOption CMultiAssetOption
- type CdsOption = GenOption CCdsOption
- type BarrierOption = GenOneAssetOption CBarrierOption
- type DoubleBarrierOption = GenOneAssetOption CDoubleBarrierOption
- type EverestOption = GenMultiAssetOption CEverestOption
- type MargrabeOption = GenMultiAssetOption CMargrabeOption
- type QuantoBarrierOption = GenOneAssetOption CQuantoBarrierOption
- type QuantoDoubleBarrierOption = GenOneAssetOption CQuantoDoubleBarrierOption
- type QuantoForwardVanillaOption = GenOneAssetOption CQuantoForwardVanillaOption
- type QuantoVanillaOption = GenOneAssetOption CQuantoVanillaOption
- type SoftBarrierOption = GenOneAssetOption CSoftBarrierOption
- type VanillaOption = GenOneAssetOption CVanillaOption
- data ExerciseType
- data Exercise
- data EuropeanExercise = EuropeanExercise Day
- data BermudanExercise
- data SwingExercise
- = SwingListExercise !(NonEmpty (Day, Word))
- | SwingIntervalExercise !Day !Day !Word
- data OptionType
- data PositionType
- data StrikedPayoff
- = AssetOrNothing !OptionType !Double
- | CashOrNothing !OptionType !Double !Double
- | Gap !OptionType !Double !Double
- | PercentageStrike !PercentageStrikePayoff
- | PlainVanilla !PlainVanillaPayoff
- | SuperFund !Double !Double
- | SuperSharePayoff !Double !Double !Double
- | CustomStriked !OptionType !Double !String !(FunPtr PayoffFun)
- data PlainVanillaPayoff = PlainVanillaPayoff !OptionType !Double
- data PercentageStrikePayoff = PercentageStrikePayoff !OptionType !Double
- data BasketPayoff
- data Payoff
- = DoubleStickyRatchet !Double !Double !Double !Double !Double !Double !Double !Double !Double !Double !Double
- | ForwardType !PositionType !Double
- | RatchetMax !Double !Double !Double !Double !Double !Double !Double !Double !Double
- | RatchetMin !Double !Double !Double !Double !Double !Double !Double !Double !Double
- | Ratchet !Double !Double !Double !Double !Double !Double
- | StickyMax !Double !Double !Double !Double !Double !Double !Double !Double !Double
- | StickyMin !Double !Double !Double !Double !Double !Double !Double !Double !Double
- | Sticky !Double !Double !Double !Double !Double !Double
- | Type !TypePayoff
- | Basket !BasketPayoff
- | Custom !String !String !(FunPtr PayoffFun)
- data TypePayoff
- asOption :: GenOption o -> IO Option
- asOneAssetOption :: GenOneAssetOption oo -> IO OneAssetOption
- strikedPayoff :: StrikedPayoff -> Payoff
- plainVanillaPayoff :: PlainVanillaPayoff -> Payoff
- percentageStrikePayoff :: PercentageStrikePayoff -> Payoff
- withCustomPayoff :: String -> String -> (Double -> Double) -> (Payoff -> IO b) -> IO b
- withCustomStrikedPayoff :: OptionType -> Double -> String -> (Double -> Double) -> (StrikedPayoff -> IO b) -> IO b
- withCustomBasketPayoff :: Payoff -> ([Double] -> Double) -> (BasketPayoff -> IO b) -> IO b
- swingExercise :: SwingExercise -> Exercise
- barrierOption :: BarrierType -> Double -> Double -> StrikedPayoff -> Exercise -> IO BarrierOption
- partialTimeBarrierOption :: BarrierType -> PartialBarrierRange -> Double -> Double -> Day -> StrikedPayoff -> Exercise -> IO OneAssetOption
- doubleBarrierOption :: DoubleBarrierType -> Double -> Double -> Double -> StrikedPayoff -> Exercise -> IO DoubleBarrierOption
- softBarrierOption :: BarrierType -> Double -> Double -> StrikedPayoff -> Exercise -> IO SoftBarrierOption
- forwardVanillaOption :: Double -> Day -> StrikedPayoff -> Exercise -> IO OneAssetOption
- compoundOption :: StrikedPayoff -> Exercise -> StrikedPayoff -> Exercise -> IO OneAssetOption
- margrabeOption :: Int -> Int -> Exercise -> IO MargrabeOption
- simpleChooserOption :: Day -> Double -> Exercise -> IO OneAssetOption
- complexChooserOption :: Day -> Double -> Double -> Exercise -> Exercise -> IO OneAssetOption
- twoAssetCorrelationOption :: OptionType -> Double -> Double -> Exercise -> IO MultiAssetOption
- writerExtensibleOption :: PlainVanillaPayoff -> Exercise -> PlainVanillaPayoff -> Exercise -> IO OneAssetOption
- holderExtensibleOption :: OptionType -> Double -> Day -> Double -> StrikedPayoff -> Exercise -> IO OneAssetOption
- multiAssetOption :: Payoff -> Exercise -> IO MultiAssetOption
- oneAssetOption :: Payoff -> Exercise -> IO OneAssetOption
- quantoBarrierOption :: BarrierType -> Double -> Double -> StrikedPayoff -> Exercise -> IO QuantoBarrierOption
- quantoDoubleBarrierOption :: DoubleBarrierType -> Double -> Double -> Double -> StrikedPayoff -> Exercise -> IO QuantoDoubleBarrierOption
- quantoForwardVanillaOption :: Double -> Day -> StrikedPayoff -> Exercise -> IO QuantoForwardVanillaOption
- quantoVanillaOption :: StrikedPayoff -> Exercise -> IO QuantoVanillaOption
- twoAssetBarrierOption :: BarrierType -> Double -> StrikedPayoff -> Exercise -> IO Instrument
- vanillaOption :: StrikedPayoff -> Exercise -> IO VanillaOption
- basketOption :: BasketPayoff -> Exercise -> IO MultiAssetOption
- himalayaOption :: NonEmpty Day -> Double -> IO MultiAssetOption
- pagodaOption :: NonEmpty Day -> Double -> Double -> IO MultiAssetOption
- cliquetOption :: PercentageStrikePayoff -> EuropeanExercise -> [Day] -> IO OneAssetOption
- continuousAveragingAsianOption :: AverageType -> StrikedPayoff -> Exercise -> IO OneAssetOption
- continuousFixedLookbackOption :: Double -> StrikedPayoff -> Exercise -> IO OneAssetOption
- continuousFloatingLookbackOption :: Double -> TypePayoff -> Exercise -> IO OneAssetOption
- continuousPartialFixedLookbackOption :: Day -> StrikedPayoff -> Exercise -> IO OneAssetOption
- continuousPartialFloatingLookbackOption :: Double -> Double -> Day -> TypePayoff -> Exercise -> IO OneAssetOption
- everestOption :: Double -> Double -> Exercise -> IO EverestOption
- discreteAveragingAsianOption :: AverageType -> Double -> Word -> [Day] -> StrikedPayoff -> Exercise -> IO OneAssetOption
- vanillaStorageOption :: BermudanExercise -> Double -> Double -> Double -> IO OneAssetOption
- vanillaSwingOption :: StrikedPayoff -> SwingExercise -> Word -> Word -> IO OneAssetOption
- europeanOption :: StrikedPayoff -> Exercise -> IO VanillaOption
- class HasImpliedVol a where
- impliedVolatility :: a -> Double -> GeneralizedBlackScholesProcess -> [Dividend] -> Double -> Word -> Double -> Double -> IO Double
- doubleBarrierOptionImpliedVolatility :: DoubleBarrierOption -> Double -> GenGeneralizedBlackScholesProcess gbs -> Double -> Word -> Double -> Double -> IO Double
- softBarrierOptionImpliedVolatility :: SoftBarrierOption -> Double -> GenGeneralizedBlackScholesProcess gbs -> Double -> Word -> Double -> Double -> IO Double
- class HasGreeks a where
- class HasQuanto a where
- firstAssetDelta :: MargrabeOption -> IO Double
- secondAssetDelta :: MargrabeOption -> IO Double
- firstAssetGamma :: MargrabeOption -> IO Double
- secondAssetGamma :: MargrabeOption -> IO Double
- deltaForward :: GenOneAssetOption oo -> IO Double
- elasticity :: GenOneAssetOption oo -> IO Double
- itmCashProbability :: GenOneAssetOption oo -> IO Double
- strikeSensitivity :: GenOneAssetOption oo -> IO Double
- thetaPerDay :: GenOneAssetOption oo -> IO Double
- yield :: EverestOption -> IO Double
Types
Option hierarchy
type GenOption o = GenInstrument (AnyOf COption' o) Source #
type Option = GenOption COption Source #
An Instrument; see the hierarchy under GenInstrument.
type GenOneAssetOption oo = GenOption (AnyOf COneAssetOption' oo) Source #
type OneAssetOption = GenOneAssetOption COneAssetOption Source #
An Option; see the hierarchy under GenInstrument.
type GenMultiAssetOption mo = GenOption (AnyOf CMultiAssetOption' mo) Source #
type MultiAssetOption = GenMultiAssetOption CMultiAssetOption Source #
An Option; see the hierarchy under GenInstrument.
type BarrierOption = GenOneAssetOption CBarrierOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type DoubleBarrierOption = GenOneAssetOption CDoubleBarrierOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type EverestOption = GenMultiAssetOption CEverestOption Source #
A MultiAssetOption; see the hierarchy under GenInstrument.
type MargrabeOption = GenMultiAssetOption CMargrabeOption Source #
A MultiAssetOption; see the hierarchy under GenInstrument.
type QuantoBarrierOption = GenOneAssetOption CQuantoBarrierOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type QuantoDoubleBarrierOption = GenOneAssetOption CQuantoDoubleBarrierOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type QuantoForwardVanillaOption = GenOneAssetOption CQuantoForwardVanillaOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type QuantoVanillaOption = GenOneAssetOption CQuantoVanillaOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type SoftBarrierOption = GenOneAssetOption CSoftBarrierOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
type VanillaOption = GenOneAssetOption CVanillaOption Source #
An OneAssetOption; see the hierarchy under GenInstrument.
Exercises
data ExerciseType Source #
Instances
| Enum ExerciseType Source # | |
Defined in QuantLib.Internal.Common Methods succ :: ExerciseType -> ExerciseType # pred :: ExerciseType -> ExerciseType # toEnum :: Int -> ExerciseType # fromEnum :: ExerciseType -> Int # enumFrom :: ExerciseType -> [ExerciseType] # enumFromThen :: ExerciseType -> ExerciseType -> [ExerciseType] # enumFromTo :: ExerciseType -> ExerciseType -> [ExerciseType] # enumFromThenTo :: ExerciseType -> ExerciseType -> ExerciseType -> [ExerciseType] # | |
| Read ExerciseType Source # | |
Defined in QuantLib.Internal.Common Methods readsPrec :: Int -> ReadS ExerciseType # readList :: ReadS [ExerciseType] # | |
| Show ExerciseType Source # | |
Defined in QuantLib.Internal.Common Methods showsPrec :: Int -> ExerciseType -> ShowS # show :: ExerciseType -> String # showList :: [ExerciseType] -> ShowS # | |
| Eq ExerciseType Source # | |
Defined in QuantLib.Internal.Common | |
Exercise American Early Vanilla EuropeanExercise BermudanExercise SwingExercise Rebated (wraps another Exercise)
Constructors
| American | |
| Early !ExerciseType !Bool | |
| Vanilla !ExerciseType | |
| European !EuropeanExercise | |
| Bermudan !BermudanExercise | |
| Rebated | |
Fields
| |
data EuropeanExercise Source #
Constructors
| EuropeanExercise Day |
data BermudanExercise Source #
Constructors
| BermudanExercise !(NonEmpty Day) !Bool | |
| Swing SwingExercise |
data SwingExercise Source #
Use swingExerice to construct Exercise
Constructors
| SwingListExercise !(NonEmpty (Day, Word)) | (dates, seconds) |
| SwingIntervalExercise !Day !Day !Word | stepSizeSecs |
Option conventions
data OptionType Source #
Instances
| Enum OptionType Source # | |
Defined in QuantLib.Internal.Common Methods succ :: OptionType -> OptionType # pred :: OptionType -> OptionType # toEnum :: Int -> OptionType # fromEnum :: OptionType -> Int # enumFrom :: OptionType -> [OptionType] # enumFromThen :: OptionType -> OptionType -> [OptionType] # enumFromTo :: OptionType -> OptionType -> [OptionType] # enumFromThenTo :: OptionType -> OptionType -> OptionType -> [OptionType] # | |
| Read OptionType Source # | |
Defined in QuantLib.Internal.Common Methods readsPrec :: Int -> ReadS OptionType # readList :: ReadS [OptionType] # readPrec :: ReadPrec OptionType # readListPrec :: ReadPrec [OptionType] # | |
| Show OptionType Source # | |
Defined in QuantLib.Internal.Common Methods showsPrec :: Int -> OptionType -> ShowS # show :: OptionType -> String # showList :: [OptionType] -> ShowS # | |
| Eq OptionType Source # | |
Defined in QuantLib.Internal.Common | |
data PositionType Source #
Instances
| Enum PositionType Source # | |
Defined in QuantLib.Internal.Common Methods succ :: PositionType -> PositionType # pred :: PositionType -> PositionType # toEnum :: Int -> PositionType # fromEnum :: PositionType -> Int # enumFrom :: PositionType -> [PositionType] # enumFromThen :: PositionType -> PositionType -> [PositionType] # enumFromTo :: PositionType -> PositionType -> [PositionType] # enumFromThenTo :: PositionType -> PositionType -> PositionType -> [PositionType] # | |
| Read PositionType Source # | |
Defined in QuantLib.Internal.Common Methods readsPrec :: Int -> ReadS PositionType # readList :: ReadS [PositionType] # | |
| Show PositionType Source # | |
Defined in QuantLib.Internal.Common Methods showsPrec :: Int -> PositionType -> ShowS # show :: PositionType -> String # showList :: [PositionType] -> ShowS # | |
| Eq PositionType Source # | |
Defined in QuantLib.Internal.Common | |
Payoffs
data StrikedPayoff Source #
use strikedPayoff to construct Payoff
Constructors
| AssetOrNothing | |
Fields
| |
| CashOrNothing | |
Fields
| |
| Gap | |
Fields
| |
| PercentageStrike !PercentageStrikePayoff | |
| PlainVanilla !PlainVanillaPayoff | |
| SuperFund | |
| SuperSharePayoff | |
Fields
| |
| CustomStriked | |
Fields
| |
data PlainVanillaPayoff Source #
use plainVanillaPayoff to construct Payoff
Constructors
| PlainVanillaPayoff | |
Fields
| |
data PercentageStrikePayoff Source #
use percentageStrikePayoff to construct Payoff
Constructors
| PercentageStrikePayoff | |
Fields
| |
data BasketPayoff Source #
Constructors
| Average | |
| AverageMultiple | |
| Max !Payoff | p |
| Min !Payoff | p |
| Spread !Payoff | p
|A Haskell-defined |
| CustomAccumulate | |
Payoff
DoubleStickyRatchet
ForwardType
RatchettMax
RatchetMin
StickyMax
StickyMin
Sticky
Custom
TypePayoff
Floating
Striked
AssetOrNothing
CashOrNothing
Gap
PercentageStrike
PlainVanilla
SuperFund
SuperSharePayoff
CustomStriked
BasketPayoff
Average
AverageMultiple
Max
Min
Spread
CustomAccumulateConstructors
| DoubleStickyRatchet | |
| ForwardType | |
Fields
| |
| RatchetMax | |
| RatchetMin | |
| Ratchet | |
| StickyMax | |
| StickyMin | |
| Sticky | |
| Type !TypePayoff | |
| Basket !BasketPayoff | |
| Custom | A Haskell-defined payoff. Build it with |
data TypePayoff Source #
Constructors
| Striked !StrikedPayoff | |
| Floating !OptionType | type |
Constructors
Hierarchy conversion
asOneAssetOption :: GenOneAssetOption oo -> IO OneAssetOption Source #
Payoffs and exercises
strikedPayoff :: StrikedPayoff -> Payoff Source #
Arguments
| :: String | name |
| -> String | description |
| -> (Double -> Double) | payoff(price) |
| -> (Payoff -> IO b) | |
| -> IO b |
Wrap a Haskell price -> value function as a real QuantLib Payoff, usable anywhere a
Payoff is (QuantLib.Instrument.Option.oneAssetOption, multiAssetOption,
QuantLib.Instrument.Swap.varianceOption, QuantLib.Method.fdmLogInnerValue,
fdmCellAveragingInnerValue, ...) -- the fully custom counterpart to the concrete
pre-implemented payoffs listed by the Payoff constructors above.
The payoff is valid only inside the continuation, and the continuation must span the whole
use, not just the construction: every consumer stores the payoff and calls back into it
later (an Instrument at NPV time, an FdmInnerValueCalculator at fdmSolve time), so
pricing must happen before this function returns. Same lifetime rule, and the same reason, as
QuantLib.Method.withCustomFdmInnerValueCalculator.
name and description are what QuantLib's own error messages and Payoff::name report; they
are not interpreted.
Not every engine accepts a non-standard payoff. QuantLib's analytic, binomial, finite-
difference and MCEuropeanEngine families all recover the strike by downcasting to
StrikedTypePayoff/PlainVanillaPayoff first, and a further ~30 engines route through
BlackCalculator, whose AcyclicVisitor knows only the four built-in striked payoffs. Most of
these fail with a clean QuantLib exception, but
QuantLib.PricingEngine.fdBlackScholesVanillaEngine and
QuantLib.PricingEngine.fdHestonVanillaEngine perform that downcast unchecked upstream and
will crash the process, not throw, on a custom payoff. Confirmed-generic consumers:
QuantLib.Method.fdmLogInnerValue/fdmCellAveragingInnerValue (and hence fdmSolve), and
QuantLib.PricingEngine.mcAmericanEngine with controlVariate = False.
withCustomStrikedPayoff Source #
Arguments
| :: OptionType | advisory option type |
| -> Double | advisory strike (grid centring only) |
| -> String | name |
| -> (Double -> Double) | payoff(price) |
| -> (StrikedPayoff -> IO b) | |
| -> IO b |
As withCustomPayoff, but produces a real QuantLib StrikedTypePayoff carrying an
(optionType, strike) pair alongside the Haskell function.
The pair is advisory: it does not define the payoff -- payoff(price) alone does, exactly
as for withCustomPayoff. It exists because QuantLib's finite-difference vanilla engines reach
past the Payoff interface for a strike when sizing their grid:
FdBlackScholesVanillaEngine dynamic_pointer_casts to StrikedTypePayoff without a check
and calls strike() twice -- once for the mesher's extent, once for its node-concentration
point -- then hands the payoff itself to FdmLogInnerValue, which takes a plain Payoff. So a
payoff built here prices correctly through
fdBlackScholesVanillaEngine and
fdHestonVanillaEngine, where one built by withCustomPayoff would
crash the process on that unchecked cast. Pass the strike you want the grid centred on.
Everything else matches withCustomPayoff, including the continuation-lifetime rule: the
payoff is valid only inside the continuation, which must span the whole use (pricing included),
not just construction. description is not a parameter here -- StrikedTypePayoff derives it
from the type and strike itself.
Engines routing through BlackCalculator (the analytic* family) still reject this, as they
must: its AcyclicVisitor knows only the four built-in striked payoffs, and there is no
closed-form price for an arbitrary function. That rejection is a clean QuantLib exception.
withCustomBasketPayoff Source #
Arguments
| :: Payoff | base payoff |
| -> ([Double] -> Double) | accumulate(underlyings) |
| -> (BasketPayoff -> IO b) | |
| -> IO b |
Wrap a Haskell underlyings -> accumulated function as a real QuantLib BasketPayoff around
base (which is applied to the accumulated value, exactly as for Max/Min/Spread) --
usable with QuantLib.Instrument.Option.basketOption and
QuantLib.Method.fdmLogBasketInnerValue. Same continuation-lifetime rule as withCustomPayoff;
unlike it, this callback crosses once per evaluation with the whole underlying-state vector,
because that is the shape BasketPayoff::accumulate already has upstream.
Barrier, chooser and multi-asset options
Arguments
| :: BarrierType | |
| -> Double | barrier |
| -> Double | rebate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO BarrierOption |
Barrier option on a single asset.
partialTimeBarrierOption Source #
Arguments
| :: BarrierType | |
| -> PartialBarrierRange | |
| -> Double | barrier |
| -> Double | rebate |
| -> Day | coverEventDate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
Barrier option on a single asset that is only monitored for part of its life (a partial-time barrier).
Arguments
| :: DoubleBarrierType | |
| -> Double | barrierLo |
| -> Double | barrierHi |
| -> Double | rebate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO DoubleBarrierOption |
Double-barrier option on a single asset, with a lower and an upper barrier.
Arguments
| :: BarrierType | |
| -> Double | barrierLo |
| -> Double | barrierHi |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO SoftBarrierOption |
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.
Arguments
| :: Double | moneyness |
| -> Day | resetDate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
Forward-starting (strike-resetting) version of a vanilla option.
Arguments
| :: StrikedPayoff | motherPayoff |
| -> Exercise | motherExercise |
| -> StrikedPayoff | daughterPayoff |
| -> Exercise | daughterExercise |
| -> IO OneAssetOption |
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.
Arguments
| :: Int | Q1 |
| -> Int | Q2 |
| -> Exercise | |
| -> IO MargrabeOption |
Margrabe option on two assets: the right to exchange Q2 units of the second asset for Q1 units of the first at expiration.
Arguments
| :: Day | choosingDate |
| -> Double | strike |
| -> Exercise | |
| -> IO OneAssetOption |
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.
Arguments
| :: Day | choosingDate |
| -> Double | strikeCall |
| -> Double | strikePut |
| -> Exercise | exerciseCall |
| -> Exercise | exercisePut |
| -> IO OneAssetOption |
Complex chooser option: on the choosing date the holder selects between a call and a put with independent strikes and exercise dates.
twoAssetCorrelationOption Source #
Arguments
| :: OptionType | type |
| -> Double | strike1 |
| -> Double | strike2 |
| -> Exercise | |
| -> IO MultiAssetOption |
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.
writerExtensibleOption Source #
Arguments
| :: PlainVanillaPayoff | payoff1 |
| -> Exercise | exercise1 |
| -> PlainVanillaPayoff | payoff2 |
| -> Exercise | exercise2 |
| -> IO OneAssetOption |
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.
holderExtensibleOption Source #
Arguments
| :: OptionType | type |
| -> Double | premium |
| -> Day | secondExpiryDate |
| -> Double | secondStrike |
| -> StrikedPayoff | payoff |
| -> Exercise | exercise |
| -> IO OneAssetOption |
Holder-extensible option: the holder may pay premium at the first exercise to replace its payoff with an option at secondExpiryDate and secondStrike.
Vanilla, quanto and path-dependent options
multiAssetOption :: Payoff -> Exercise -> IO MultiAssetOption Source #
Base construction for an option on multiple assets.
oneAssetOption :: Payoff -> Exercise -> IO OneAssetOption Source #
Base construction for an option on a single asset.
Arguments
| :: BarrierType | |
| -> Double | barrier |
| -> Double | rebate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO QuantoBarrierOption |
Quanto version of a barrier option on a single asset.
quantoDoubleBarrierOption Source #
Arguments
| :: DoubleBarrierType | |
| -> Double | barrierLo |
| -> Double | barrierHi |
| -> Double | rebate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO QuantoDoubleBarrierOption |
Quanto version of a double-barrier option on a single asset, with a lower and an upper barrier.
quantoForwardVanillaOption Source #
Arguments
| :: Double | moneyness |
| -> Day | resetDate |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO QuantoForwardVanillaOption |
Quanto version of a forward-starting (strike-resetting) vanilla option.
quantoVanillaOption :: StrikedPayoff -> Exercise -> IO QuantoVanillaOption Source #
Quanto version of a vanilla option on a single asset.
twoAssetBarrierOption Source #
Arguments
| :: BarrierType | |
| -> Double | barrier |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO Instrument |
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.
vanillaOption :: StrikedPayoff -> Exercise -> IO VanillaOption Source #
Vanilla option (no discrete dividends, no barriers) on a single asset.
basketOption :: BasketPayoff -> Exercise -> IO MultiAssetOption Source #
Basket option on a number of assets, combined by the given basket payoff (e.g. minmaxspread/average).
himalayaOption :: NonEmpty Day -> Double -> IO MultiAssetOption Source #
pagodaOption :: NonEmpty Day -> Double -> Double -> IO MultiAssetOption Source #
Arguments
| :: PercentageStrikePayoff | |
| -> EuropeanExercise | maturity |
| -> [Day] | resetDates |
| -> IO OneAssetOption |
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.
continuousAveragingAsianOption :: AverageType -> StrikedPayoff -> Exercise -> IO OneAssetOption Source #
Continuous-averaging Asian option on a single asset, for an unseasoned (fresh) option where averaging has not yet started.
continuousFixedLookbackOption Source #
Arguments
| :: Double | currentMinmax |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
Continuous-fixed lookback option: the payoff uses the fixed strike against the minimum/maximum price observed over the option's life.
continuousFloatingLookbackOption Source #
Arguments
| :: Double | currentMinmax |
| -> TypePayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
Continuous-floating lookback option: the strike is set to the minimum/maximum price observed over the option's life.
continuousPartialFixedLookbackOption Source #
Arguments
| :: Day | lookbackPeriodStart |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
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).
continuousPartialFloatingLookbackOption Source #
Arguments
| :: Double | currentMinmax |
| -> Double | lambda |
| -> Day | lookbackPeriodEnd |
| -> TypePayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
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).
Arguments
| :: Double | notional |
| -> Double | guarantee |
| -> Exercise | |
| -> IO EverestOption |
The excess return over guarantee, realized on the worst-performing of a basket of assets and paid out on notional at exercise.
discreteAveragingAsianOption Source #
Arguments
| :: AverageType | |
| -> Double | runningAccumulator, the running sum or products of past fixings |
| -> Word | pastFixings |
| -> [Day] | fixingDates |
| -> StrikedPayoff | |
| -> Exercise | |
| -> IO OneAssetOption |
Discrete-averaging Asian option on a single asset, taking the running sum/product of past fixings plus a list of future fixing dates.
Arguments
| :: BermudanExercise | |
| -> Double | |
| -> Double | load |
| -> Double | changeRate |
| -> IO OneAssetOption |
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.
Arguments
| :: StrikedPayoff | |
| -> SwingExercise | |
| -> Word | minExerciseRights |
| -> Word | maxExerciseRights |
| -> IO OneAssetOption |
Swing option: a payoff exercisable a bounded number of times (between minExerciseRights and maxExerciseRights) at the dates of a SwingExercise.
europeanOption :: StrikedPayoff -> Exercise -> IO VanillaOption Source #
European (single-exercise-date) vanilla option on a single asset.
Inspectors
Implied volatility
class HasImpliedVol a where Source #
Methods
Instances
| HasImpliedVol BarrierOption Source # | |
Defined in QuantLib.Instrument.Option Methods impliedVolatility :: BarrierOption -> Double -> GeneralizedBlackScholesProcess -> [Dividend] -> Double -> Word -> Double -> Double -> IO Double Source # | |
| HasImpliedVol VanillaOption Source # | |
Defined in QuantLib.Instrument.Option Methods impliedVolatility :: VanillaOption -> Double -> GeneralizedBlackScholesProcess -> [Dividend] -> Double -> Word -> Double -> Double -> IO Double Source # | |
doubleBarrierOptionImpliedVolatility Source #
Arguments
| :: DoubleBarrierOption | |
| -> Double | price |
| -> GenGeneralizedBlackScholesProcess gbs | |
| -> Double | accuracy |
| -> Word | maxEvaluations |
| -> Double | minVol |
| -> Double | maxVol |
| -> IO Double |
Implied Black-Scholes volatility that reproduces the given price for a DoubleBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
softBarrierOptionImpliedVolatility Source #
Arguments
| :: SoftBarrierOption | |
| -> Double | price |
| -> GenGeneralizedBlackScholesProcess gbs | |
| -> Double | accuracy |
| -> Word | maxEvaluations |
| -> Double | minVol |
| -> Double | maxVol |
| -> IO Double |
Implied Black-Scholes volatility that reproduces the given price for a SoftBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
Sensitivities and probabilities
class HasGreeks a where Source #
Methods
delta :: a -> IO Double Source #
gamma :: a -> IO Double Source #
rho :: a -> IO Double Source #
theta :: a -> IO Double Source #
vega :: a -> IO Double Source #
dividendRho :: a -> IO Double Source #
Instances
| HasGreeks MultiAssetOption Source # | |
Defined in QuantLib.Instrument.Option | |
| HasGreeks OneAssetOption Source # | |
Defined in QuantLib.Instrument.Option | |
class HasQuanto a where Source #
Instances
firstAssetDelta :: MargrabeOption -> IO Double Source #
Sensitivity of a MargrabeOption's value to the price of the first asset.
secondAssetDelta :: MargrabeOption -> IO Double Source #
Sensitivity of a MargrabeOption's value to the price of the second asset.
firstAssetGamma :: MargrabeOption -> IO Double Source #
Second derivative of a MargrabeOption's value with respect to the price of the first asset.
secondAssetGamma :: MargrabeOption -> IO Double Source #
Second derivative of a MargrabeOption's value with respect to the price of the second asset.
deltaForward :: GenOneAssetOption oo -> IO Double Source #
Sensitivity of the option's value to the forward price of the underlying.
elasticity :: GenOneAssetOption oo -> IO Double Source #
Percentage change in the option's value per percentage change in the underlying price.
itmCashProbability :: GenOneAssetOption oo -> IO Double Source #
Probability of the option expiring in-the-money in a cash-or-nothing sense.
strikeSensitivity :: GenOneAssetOption oo -> IO Double Source #
Sensitivity of the option's value to the strike price.
thetaPerDay :: GenOneAssetOption oo -> IO Double Source #
Theta divided by the number of days elapsed per day (as opposed to per year).