hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.TermStructure.Volatility

Synopsis

Types

Volatility hierarchies

type GenVolatilityTermStructure v = GenTermStructure (AnyOf CVolatilityTermStructure' v) Source #

A VolatilityTermStructure or one of its leaves; see the hierarchy under GenTermStructure.

type VolatilityTermStructure = GenVolatilityTermStructure CVolatilityTermStructure Source #

A TermStructure; see the hierarchy under GenTermStructure.

type GenBlackVolTermStructure bv = GenVolatilityTermStructure (AnyOf CBlackVolTermStructure' bv) Source #

A BlackVolTermStructure or one of its leaves; see the hierarchy under GenTermStructure.

type BlackVolTermStructure = GenBlackVolTermStructure CBlackVolTermStructure Source #

A VolatilityTermStructure; see the hierarchy under GenTermStructure.

type RelinkableBlackVolTermStructure = GenBlackVolTermStructure CRelinkableBlackVolTermStructure Source #

A Black vol surface held behind a relinkable handle. It is a BlackVolTermStructure -- pass it anywhere one is expected and it upcasts like any other hierarchy member, sharing its Link so that a later linkBlackVolTo reaches everything already built on it. Mirrors RelinkableYieldTermStructure. See the hierarchy under GenTermStructure.

type BlackVarianceCurve = GenBlackVolTermStructure CBlackVarianceCurve Source #

A BlackVolTermStructure; see the hierarchy under GenTermStructure.

type BlackVolatilitySurfaceDelta = GenBlackVolTermStructure CBlackVolatilitySurfaceDelta Source #

A BlackVolTermStructure; see the hierarchy under GenTermStructure.

type GenBlackAtmVolCurve b = GenVolatilityTermStructure (AnyOf CBlackAtmVolCurve' b) Source #

Black at-the-money (no-smile) volatility curve, abstract here (hasquant binds no qlBlackAtmVolCurve constructor -- BlackAtmVolCurve has no bindable constructor upstream either, only its concrete subclasses do). A sibling of OptionletVolatilityStructure/ CapFloorTermVolatilityStructure/SwaptionVolatilityStructure directly off VolatilityTermStructure. Reachable as a value via SabrVolSurface's atmCurve getter (any concrete member may be held there), and as the argument type of sabrVolSurface. See the hierarchy under GenTermStructure.

type BlackAtmVolCurve = GenBlackAtmVolCurve CBlackAtmVolCurve Source #

A VolatilityTermStructure; see the hierarchy under GenTermStructure.

type AbcdAtmVolCurve = GenBlackAtmVolCurve CAbcdAtmVolCurve Source #

ABCD-parametric fit to a set of (tenor, quote) at-the-money vols. A dedicated BlackAtmVolCurve leaf (real calc/getters of its own -- a/b/c/d/rmsError/etc -- per the API-design rule in CLAUDE.md), one AnyOf layer under GenBlackAtmVolCurve, same depth as CapFloorTermVolCurve under GenCapFloorTermVolatilityStructure. See the hierarchy under GenTermStructure.

type GenBlackVolSurface b = GenBlackAtmVolCurve (AnyOf CBlackVolSurface' b) Source #

Black volatility (smile) surface: adds a strike/smile dimension over BlackAtmVolCurve. Abstract here (no bindable constructor of its own -- only SabrVolSurface constructs one in this binding), but earns its own hierarchy level rather than folding into BlackAtmVolCurve (unlike InterestRateVolSurface, deliberately not given its own level -- see SabrVolSurface) because its own calculation, smileSection, is the defining feature of the "surface" vs "curve" distinction, not a thin pass-through inspector. See the hierarchy under GenTermStructure.

type BlackVolSurface = GenBlackVolSurface CBlackVolSurface Source #

A BlackAtmVolCurve; see the hierarchy under GenTermStructure.

type SabrVolSurface = GenBlackVolSurface CSabrVolSurface Source #

SABR-smile surface built from an interest-rate index, an ATM BlackAtmVolCurve, and per-tenor vol spreads. A dedicated BlackVolSurface leaf (own getters: atmCurve, sabrVolatilitySpreads; plus index/optionDateFromTenor folded in directly from upstream's InterestRateVolSurface, which is not given its own hierarchy level here since SabrVolSurface is its only concrete member in this binding -- per CLAUDE.md's "don't mirror the C++ hierarchy 1:1" rule). Two AnyOf layers under GenBlackVolSurface (mirrors VanillaSwap under FixedVsFloatingSwap under GenSwap). See the hierarchy under GenTermStructure.

type GenLocalVolTermStructure lv = GenVolatilityTermStructure (AnyOf CLocalVolTermStructure' lv) Source #

A LocalVolTermStructure or one of its leaves; see the hierarchy under GenTermStructure.

type LocalVolTermStructure = GenLocalVolTermStructure CLocalVolTermStructure Source #

A VolatilityTermStructure; see the hierarchy under GenTermStructure.

type GridModelLocalVolSurface = GenLocalVolTermStructure CGridModelLocalVolSurface Source #

A LocalVolTermStructure; see the hierarchy under GenTermStructure.

type AndreasenHugeVolatilityInterpl = Standalone CAndreasenHugeVolatilityInterpl Source #

type GenCapFloorTermVolatilityStructure c = GenVolatilityTermStructure (AnyOf CCapFloorTermVolatilityStructure' c) Source #

A CapFloorTermVolatilityStructure or one of its leaves; see the hierarchy under GenTermStructure.

type CapFloorTermVolatilityStructure = GenCapFloorTermVolatilityStructure CCapFloorTermVolatilityStructure Source #

The abstract root shared by ConstantCapFloorTermVolatility (erased straight to this type at construction, having no calc/getter of its own beyond capFloorVolatility, mirroring ConstantOptionletVolatility /'OptionletVolatilityStructure'), and the two dedicated leaves below. Promoted out of a flat VolatilityTermStructure leaf (the way YoYOptionletVolatilitySurface still is) specifically so capFloorVolatility -- declared on CapFloorTermVolatilityStructure upstream, not on VolatilityTermStructure -- can be bound generically without a dynamic_pointer_cast in the shim. See the hierarchy under GenTermStructure.

type CapFloorTermVolCurve = GenCapFloorTermVolatilityStructure CCapFloorTermVolCurve Source #

An ATM-only cap/floor term vol curve (no strike dimension, unlike CapFloorTermVolSurface). Gets its own dedicated leaf (rather than erasing to CapFloorTermVolatilityStructure the way ConstantCapFloorTermVolatility does) so a future binding of OptionletStripper2 -- which takes a concrete Handle<CapFloorTermVolCurve> upstream -- has a type to reach for without another breaking change here. See the hierarchy under GenTermStructure.

type GenOptionletVolatilityStructure ov = GenVolatilityTermStructure (AnyOf COptionletVolatilityStructure' ov) Source #

An OptionletVolatilityStructure or one of its leaves; see the hierarchy under GenTermStructure.

type RelinkableOptionletVolatilityStructure = GenOptionletVolatilityStructure CRelinkableOptionletVolatilityStructure Source #

An optionlet vol surface held behind a relinkable handle. It is an OptionletVolatilityStructure -- pass it anywhere one is expected and it upcasts like any other hierarchy member, sharing its Link so that a later linkOptionletVolTo reaches everything already built on it. Mirrors RelinkableSwaptionVolatilityStructure. See the hierarchy under GenTermStructure.

type GenSwaptionVolatilityStructure sv = GenVolatilityTermStructure (AnyOf CSwaptionVolatilityStructure' sv) Source #

type RelinkableSwaptionVolatilityStructure = GenSwaptionVolatilityStructure CRelinkableSwaptionVolatilityStructure Source #

A swaption vol surface held behind a relinkable handle. It is a SwaptionVolatilityStructure -- pass it anywhere one is expected and it upcasts like any other hierarchy member, sharing its Link so that a later linkSwaptionVolTo reaches everything already built on it. Mirrors RelinkableBlackVolTermStructure. See the hierarchy under GenTermStructure.

type SwaptionVolatilityMatrix = GenSwaptionVolatilityStructure CSwaptionVolatilityMatrix Source #

A discrete grid of swaption volatilities, interpolated between nodes. It is a SwaptionVolatilityStructure -- pass it anywhere one is expected. Gets a dedicated leaf for its own swaptionVolatilityMatrixLocate inspector (the lower grid-corner indexes surrounding a given option date/swap tenor), same reasoning as SabrSwaptionVolatilityCube/ InterpolatedSwaptionVolatilityCube above. See the hierarchy under GenTermStructure.

type SabrSwaptionVolatilityCube = GenSwaptionVolatilityStructure CSabrSwaptionVolatilityCube Source #

A SABR-calibrated swaption vol cube. It is a SwaptionVolatilityStructure -- pass it anywhere one is expected. Its own extra getters (sparse/dense SABR parameters, market/ATM- calibrated vol cubes, ATM strike) are bound directly against this concrete type rather than via a downcast: it has real calculations of its own beyond the generic interface, so per the API-design rule in CLAUDE.md it earns a dedicated leaf. See the hierarchy under GenTermStructure.

type NoArbSabrSwaptionVolatilityCube = GenSwaptionVolatilityStructure CNoArbSabrSwaptionVolatilityCube Source #

An arbitrage-free (Doust) SABR-calibrated swaption vol cube -- the same underlying XabrSwaptionVolatilityCube template as SabrSwaptionVolatilityCube, one model policy over (SwaptionVolCubeNoArbSabrModel instead of SwaptionVolCubeSabrModel), same dedicated-leaf reasoning and identical getter surface. See the hierarchy under GenTermStructure.

type ZabrSwaptionVolatilityCube = GenSwaptionVolatilityStructure CZabrSwaptionVolatilityCube Source #

A ZABR-calibrated swaption vol cube: the same XabrSwaptionVolatilityCube template as SabrSwaptionVolatilityCube with the default ZABR model policy and a fifth (gamma) parameter. See the hierarchy under GenTermStructure.

type InterpolatedSwaptionVolatilityCube = GenSwaptionVolatilityStructure CInterpolatedSwaptionVolatilityCube Source #

The non-SABR, linear-interpolation swaption vol cube. It is a SwaptionVolatilityStructure -- pass it anywhere one is expected. Gets the same dedicated-leaf treatment as SabrSwaptionVolatilityCube for its atmStrike getter (inherited, in upstream, from the same abstract SwaptionVolatilityCube base both concrete cubes share). See the hierarchy under GenTermStructure.

type CallableBondVolatilityStructure = GenTermStructure CCallableBondVolatilityStructure Source #

A TermStructure; see the hierarchy under GenTermStructure.

Configuration and extrapolation

data BlackVarianceSurfaceExtrapolation Source #

Instances

Instances details
Enum BlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read BlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show BlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq BlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data ExtendedBlackVarianceSurfaceExtrapolation Source #

Instances

Instances details
Enum ExtendedBlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read ExtendedBlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show ExtendedBlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq ExtendedBlackVarianceSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data FixedLocalVolSurfaceExtrapolation Source #

'FixedLocalVolSurface::Extrapolation', local to that class -- not shared with any other binding, same local-declaration treatment as SmileInterpolationMethod.

Instances

Instances details
Enum FixedLocalVolSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read FixedLocalVolSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show FixedLocalVolSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq FixedLocalVolSurfaceExtrapolation Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data AndreasenHugeInterpolationType Source #

Instances

Instances details
Enum AndreasenHugeInterpolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read AndreasenHugeInterpolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show AndreasenHugeInterpolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq AndreasenHugeInterpolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data AndreasenHugeCalibrationType Source #

Calibration choice for Andreasen-Huge local-volatility calibration.

Instances

Instances details
Enum AndreasenHugeCalibrationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read AndreasenHugeCalibrationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show AndreasenHugeCalibrationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq AndreasenHugeCalibrationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data ZabrEvaluation Source #

ZabrSmileSection's evaluation-tag axis (Andreasen/Huge 2011): ZabrShortMaturityLognormal/ ZabrShortMaturityNormal are closed-form short-maturity expansions (fast, less accurate away from short maturities); ZabrLocalVolatility and ZabrFullFd solve a finite-difference PDE (slower, more accurate). Local to this binding -- not shared with any other cross-cutting enum.

data SmileInterpolationMethod Source #

'BlackVolatilitySurfaceDelta::SmileInterpolationMethod', local to that class -- not shared with any other binding, so declared here rather than in Common.

Instances

Instances details
Enum SmileInterpolationMethod Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read SmileInterpolationMethod Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show SmileInterpolationMethod Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq SmileInterpolationMethod Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

data BlackVolTimeExtrapolationType Source #

'BlackVolTimeExtrapolation::Type', consumed only by blackVolatilitySurfaceDelta today -- same local-declaration treatment as SmileInterpolationMethod. Named BlackVolTimeExtrapolationType (rather than reusing the bare Type c2hs would otherwise emit) to avoid a top-level name clash.

Instances

Instances details
Enum BlackVolTimeExtrapolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Read BlackVolTimeExtrapolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Show BlackVolTimeExtrapolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Eq BlackVolTimeExtrapolationType Source # 
Instance details

Defined in QuantLib.TermStructure.Volatility

Coordinates

data Reference Source #

A term-structure reference point. ReferenceDate stays fixed for the object's lifetime; SettlementDays follows the global evaluation date using the supplied calendar.

Instances

Instances details
Show Reference Source # 
Instance details

Defined in QuantLib.TermStructure

Eq Reference Source # 
Instance details

Defined in QuantLib.TermStructure

data CalendarReference Source #

Reference-point variants for constructors that take a calendar independently in both upstream overloads.

data TermPoint Source #

A date or year-fraction coordinate measured from a term structure's reference date.

Constructors

DatePoint !Day 
TimePoint !Double 

Instances

Instances details
Show TermPoint Source # 
Instance details

Defined in QuantLib.TermStructure

Eq TermPoint Source # 
Instance details

Defined in QuantLib.TermStructure

data TermInterval Source #

A same-representation interval. Keeping both endpoints in one constructor prevents mixed date/time intervals that upstream does not accept.

Instances

Instances details
Show TermInterval Source # 
Instance details

Defined in QuantLib.TermStructure

Eq TermInterval Source # 
Instance details

Defined in QuantLib.TermStructure

data RatePoint Source #

A date or year-fraction coordinate where a date needs its day-counting rule.

Instances

Instances details
Show RatePoint Source # 
Instance details

Defined in QuantLib.TermStructure

Eq RatePoint Source # 
Instance details

Defined in QuantLib.TermStructure

data SwapMaturity Source #

The underlying-swap maturity coordinate of a swaption volatility query.

data AtmStrikeMaturity Source #

Option maturities accepted by swaption-cube atmStrike queries.

Constructors

Hierarchy conversions

asOptionletVolatilityStructure :: OptionletStripper2 -> IO OptionletVolatilityStructure Source #

Fresh construction (a StrippedOptionletAdapter wrapping the OptionletStripper2 itself), never a cast -- same idiom as sabrAsSmileSection.

sabrAsSmileSection :: SabrInterpolatedSmileSection -> IO SmileSection Source #

upcast to the generic SmileSection interface (e.g. for smileSectionVolatility/smileSectionVariance). A fresh-shared_ptr upcast, always safe -- not the reverse (downcast) direction.

sviAsSmileSection :: SviInterpolatedSmileSection -> IO SmileSection Source #

upcast to the generic SmileSection interface (e.g. for smileSectionVolatility/smileSectionVariance). A fresh-shared_ptr upcast, always safe -- not the reverse (downcast) direction.

noArbSabrAsSmileSection :: NoArbSabrInterpolatedSmileSection -> IO SmileSection Source #

upcast to the generic SmileSection interface (e.g. for smileSectionVolatility/smileSectionVariance). A fresh-shared_ptr upcast, always safe -- not the reverse (downcast) direction.

zabrInterpolatedAsSmileSection :: ZabrInterpolatedSmileSection -> IO SmileSection Source #

upcast to the generic SmileSection interface (e.g. for smileSectionVolatility/smileSectionVariance). A fresh-shared_ptr upcast, always safe -- not the reverse (downcast) direction.

Optionlet and cap-floor volatility

localVolSurface Source #

Arguments

:: GenBlackVolTermStructure bv 
-> GenYieldTermStructure y1

riskFreeTS

-> GenYieldTermStructure y2

dividendTS

-> GenQuote q

underlying

-> IO LocalVolTermStructure 

A local vol surface derived from a Black vol surface via Dupire's formula (Gatheral's implementation).

constantOptionletVolatility :: CalendarReference -> Calendar -> BusinessDayConvention -> GenQuote q -> DayCounter -> VolatilityType -> Double -> IO OptionletVolatilityStructure Source #

Constant caplet volatility with either a fixed or evaluation-date-relative reference point.

capletVarianceCurve :: Day -> NonEmpty (Day, Double) -> DayCounter -> VolatilityType -> Double -> IO OptionletVolatilityStructure Source #

Optionlet volatility curve interpolating the supplied caplet-volatility nodes by variance. Each node pairs an option date with its volatility, so mismatched date/value inputs are unrepresentable.

optionletStripper Source #

Arguments

:: CapFloorTermVolSurface 
-> GenIborIndex ibor 
-> Maybe Double

switchStrikes

-> Double

accuracy

-> Word

maxIter

-> Maybe (GenYieldTermStructure y)

discount

-> VolatilityType

type

-> Double

displacement

-> Bool

dontThrow

-> Maybe (Word, TimeUnit)

optionletFrequency

-> IO OptionletVolatilityStructure 

Strips a CapFloorTermVolSurface (quoted cap/floor term vols) into caplet/floorlet vols via OptionletStripper1, immediately wrapping the result behind StrippedOptionletAdapter in one step -- OptionletStripper1 itself is never exposed as a Haskell type, since none of its own getters (capFloorPrices/capletVols/etc.) are needed beyond feeding the adapter, per the "bind few inspectors" rule.

optionletStripperWithAtm Source #

Arguments

:: CapFloorTermVolSurface 
-> GenIborIndex ibor 
-> Maybe Double

switchStrikes

-> Double

accuracy

-> Word

maxIter

-> Maybe (GenYieldTermStructure y)

discount

-> VolatilityType

type

-> Double

displacement

-> Bool

dontThrow

-> Maybe (Word, TimeUnit)

optionletFrequency

-> CapFloorTermVolCurve

atmCapFloorTermVolCurve

-> IO OptionletStripper2 

Extends an OptionletStripper1 (built internally, never exposed as its own Haskell type -- same fusion as optionletStripper) by reconciling it against an ATM CapFloorTermVolCurve, producing forward-forward optionlet vols. Unlike optionletStripper, this keeps its own concrete OptionletStripper2 object around, since it has real diagnostic getters (atmCapFloorStrikes/atmCapFloorPrices/spreadsVol) not reachable through the generic OptionletVolatilityStructure interface. Use asOptionletVolatilityStructure to pass one into anything expecting the generic interface.

Black, local and swaption volatility

impliedVolTermStructure :: GenBlackVolTermStructure bv -> Day -> IO BlackVolTermStructure Source #

origTS re-anchored to a new reference date, tracking origTS for later changes. Only financially sensible for a time-dependent (not asset-dependent) source structure.

blackConstantVol :: CalendarReference -> Calendar -> GenQuote q -> DayCounter -> IO BlackVolTermStructure Source #

A constant Black volatility with either a fixed or evaluation-date-relative reference point.

sabrVolTermStructure :: Double -> Double -> Double -> Double -> Double -> Double -> Day -> DayCounter -> IO BlackVolTermStructure Source #

SABR-parameterized Black volatility term structure. gamma is upstream's vol-of-vol (nu in the usual SABR notation); s0/r are the initial forward and the continuously-compounded rate used to roll it forward -- see 'qlexperimentalvolatility/sabrvoltermstructure.hpp'.

relinkableBlackVolTermStructure :: Maybe (GenBlackVolTermStructure bv) -> IO RelinkableBlackVolTermStructure Source #

A Black vol surface behind a relinkable handle. The result is a BlackVolTermStructure: pass it anywhere one is expected and everything built on it keeps tracking whatever the handle currently points at, so a later linkBlackVolTo reprices already-constructed instruments without rebuilding them. Mirrors relinkableYieldTermStructure.

constantSwaptionVolatility :: CalendarReference -> Calendar -> BusinessDayConvention -> GenQuote q -> DayCounter -> VolatilityType -> Double -> IO SwaptionVolatilityStructure Source #

Constant swaption volatility with either a fixed or evaluation-date-relative reference point.

Smile sections and parametrizations

sabrSmileSection Source #

Arguments

:: Double

timeToExpiry

-> Double

forward

-> Double

alpha

-> Double

beta

-> Double

nu

-> Double

rho

-> Double

shift

-> VolatilityType

volatilityType

-> IO SmileSection 

A smile section built directly from SABR parameters (Hagan et al. 2002) at a year-fraction expiry, rather than interpolated from a SwaptionVolatilityStructure.

sabrSmileSectionAtDate :: Day -> DayCounter -> Maybe Day -> Double -> Double -> Double -> Double -> Double -> Double -> VolatilityType -> IO SmileSection Source #

As sabrSmileSection, at an option date. A Just reference date pins the section; Nothing makes it float, registering with the evaluation date and recomputing the exercise time whenever the evaluation date moves.

noArbSabrSmileSection :: RatePoint -> Double -> Double -> Double -> Double -> Double -> Double -> VolatilityType -> IO SmileSection Source #

An arbitrage-free SABR smile section (Doust's approach via NoArbSabrSmileSection), built directly from SABR parameters like sabrSmileSection but guaranteeing a proper terminal density.

sabrInterpolatedSmileSection Source #

Arguments

:: Day

optionDate

-> GenQuote q1

forward

-> NonEmpty (Double, GenQuote q3)

strike/volatility quotes

-> Bool

hasFloatingStrikes

-> GenQuote q2

atmVolatility

-> Double

alpha

-> Double

beta

-> Double

nu

-> Double

rho

-> SabrInterpolatedSmileSectionOpts 
-> IO SabrInterpolatedSmileSection 

a smile section calibrated to a market smile (strikes/vols given directly, not as live quotes -- calibration runs once, eagerly, at construction). alpha/beta/nu/rho/vegaWeighted are the SABR calibration's initial guess and fixed/free flags; sabrEndCriteria/ sabrOptimizationMethod default to Nothing, which falls back to QuantLib's own internal defaults -- a caller-supplied EndCriteria/OptimizationMethod is safe to pass here since both are shared_ptr-boxed on the C++ side (see the qlaux.h comment above the QlEndCriteria/QlOptimizationMethod typedefs), so the copy this object's constructor keeps survives regardless of when Haskell's own handle is collected.

sviInterpolatedSmileSection Source #

Arguments

:: Day

optionDate

-> GenQuote q1

forward

-> NonEmpty (Double, GenQuote q3)

strike/volatility quotes

-> Bool

hasFloatingStrikes

-> GenQuote q2

atmVolatility

-> Double

a

-> Double

b

-> Double

sigma

-> Double

rho

-> Double

m

-> Bool

aIsFixed

-> Bool

bIsFixed

-> Bool

sigmaIsFixed

-> Bool

rhoIsFixed

-> Bool

mIsFixed

-> Bool

vegaWeighted

-> Maybe EndCriteria 
-> Maybe OptimizationMethod 
-> DayCounter 
-> IO SviInterpolatedSmileSection 

a smile section calibrated to a market smile using Stochastic Volatility Inspired (SVI, Gatheral 2004) parameterization: total variance at log-moneyness k = log(strike/forward) is a + b*(rho*(k-m) + sqrt((k-m)^2 + sigma^2)). Strikes/vols are given directly (not as live quotes) -- calibration runs once, eagerly, at construction, same as sabrInterpolatedSmileSection. a/b/sigma/rho/m are the SVI calibration's initial guess; aIsFixed/bIsFixed/sigmaIsFixed/rhoIsFixed/mIsFixed have no upstream default (unlike SABR's fixed flags, which default to False) and so are always required here. Calibration enforces, at construction: b >= 0, |rho| < 1, sigma > 0, a + b*sigma*sqrt(1-rho^2) >= 0, and b*(1+|rho|) <= 4.

noArbSabrInterpolatedSmileSection Source #

Arguments

:: Day

optionDate

-> GenQuote q1

forward

-> NonEmpty (Double, GenQuote q3)

strike/volatility quotes

-> Bool

hasFloatingStrikes

-> GenQuote q2

atmVolatility

-> Double

alpha

-> Double

beta

-> Double

nu

-> Double

rho

-> Bool

isAlphaFixed

-> Bool

isBetaFixed

-> Bool

isNuFixed

-> Bool

isRhoFixed

-> Bool

vegaWeighted

-> Maybe EndCriteria 
-> Maybe OptimizationMethod 
-> DayCounter 
-> IO NoArbSabrInterpolatedSmileSection 

a smile section calibrated to a market smile using the arbitrage-free SABR parameterization (Doust's approach, via NoArbSabrModel -- see noArbSabrSmileSection). Unlike noArbSabrSmileSection, which takes fixed calibrated parameters directly, this runs the alpha/beta/nu/rho calibration itself against the given strike/volatility quotes -- eagerly, at construction, same as sabrInterpolatedSmileSection. alpha/beta/nu/rho are the calibration's initial guess; isAlphaFixed/isBetaFixed/isNuFixed/isRhoFixed default to False upstream (unlike SVI's fixed flags, which have no default), and there is no shift parameter (unlike sabrInterpolatedSmileSection).

zabrInterpolatedSmileSection Source #

Arguments

:: ZabrEvaluation 
-> Day

optionDate

-> GenQuote q1

forward

-> NonEmpty (Double, GenQuote q3)

strike/volatility quotes

-> Bool

hasFloatingStrikes

-> GenQuote q2

atmVolatility

-> Double

alpha

-> Double

beta

-> Double

nu

-> Double

rho

-> Double

gamma

-> Bool

isAlphaFixed

-> Bool

isBetaFixed

-> Bool

isNuFixed

-> Bool

isRhoFixed

-> Bool

isGammaFixed

-> Bool

vegaWeighted

-> Maybe EndCriteria 
-> Maybe OptimizationMethod 
-> DayCounter 
-> IO ZabrInterpolatedSmileSection 

a smile section calibrated to a market smile using the ZABR parameterization (SABR extended with a gamma shape parameter -- see zabrSmileSection). Unlike zabrSmileSection, which takes fixed calibrated parameters directly, this runs the alpha/beta/nu/rho/gamma calibration itself against the given strike/volatility quotes -- eagerly, at construction, same as sabrInterpolatedSmileSection/noArbSabrInterpolatedSmileSection. alpha/beta/nu/rho/gamma are the calibration's initial guess; isAlphaFixed/isBetaFixed/isNuFixed/isRhoFixed/isGammaFixed default to False upstream. ZabrEvaluation picks the same short-maturity/local-volatility/full-PDE evaluation method as zabrSmileSection.

flatSmileSection Source #

Arguments

:: Day 
-> Double

vol

-> DayCounter 
-> Maybe Day

referenceDate

-> Maybe Double

atmLevel

-> VolatilityType

type

-> Double

shift

-> IO SmileSection 

a flat-volatility smile section: volatility returns vol for every strike. Nothing/Nothing reproduce upstream's own defaults for referenceDate/atmLevel.

spreadedSmileSection :: SmileSection -> GenQuote q -> IO SmileSection Source #

a SmileSection whose volatility at every strike is source's plus spread (which may change over time, since it's a live GenQuote rather than a fixed number)

atmSmileSection Source #

Arguments

:: SmileSection 
-> Maybe Double

atm

-> IO SmileSection 

source re-anchored to a different ATM level (Nothing reproduces upstream's own default, which recomputes the ATM level from source itself). source's volatility at every other strike is unchanged -- use smileSectionAtmLevel to observe what this changed.

sviSmileSection Source #

Arguments

:: Day 
-> Double

forward

-> Double

a

-> Double

b

-> Double

sigma

-> Double

rho

-> Double

m

-> DayCounter 
-> IO SmileSection 

a Stochastic Volatility Inspired (SVI) smile section: total variance at log-moneyness k = log(strike/forward) is a + b*(rho*(k-m) + sqrt((k-m)^2 + sigma^2)). Direct evaluation, no calibration.

zabrSmileSection :: ZabrEvaluation -> RatePoint -> Double -> Double -> Double -> Double -> Double -> Double -> [Double] -> Word -> IO SmileSection Source #

A ZABR (Andreasen/Huge 2011) smile section: direct evaluation (no calibration) of a SABR-like model widened by a fifth parameter, gamma, that controls the backbone shape away from gamma = 1 (which reduces exactly to Hagan's SABR). evaluation selects how the price/vol at a strike is computed -- see ZabrEvaluation. moneyness is the strike grid (as multiples of the forward) used only by ZabrLocalVolatility/ZabrFullFd to build their finite-difference solve; an empty list reproduces upstream's own 21-point default grid, and it is ignored by the two closed-form evaluation modes. fdRefinement subdivides each grid interval for the FD solve's accuracy/speed tradeoff (upstream's own default is 5).

Bond and cap-floor structures

callableBondConstantVolatility :: Reference -> GenQuote q -> DayCounter -> IO CallableBondVolatilityStructure Source #

A constant callable-bond volatility with either a fixed or evaluation-date-relative reference point.

constantCapFloorTermVolatility :: CalendarReference -> Calendar -> BusinessDayConvention -> GenQuote q -> DayCounter -> IO CapFloorTermVolatilityStructure Source #

Constant cap/floor term volatility with either a fixed or evaluation-date-relative reference point.

ATM curves and SABR surfaces

abcdAtmVolCurve Source #

Arguments

:: Word 
-> Calendar 
-> NonEmpty ((Word, TimeUnit), GenQuote q, Bool)

tenor, volatility, inclusion flag

-> BusinessDayConvention 
-> DayCounter 
-> IO AbcdAtmVolCurve 

Abcd-interpolated at-the-money (no-smile) volatility curve -- floating reference date, floating market data. inclusionInInterpolationFlag selects which quotes feed the ABCD fit (upstream defaults this to all-True when omitted; hasquant always requires it explicitly, per the widen-in-place convention for a handful of trailing defaulted params).

sabrVolSurface Source #

Arguments

:: GenInterestRateIndex ix 
-> GenBlackAtmVolCurve b 
-> NonEmpty (Word, TimeUnit)

optionTenors

-> NonEmpty Double

atmRateSpreads

-> Matrix (GenQuote q)

volSpreads

-> IO SabrVolSurface 

SABR-smile BlackVolSurface built from an interest-rate index, an ATM BlackAtmVolCurve, and per-tenor ATM-rate spreads/vol-spread matrix. volSpreads's rows follow optionTenors and columns follow atmRateSpreads (same row/column convention as sabrSwaptionVolatilityCubes volSpreads).

Relinkable and spreaded structures

spreadedSwaptionVolatility :: GenSwaptionVolatilityStructure sv -> GenQuote q -> IO SwaptionVolatilityStructure Source #

A SwaptionVolatilityStructure whose volatility at every point is source's plus spread (which may change over time, since it's a live GenQuote rather than a fixed number)

gaussian1dSwaptionVolatility Source #

Swaption volatilities implied from a Gaussian one-factor model: each smile section prices swaptions with upstream's default Gaussian1dSwaptionEngine and inverts Black's formula. The reference date is the model curve's; every query reprices, and the max date is unbounded. On QuantLib <= 1.43 the shim prices with a unit nominal to work around upstream's uninitialized one; newer versions use Gaussian1dSwaptionVolatility directly.

relinkableSwaptionVolatilityStructure :: Maybe (GenSwaptionVolatilityStructure sv) -> IO RelinkableSwaptionVolatilityStructure Source #

A swaption vol surface behind a relinkable handle. The result is a SwaptionVolatilityStructure: pass it anywhere one is expected and everything built on it keeps tracking whatever the handle currently points at, so a later linkSwaptionVolTo reprices already-constructed instruments without rebuilding them. Mirrors relinkableYieldTermStructure.

relinkableOptionletVolatilityStructure :: Maybe (GenOptionletVolatilityStructure ov) -> IO RelinkableOptionletVolatilityStructure Source #

An optionlet vol surface behind a relinkable handle. The result is an OptionletVolatilityStructure: pass it anywhere one is expected and everything built on it keeps tracking whatever the handle currently points at, so a later linkOptionletVolTo reprices already-constructed instruments without rebuilding them. Mirrors relinkableSwaptionVolatilityStructure.

Curves and surfaces

localConstantVol :: Reference -> GenQuote q -> DayCounter -> IO LocalVolTermStructure Source #

A constant local volatility with either a fixed or evaluation-date-relative reference point.

localVolCurve :: BlackVarianceCurve -> IO LocalVolTermStructure Source #

a local vol term structure derived from a BlackVarianceCurve (no strike dependence): local vol at time t is the derivative of the Black variance curve's total variance

capFloorTermVolCurve :: CalendarReference -> Calendar -> BusinessDayConvention -> NonEmpty (Word, TimeUnit, GenQuote q) -> DayCounter -> IO CapFloorTermVolCurve Source #

A cap/floor term-volatility curve with either a fixed or evaluation-date-relative reference.

blackVarianceCurve Source #

Arguments

:: Day 
-> NonEmpty (Day, Double) 
-> DayCounter 
-> Bool

forceMonotoneVariance

-> Maybe Interpolation 
-> IO BlackVarianceCurve 

A Black volatility curve built from time-dependent (ATM) market vols, interpolating on total variance (linear by default, or the given Interpolation) -- no strike dependence; see blackVarianceSurface for that.

extendedBlackVarianceCurve Source #

Arguments

:: Day 
-> NonEmpty (Day, GenQuote q) 
-> DayCounter 
-> Bool

forceMonotoneVariance

-> IO BlackVolTermStructure 

Like blackVarianceCurve, but volatilities are live quotes -- the curve updates when any of them changes (e.g. via setValue). Interpolation is fixed to Linear upstream.

extendedBlackVarianceSurface Source #

Arguments

:: Day 
-> Calendar 
-> [Day]

dates

-> [Double]

strikes

-> Matrix (GenQuote q)

volatilities

-> DayCounter 
-> ExtendedBlackVarianceSurfaceExtrapolation

lowerExtrapolation

-> ExtendedBlackVarianceSurfaceExtrapolation

upperExtrapolation

-> IO BlackVolTermStructure 

Like blackVarianceSurface, but volatilities are live quotes (rows strikes, columns dates). On QuantLib <= 1.43 this throws CPlusPlusException instead of invoking upstream code that accesses the grid out of bounds: https://github.com/lballabio/QuantLib/issues/2791.

capFloorTermVolSurface Source #

Arguments

:: CalendarReference 
-> Calendar 
-> BusinessDayConvention 
-> [(Word, TimeUnit)]

optionTenors

-> [Double]

strikes

-> Matrix (GenQuote q)

volatilities

-> DayCounter 
-> IO CapFloorTermVolSurface 

A cap/floor term-volatility surface with either a fixed or evaluation-date-relative reference.

blackVarianceSurface Source #

Arguments

:: Day 
-> Calendar 
-> [Day]

dates

-> [Double]

strikes

-> RealMatrix

blackVolMatrix

-> DayCounter 
-> BlackVarianceSurfaceExtrapolation

lowerExtrapolation

-> BlackVarianceSurfaceExtrapolation

upperExtrapolation

-> Interpolation2D

interpolator

-> IO BlackVolTermStructure 

The interpolator is applied through BlackVarianceSurface::setInterpolation right after construction; Bilinear reproduces upstream's default. Both interpolators reproduce blackVolMatrix exactly at its own (date, strike) nodes -- they only differ between them.

piecewiseBlackVarianceSurface Source #

Arguments

:: Day 
-> [Day]

dates

-> [Double]

strikes

-> RealMatrix

blackVols

-> DayCounter 
-> IO BlackVolTermStructure 

Builds a Black volatility surface from a rectangular vol grid via 'PiecewiseBlackVarianceSurface::makeFromGrid': one interpolated smile section per date column, linear in total variance between columns -- a fixed interpolation scheme, unlike blackVarianceSurface's configurable 2-D interpolator.

blackVolatilitySurfaceDelta Source #

Arguments

:: Day 
-> [Day]

dates

-> [Double]

putDeltas

-> [Double]

callDeltas

-> Bool

hasAtm

-> RealMatrix

blackVolMatrix

-> DayCounter 
-> Calendar 
-> GenQuote q

spot

-> GenYieldTermStructure y1

domesticTS

-> GenYieldTermStructure y2

foreignTS

-> IO BlackVolatilitySurfaceDelta 

A Black volatility surface parameterized by market deltas (put/call deltas and, optionally, an ATM quote) rather than fixed strikes -- the standard FX vol quoting convention. Constructed with upstream's own defaults for the trailing options; use blackVolatilitySurfaceDeltaWithOptions to override them.

Swaption matrices and cubes

swaptionVolatilityMatrix Source #

Arguments

:: Day 
-> Calendar 
-> BusinessDayConvention 
-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> Matrix (GenQuote q)

volatilities

-> DayCounter 
-> Bool

flatExtrapolation

-> VolatilityType 
-> RealMatrix

shifts

-> IO SwaptionVolatilityMatrix 

fixed reference date, floating market data. Pass an empty RealMatrix (realMatrixFromVector 0 0 Data.Vector.Storable.empty) for shifts when no shift is needed -- upstream treats a zero-row shift matrix as all-zero.

sabrSwaptionVolatilityCube Source #

Arguments

:: GenSwaptionVolatilityStructure sv

atmVolStructure

-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> [Double]

strikeSpreads

-> Matrix (GenQuote q1)

volSpreads

-> GenSwapIndex sidx1

swapIndexBase

-> GenSwapIndex sidx2

shortSwapIndexBase

-> Bool

vegaWeightedSmileFit

-> Matrix (GenQuote q2)

parametersGuess (alpha, beta, nu, rho per node)

-> Bool

isAlphaFixed

-> Bool

isBetaFixed

-> Bool

isNuFixed

-> Bool

isRhoFixed

-> Bool

isAtmCalibrated: if True, atmVolStructure must be a discrete grid structure (e.g. swaptionVolatilityMatrix or another cube) -- upstream's ATM-recalibration path (denseSabrParameters/one branch of volCubeAtmCalibrated) downcasts it to SwaptionVolatilityDiscrete and dereferences the result unchecked, which crashes given a flat constantSwaptionVolatility.

-> Maybe Double

maxErrorTolerance

-> Maybe Double

errorAccept

-> Bool

useMaxError

-> Word

maxGuesses

-> Bool

backwardFlat

-> Double

cutoffStrike

-> Maybe EndCriteria

endCriteria

-> Maybe OptimizationMethod

optMethod

-> IO SabrSwaptionVolatilityCube 

A SABR-calibrated swaption volatility cube: fits a SABR smile at every (option tenor, swap tenor) node from an ATM surface plus a grid of vol spreads. The result is a SwaptionVolatilityStructure -- pass it anywhere one is expected (pricing engines, smileSection/volatility/etc.) -- but its own extra getters (sparseSabrParameters, denseSabrParameters, marketVolCube, volCubeAtmCalibrated, (atmStrike) only accept this concrete type, not the generic one.

endCriteria/optMethod default to Nothing, which falls back to upstream's own internal Levenberg-Marquardt/EndCriteria defaults at every calibrated node. A caller-supplied EndCriteria/OptimizationMethod is safe here since both are shared_ptr-boxed on the C++ side (see the qlaux.h comment above the QlEndCriteria/QlOptimizationMethod typedefs) -- the copy SabrSwaptionVolatilityCube keeps as its own shared_ptr member survives regardless of when Haskell's own handle is collected, same as sabrInterpolatedSmileSection and fittedBondDiscountCurve fitting methods.

volSpreads and parametersGuess are both flattened over the (optionTenor x swapTenor) product as the *outer* index (row = j*nSwapTenors+k, j over optionTenors, k over swapTenors) -- not one row per optionTenor the way swaptionVolatilityMatrix grid is: matrixRows == length optionTenors * length swapTenors for both. volSpreads's columns are one per strikeSpreads entry; parametersGuess's columns are always exactly 4, in order alpha/beta/nu/rho.

Calibration is lazy: unlike sabrInterpolatedSmileSection, construction here does not force an eager fit, so this call can succeed even for inputs that will later fail to calibrate -- the error only surfaces on the first smileSection/volatility/diagnostic call.

noArbSabrSwaptionVolatilityCube Source #

Arguments

:: GenSwaptionVolatilityStructure sv

atmVolStructure

-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> [Double]

strikeSpreads

-> Matrix (GenQuote q1)

volSpreads

-> GenSwapIndex sidx1

swapIndexBase

-> GenSwapIndex sidx2

shortSwapIndexBase

-> Bool

vegaWeightedSmileFit

-> Matrix (GenQuote q2)

parametersGuess (alpha, beta, nu, rho per node)

-> Bool

isAlphaFixed

-> Bool

isBetaFixed

-> Bool

isNuFixed

-> Bool

isRhoFixed

-> Bool

isAtmCalibrated, see sabrSwaptionVolatilityCube

-> Maybe Double

maxErrorTolerance

-> Maybe Double

errorAccept

-> Bool

useMaxError

-> Word

maxGuesses

-> Bool

backwardFlat

-> Double

cutoffStrike

-> Maybe EndCriteria

endCriteria

-> Maybe OptimizationMethod

optMethod

-> IO NoArbSabrSwaptionVolatilityCube 

An arbitrage-free SABR (Doust) swaption volatility cube: the same XabrSwaptionVolatilityCube construction as sabrSwaptionVolatilityCube, one model policy over -- fits an arbitrage-free SABR smile (via NoArbSabrModel) at every node instead of the Hagan-formula SABR smile. Same argument shapes, flattening conventions, lazy calibration, and EndCriteria/OptimizationMethod safety as sabrSwaptionVolatilityCube; its own extra getters (noArbSabrSparseSabrParameters, noArbSabrDenseSabrParameters, noArbSabrMarketVolCube, noArbSabrVolCubeAtmCalibrated, atmStrike) only accept this concrete type.

zabrSwaptionVolatilityCube Source #

Arguments

:: GenSwaptionVolatilityStructure sv

atmVolStructure

-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> [Double]

strikeSpreads

-> Matrix (GenQuote q1)

volSpreads

-> GenSwapIndex sidx1

swapIndexBase

-> GenSwapIndex sidx2

shortSwapIndexBase

-> Bool

vegaWeightedSmileFit

-> Matrix (GenQuote q2)

parametersGuess (alpha, beta, nu, rho, gamma per node)

-> Bool

isAlphaFixed

-> Bool

isBetaFixed

-> Bool

isNuFixed

-> Bool

isRhoFixed

-> Bool

isGammaFixed

-> Bool

isAtmCalibrated, see sabrSwaptionVolatilityCube

-> Maybe Double

maxErrorTolerance

-> Maybe Double

errorAccept

-> Bool

useMaxError

-> Word

maxGuesses

-> Bool

backwardFlat

-> Double

cutoffStrike

-> Maybe EndCriteria

endCriteria

-> Maybe OptimizationMethod

optMethod

-> IO ZabrSwaptionVolatilityCube 

A ZABR swaption volatility cube: sabrSwaptionVolatilityCube with a fifth model parameter, gamma (1 approximates SABR), using the short-maturity lognormal kernel. Same shapes and lazy calibration; shifted or normal ATM volatilities are rejected when a node is calibrated.

interpolatedSwaptionVolatilityCube Source #

Arguments

:: GenSwaptionVolatilityStructure sv

atmVolStructure

-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> [Double]

strikeSpreads

-> Matrix (GenQuote q)

volSpreads

-> GenSwapIndex sidx1

swapIndexBase

-> GenSwapIndex sidx2

shortSwapIndexBase

-> Bool

vegaWeightedSmileFit

-> IO InterpolatedSwaptionVolatilityCube 

The non-SABR, linear-interpolation swaption volatility cube: interpolates the given volSpreads rather than calibrating a smile model. No EndCriteria/OptimizationMethod hazard here -- this class never calibrates anything. See sabrSwaptionVolatilityCube for the volSpreads flattening convention (identical here, minus parametersGuess).

swaptionVolatilityMatrixMoving Source #

Arguments

:: Calendar 
-> BusinessDayConvention 
-> [(Word, TimeUnit)]

optionTenors

-> [(Word, TimeUnit)]

swapTenors

-> Matrix (GenQuote q)

volatilities

-> DayCounter 
-> Bool

flatExtrapolation

-> VolatilityType 
-> RealMatrix

shifts

-> IO SwaptionVolatilityMatrix 

floating reference date, floating market data. See swaptionVolatilityMatrix for the shifts convention (realMatrixFromVector 0 0 Data.Vector.Storable.empty for "no shift").

Local-volatility and Andreasen-Huge models

noExceptLocalVolSurface Source #

Arguments

:: GenBlackVolTermStructure bv 
-> GenYieldTermStructure y1

riskFreeTS

-> GenYieldTermStructure y2

dividendTS

-> GenQuote q

underlying

-> Double

illegalLocalVolOverwrite

-> IO LocalVolTermStructure 

as localVolSurface, but a local vol calculation that would otherwise throw returns illegalLocalVolOverwrite instead

fixedLocalVolSurface Source #

Arguments

:: Day 
-> [Day]

dates

-> [Double]

strikes

-> RealMatrix

localVolMatrix

-> DayCounter 
-> FixedLocalVolSurfaceExtrapolation

lowerExtrapolation

-> FixedLocalVolSurfaceExtrapolation

upperExtrapolation

-> IO LocalVolTermStructure 

a local vol surface fed directly from a matrix of local vols (rather than derived from a Black vol surface, as localVolSurface is) -- one flat strike grid shared across all dates, same shape as blackVarianceSurface.

gridModelLocalVolSurface :: Day -> NonEmpty (Day, NonEmpty Double) -> DayCounter -> FixedLocalVolSurfaceExtrapolation -> FixedLocalVolSurfaceExtrapolation -> IO GridModelLocalVolSurface Source #

A local-volatility surface whose node values are model parameters. Each date is paired with its non-empty strike row, so this genuinely ragged grid does not masquerade as a rectangular Matrix. Use gridModelLocalVolSurfaceAsCalibratedModel to access QuantLib's generic calibrated-model operations.

gridModelLocalVolSurfaceAsCalibratedModel Source #

View a grid local-vol surface through its secondary CalibratedModel interface. This is a safe C++ multiple-inheritance upcast, materialized as an independently owned shared pointer.

hestonBlackVolSurface Source #

Arguments

:: GenHestonModel hm

model

-> ComplexLogFormula

complexLogFormula

-> Word

integrationOrder

-> IO BlackVolTermStructure 

A Black implied-volatility surface computed from a Heston model. The integration argument is the order of QuantLib's Gauss-Laguerre quadrature; the supplied complex-log formula controls the characteristic-function representation.

andreasenHugeVolatilityAdapter Source #

Adapts an Andreasen-Huge interpolation to QuantLib's Black-volatility term-structure interface.

andreasenHugeLocalVolAdapter Source #

Adapts an Andreasen-Huge interpolation to QuantLib's local-volatility term-structure interface.

Mutators

linkBlackVolTo :: RelinkableBlackVolTermStructure -> GenBlackVolTermStructure bv -> IO () Source #

Point a relinkable Black vol handle at a different surface. Everything already built on the handle reprices against the new surface, with no engine rebuilt. Mirrors linkTo -- see its haddock for why this mutator is justified.

linkSwaptionVolTo :: RelinkableSwaptionVolatilityStructure -> GenSwaptionVolatilityStructure sv -> IO () Source #

Point a relinkable swaption vol handle at a different surface. Everything already built on the handle reprices against the new surface, with no engine rebuilt. Named distinctly from linkTo and linkBlackVolTo because BlackVolTermStructure/SwaptionVolatilityStructure/OptionletVolatilityStructure all live in this one module and a bare linkTo per type would collide with its own siblings, not just with chs/chs.

linkOptionletVolTo :: RelinkableOptionletVolatilityStructure -> GenOptionletVolatilityStructure ov -> IO () Source #

Point a relinkable optionlet vol handle at a different surface. Everything already built on the handle reprices against the new surface, with no engine rebuilt. Named distinctly from linkTo/linkBlackVolTo/linkSwaptionVolTo for the same reason as those: all four relinkable vol types live in this one module.

Inspectors

Strike and maturity capabilities

class HasStrikeBounds structure where Source #

The minimum and maximum strike for which a structure can return vols. CallableBondVolatilityStructure and SmileSection each declare their own unrelated pair (neither inherits VolatilityTermStructure), so all three families need separate instances.

Methods

minStrike :: structure -> IO Double Source #

maxStrike :: structure -> IO Double Source #

optionDateFromTenor Source #

Arguments

:: GenVolatilityTermStructure v 
-> (Word, TimeUnit)

optionTenor

-> IO Day 

Converts an option tenor to its option date, for any GenVolatilityTermStructure (however it was constructed).

Optionlet and cap-floor volatility

capFloorVolatility :: GenCapFloorTermVolatilityStructure c -> OptionMaturity -> Double -> Bool -> IO Double Source #

Returns cap/floor volatility for any supported option-maturity representation.

capFloorTermVolCurveOptionDates :: CapFloorTermVolCurve -> IO [Day] Source #

The option-tenor grid's dates, calendar-advanced from the curve's reference date.

capFloorTermVolCurveOptionTimes :: CapFloorTermVolCurve -> IO [Double] Source #

As capFloorTermVolCurveOptionDates, in year fractions from the curve's reference date.

capFloorTermVolSurfaceOptionDates :: CapFloorTermVolSurface -> IO [Day] Source #

The option-tenor grid's dates, calendar-advanced from the surface's reference date.

capFloorTermVolSurfaceOptionTimes :: CapFloorTermVolSurface -> IO [Double] Source #

As capFloorTermVolSurfaceOptionDates, in year fractions from the surface's reference date.

Black and local volatility

blackVol :: GenBlackVolTermStructure bv -> TermPoint -> Double -> Bool -> IO Double Source #

Black volatility for the given maturity and strike.

blackVolVariance :: GenBlackVolTermStructure bv -> TermPoint -> Double -> Bool -> IO Double Source #

Black variance for the given maturity and strike. Named blackVolVariance to distinguish it from the two-maturity swaption and callable-bond queries.

blackForwardVol :: GenBlackVolTermStructure bv -> TermInterval -> Double -> Bool -> IO Double Source #

Forward (at-the-money) Black volatility between two dates or year fractions, for the given strike.

blackForwardVariance :: GenBlackVolTermStructure bv -> TermInterval -> Double -> Bool -> IO Double Source #

Forward (at-the-money) Black variance between two dates or year fractions, for the given strike.

localVol Source #

Arguments

:: GenLocalVolTermStructure lv 
-> Day 
-> Double

underlyingLevel

-> Bool

extrapolate

-> IO Double 

the local vol at a given date and underlying level, for any LocalVolTermStructure (however it was constructed) -- the only way to observe what a local vol surface actually computes.

blackVolSmile :: BlackVolatilitySurfaceDelta -> TermPoint -> IO SmileSection Source #

The Black-volatility smile at a date or time to expiry. The returned SmileSection does not track later changes to the surface's spot or curve handles; recreate it if those change.

blackVolSurfaceSmileSection :: GenBlackVolSurface b -> OptionMaturity -> Bool -> IO SmileSection Source #

Returns a Black-volatility smile section for any supported option-maturity representation.

Swaption and callable-bond volatility

swaptionVolatility :: GenSwaptionVolatilityStructure sv -> OptionMaturity -> SwapMaturity -> Double -> Bool -> IO Double Source #

Returns the volatility for any option-maturity and swap-maturity representation.

swaptionBlackVariance :: GenSwaptionVolatilityStructure sv -> OptionMaturity -> SwapMaturity -> Double -> Bool -> IO Double Source #

Returns the Black variance for any option-maturity and swap-maturity representation.

maxSwapLength :: GenSwaptionVolatilityStructure sv -> IO Double Source #

the largest swapLength for which the term structure can return vols

maxSwapTenor :: GenSwaptionVolatilityStructure sv -> IO (Int, TimeUnit) Source #

the largest length for which the term structure can return vols

smileSection :: GenSwaptionVolatilityStructure sv -> OptionMaturity -> SwapMaturity -> Bool -> IO SmileSection Source #

Returns the smile section for any option-maturity and swap-maturity representation.

swapLengthBetweenDates Source #

Arguments

:: GenSwaptionVolatilityStructure sv 
-> Day

start

-> Day

end

-> IO Double 

implements the conversion between swap dates and swap (time) length

swapLength :: GenSwaptionVolatilityStructure sv -> (Word, TimeUnit) -> IO Double Source #

implements the conversion between swap tenor and swap (time) length

callableBondVolatility :: CallableBondVolatilityStructure -> CallableBondMaturity -> Double -> Bool -> IO Double Source #

Callable-bond volatility for a supported option and bond maturity pair.

callableBondBlackVariance :: CallableBondVolatilityStructure -> CallableBondMaturity -> Double -> Bool -> IO Double Source #

Callable-bond Black variance for a supported option and bond maturity pair.

callableBondSmileSection :: CallableBondVolatilityStructure -> CallableBondSmileMaturity -> IO SmileSection Source #

Callable-bond smile section for a supported option and bond maturity pair.

maxBondTenor :: CallableBondVolatilityStructure -> IO (Int, TimeUnit) Source #

The largest bond tenor for which the structure can return vols.

Smile values and calibration results

smileSectionVolatility Source #

Arguments

:: SmileSection 
-> Double

strike

-> IO Double 

the volatility for the given strike, for any SmileSection (however it was constructed)

smileSectionVariance Source #

Arguments

:: SmileSection 
-> Double

strike

-> IO Double 

the Black variance for the given strike, for any SmileSection (however it was constructed)

smileSectionAtmLevel :: SmileSection -> IO Double Source #

the ATM level baked into the SmileSection at construction (or later re-anchored via atmSmileSection), for any SmileSection (however it was constructed)

smileSectionOptionPrice Source #

Arguments

:: SmileSection 
-> Double

strike

-> OptionType

type

-> Double

discount

-> IO Double 

the (non-discounted-by-default) price of a European option with the given strike/type, for any SmileSection (however it was constructed)

smileSectionDigitalOptionPrice Source #

Arguments

:: SmileSection 
-> Double

strike

-> OptionType

type

-> Double

discount

-> Double

gap

-> IO Double 

the price of a cash-or-nothing digital option with the given strike/type, approximated via a call/put spread of width gap, for any SmileSection (however it was constructed)

smileSectionDensity Source #

Arguments

:: SmileSection 
-> Double

strike

-> Double

discount

-> Double

gap

-> IO Double 

the risk-neutral probability density at the given strike, approximated via a finite difference of width gap on smileSectionOptionPrice, for any SmileSection (however it was constructed)

smileSectionVega Source #

Arguments

:: SmileSection 
-> Double

strike

-> Double

discount

-> IO Double 

the strike derivative of smileSectionOptionPrice, for any SmileSection (however it was constructed)

sabrAlpha :: SabrInterpolatedSmileSection -> IO Double Source #

calibrated alpha (post-fit; can differ from the initial guess passed to sabrInterpolatedSmileSection unless sabrIsAlphaFixed was set).

sabrRmsError :: SabrInterpolatedSmileSection -> IO Double Source #

root-mean-square calibration error

sabrCalibrationEndCriteria :: SabrInterpolatedSmileSection -> IO EndCriteriaType Source #

the reason the SABR calibration's optimizer stopped

sviA :: SviInterpolatedSmileSection -> IO Double Source #

calibrated a (post-fit; can differ from the initial guess passed to sviInterpolatedSmileSection unless aIsFixed was set).

sviRmsError :: SviInterpolatedSmileSection -> IO Double Source #

root-mean-square calibration error

sviMaxError :: SviInterpolatedSmileSection -> IO Double Source #

maximum calibration error

sviEndCriteria :: SviInterpolatedSmileSection -> IO EndCriteriaType Source #

the reason the SVI calibration's optimizer stopped

noArbSabrAlpha :: NoArbSabrInterpolatedSmileSection -> IO Double Source #

calibrated alpha (post-fit; can differ from the initial guess passed to noArbSabrInterpolatedSmileSection unless isAlphaFixed was set).

noArbSabrRmsError :: NoArbSabrInterpolatedSmileSection -> IO Double Source #

root-mean-square calibration error

noArbSabrEndCriteria :: NoArbSabrInterpolatedSmileSection -> IO EndCriteriaType Source #

the reason the calibration's optimizer stopped

zabrInterpolatedAlpha :: ZabrInterpolatedSmileSection -> IO Double Source #

calibrated alpha (post-fit; can differ from the initial guess passed to zabrInterpolatedSmileSection unless isAlphaFixed was set).

zabrInterpolatedRmsError :: ZabrInterpolatedSmileSection -> IO Double Source #

root-mean-square calibration error

zabrInterpolatedEndCriteria :: ZabrInterpolatedSmileSection -> IO EndCriteriaType Source #

the reason the calibration's optimizer stopped

ATM curves and SABR surfaces

atmVol :: GenBlackAtmVolCurve b -> OptionMaturity -> Bool -> IO Double Source #

Spot at-the-money volatility for any supported option-maturity representation.

atmVariance :: GenBlackAtmVolCurve b -> OptionMaturity -> Bool -> IO Double Source #

Spot at-the-money variance for any supported option-maturity representation.

abcdK :: AbcdAtmVolCurve -> Double -> IO Double Source #

k adjustment factor at a given time

abcdKs :: AbcdAtmVolCurve -> IO [Double] Source #

k adjustment factors for every option tenor used in interpolation

abcdOptionTenorsInInterpolation :: AbcdAtmVolCurve -> IO [(Word, TimeUnit)] Source #

As abcdAtmVolCurveOptionTenors, but only the tenors actually used in the ABCD fit.

abcdOptionTimes :: AbcdAtmVolCurve -> IO [Double] Source #

As abcdOptionDates, in year fractions from the curve's reference date.

sabrVolSurfaceAtmCurve :: SabrVolSurface -> IO BlackAtmVolCurve Source #

the BlackAtmVolCurve this surface's ATM level is anchored to

sabrVolSurfaceIndex :: SabrVolSurface -> IO InterestRateIndex Source #

the interest rate index this surface was built from (folded in from upstream's InterestRateVolSurface, not given its own hierarchy level here -- see SabrVolSurface).

sabrVolSurfaceOptionDateFromTenor Source #

Arguments

:: SabrVolSurface 
-> (Word, TimeUnit)

optionTenor

-> IO Day 

as sabrVolSurfaceIndex, converts an option tenor to its option date (folded in from InterestRateVolSurface)

sabrVolatilitySpreads :: SabrVolSurface -> SabrVolatilitySpreadsMaturity -> IO [Double] Source #

Volatility-spread row at an option date or tenor.

Swaption matrices and cubes

swaptionVolatilityMatrixLocate :: SwaptionVolatilityMatrix -> Day -> (Word, TimeUnit) -> IO (Word, Word) Source #

Lower indexes of the grid corners surrounding (optionDate, swapTenor), into the row/column axes this matrix was built from (see swaptionVolatilityMatrix and swaptionVolatilityMatrixMoving).

interpolatedSwaptionVolatilityCubeVolSpreads :: InterpolatedSwaptionVolatilityCube -> Word -> IO RealMatrix Source #

The interpolated volatility-spread matrix (option tenor x swap tenor) at the given strike index (0-based, into the strikeSpreads the cube was built with).

sparseSabrParameters :: SabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated SABR parameters (alpha, beta, nu, rho columns) before ATM recalibration.

denseSabrParameters :: SabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated SABR parameters, meaningfully populated only when the cube was built with isAtmCalibrated = True (see sabrSwaptionVolatilityCube).

marketVolCube :: SabrSwaptionVolatilityCube -> IO RealMatrix Source #

The raw market vol grid the cube's SABR fit targets: ATM vol (interpolated from atmVolStructure at each node) plus volSpreads.

volCubeAtmCalibrated :: SabrSwaptionVolatilityCube -> IO RealMatrix Source #

Like marketVolCube, adjusted so the cube's own ATM row is consistent with atmVolStructure; meaningfully populated only when the cube was built with isAtmCalibrated = True.

noArbSabrSparseSabrParameters :: NoArbSabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated no-arb SABR parameters (alpha, beta, nu, rho columns) before ATM recalibration, see sparseSabrParameters.

noArbSabrDenseSabrParameters :: NoArbSabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated no-arb SABR parameters, meaningfully populated only when the cube was built with isAtmCalibrated = True, see denseSabrParameters.

noArbSabrMarketVolCube :: NoArbSabrSwaptionVolatilityCube -> IO RealMatrix Source #

The raw market vol grid the cube's no-arb SABR fit targets, see marketVolCube.

noArbSabrVolCubeAtmCalibrated :: NoArbSabrSwaptionVolatilityCube -> IO RealMatrix Source #

Like noArbSabrMarketVolCube, adjusted so the cube's own ATM row is consistent with atmVolStructure; meaningfully populated only when the cube was built with isAtmCalibrated = True, see volCubeAtmCalibrated.

zabrSparseParameters :: ZabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated ZABR parameters (alpha, beta, nu, rho, gamma columns) before ATM recalibration, see sparseSabrParameters.

zabrDenseParameters :: ZabrSwaptionVolatilityCube -> IO RealMatrix Source #

Per-node calibrated ZABR parameters, meaningfully populated only when the cube was built with isAtmCalibrated = True, see denseSabrParameters.

zabrMarketVolCube :: ZabrSwaptionVolatilityCube -> IO RealMatrix Source #

The raw market vol grid the cube's ZABR fit targets, see marketVolCube.

zabrVolCubeAtmCalibrated :: ZabrSwaptionVolatilityCube -> IO RealMatrix Source #

Like zabrMarketVolCube, adjusted so the ATM row is consistent with atmVolStructure; meaningfully populated only when the cube was built with isAtmCalibrated = True.

Andreasen-Huge results

andreasenHugeCalibrationError :: AndreasenHugeVolatilityInterpl -> IO (Double, Double, Double) Source #

Minimum, maximum, and average calibration errors, expressed in volatility units.

andreasenHugeForward Source #

Arguments

:: AndreasenHugeVolatilityInterpl

interpolation

-> Double

t

-> IO Double 

Forward level implied by an Andreasen-Huge calibration at time t.

andreasenHugeOptionPrice Source #

Arguments

:: AndreasenHugeVolatilityInterpl

interpolation

-> Double

t

-> Double

strike

-> OptionType

optionType

-> IO Double 

Calibrated option price at time, strike, and put/call type.

andreasenHugeLocalVol Source #

Arguments

:: AndreasenHugeVolatilityInterpl

interpolation

-> Double

t

-> Double

strike

-> IO Double 

Calibrated local volatility at time and strike.