Pricing engines¶
Analytic, lattice and Monte Carlo pricing engines.
pricingengines
¶
Runtime source shim for the native itofin.pricingengines submodule.
The real itofin.pricingengines is a compiled submodule registered into
sys.modules by the extension; it wins at import time, so nothing here
runs. This file exists only so static type checkers resolve
from itofin.pricingengines import ... from pricingengines/__init__.pyi without a
reportMissingModuleSource warning.
Auto-generated by scripts/gen_submodule_shims.py from pricingengines/__init__.pyi; do not edit or delete by hand.
AnalyticGJRGARCHEngine
¶
AnalyticGJRGARCHEngine(model: GJRGARCHModel)
European plain-vanilla pricing with QuantLib's GJR-GARCH moment approximation.
This is an approximation, not an exact characteristic-function valuation. Preserves the source convention: call values omit the dividend discount, and put minus call is strike * risk-free discount / dividend discount - spot. Only NPV is supplied; unsupported exercises, payoffs and Greeks raise errors.
Retain the live model and its daily-unit parameters.
BachelierCapFloorEngine
¶
Normal-volatility engine for caps, floors and collars.
BachelierSwaptionEngine
¶
BachelierSwaptionEngine(vol: SwaptionVolatilityStructure, discount: YieldTermStructure, settings: Settings, model: CashAnnuityModel = SwapRate)
The normal-volatility swaption engine, European-only.
The Bachelier spec of the template BlackSwaptionEngine instantiates: same constructors, same settings requirement, same silent discounting engine on the underlying swap. The surface's volatility type is checked against the normal formula at pricing time, not construction, so a shifted-lognormal surface raises from Swaption.npv().
Build an engine reading normal volatilities off vol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vol
|
SwaptionVolatilityStructure
|
The surface normal volatilities are read off. |
required |
discount
|
YieldTermStructure
|
The curve both legs are discounted on. |
required |
settings
|
Settings
|
The explicit settings; must be the same object driving the swaption and its swap. |
required |
model
|
CashAnnuityModel
|
Which date a cash-settled par-yield annuity discounts to. Defaults to SwapRate. |
SwapRate
|
with_flat_vol
staticmethod
¶
with_flat_vol(discount: YieldTermStructure, vol: SimpleQuote, day_counter: DayCounter, displacement: float, settings: Settings, model: CashAnnuityModel = SwapRate) -> BachelierSwaptionEngine
Build an engine over a flat normal volatility quote.
The quote is wrapped internally in a constant surface on a null calendar whose reference date tracks the evaluation date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
discount
|
YieldTermStructure
|
The curve both legs are discounted on. |
required |
vol
|
SimpleQuote
|
The flat normal volatility. |
required |
day_counter
|
DayCounter
|
The day count the constant surface measures time on. |
required |
displacement
|
float
|
Kept for signature parity with the Black engine; the normal model has no shift and ignores it. |
required |
settings
|
Settings
|
The explicit settings; must be the same object driving the swaption and its swap. |
required |
model
|
CashAnnuityModel
|
Which date a cash-settled par-yield annuity discounts to. Defaults to SwapRate. |
SwapRate
|
Returns:
| Name | Type | Description |
|---|---|---|
BachelierSwaptionEngine |
BachelierSwaptionEngine
|
The engine over the flat surface. |
BatesEngine
¶
BatesEngine(model: BatesModel, integration_order: int = 144)
European plain-vanilla Bates pricing by Gauss-Laguerre integration.
Retain the live model with an integration order from 1 through 192.
Only NPV is supplied. Unsupported exercises and Greeks raise ItofinError.
BlackCalculator
¶
BlackCalculator(option_type: OptionType, strike: float, forward: float, std_dev: float, discount: float)
Immutable plain-vanilla standalone value and Greeks, not a pricing engine. Every nonfinite result raises ItofinError, including native zero-strike NaNs.
Copy finite strike >= 0, forward > 0, std_dev >= 0 and discount > 0. std_dev is volatility times sqrt(time); no payoff objects are accepted.
BlackCallableFixedRateBondEngine
¶
BlackCallableFixedRateBondEngine(yield_volatility: SimpleQuote, discount_curve: YieldTermStructure, settings: Settings)
Single-European constant relative forward-yield volatility pricing.
Retain the live volatility quote, discount curve and exact settings allocation.
BlackCapFloorEngine
¶
BlackCapFloorEngine(vol: OptionletVolatilityStructure, discount: YieldTermStructure, displacement: Optional[float] = None)
The shifted-lognormal Black-formula cap/floor engine, one Black 1976 optionlet per coupon.
Only the shifted-lognormal path is priced in the core, so a normal-volatility surface is rejected by the constructor rather than bound to a Bachelier engine. The instrument this engine prices must resolve its dates against the same Settings object the engine does.
Build an engine reading volatilities off vol and discounting on discount.
Fallible at construction, unlike the swaption engines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vol
|
OptionletVolatilityStructure
|
The optionlet surface volatilities are read off; must be shifted-lognormal. |
required |
discount
|
YieldTermStructure
|
The curve the optionlets are discounted on. |
required |
displacement
|
float | None
|
The lognormal shift; None adopts the surface's own. |
None
|
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the surface handle is empty, the surface is normal-volatility, or a given displacement differs from the surface's own. |
with_flat_vol
staticmethod
¶
with_flat_vol(discount: YieldTermStructure, vol: SimpleQuote, day_counter: DayCounter, displacement: float, settings: Settings) -> BlackCapFloorEngine
Build an engine over a flat volatility quote.
The quote is wrapped internally in a constant optionlet surface on a null calendar whose reference date tracks the evaluation date. displacement carries no default, mirroring the swaption engine: a trailing settings cannot follow a defaulted argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
discount
|
YieldTermStructure
|
The curve the optionlets are discounted on. |
required |
vol
|
SimpleQuote
|
The flat Black volatility. |
required |
day_counter
|
DayCounter
|
The day count the constant surface measures time on. |
required |
displacement
|
float
|
The constant surface's lognormal shift. |
required |
settings
|
Settings
|
The explicit settings the constant surface's reference date tracks. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BlackCapFloorEngine |
BlackCapFloorEngine
|
The engine over the flat surface. |
displacement
¶
Return the lognormal shift the engine applies to forwards and strikes.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The displacement. |
BlackDeltaCalculator
¶
BlackDeltaCalculator(option_type: OptionType, delta_type: DeltaType, spot: float, domestic_discount: float, foreign_discount: float, std_dev: float)
Immutable standalone FX delta/strike conversion, not a pricing engine. Premium-adjusted calls invert on the high-strike branch.
Copy positive finite spot/discounts and finite nonnegative std_dev. std_dev is volatility times sqrt(time). Construct a new calculator to change option or delta convention; no mutators are exposed.
delta_from_strike
¶
Signed delta at finite nonnegative strike, including zero deviation. Premium-adjusted put deltas may be below minus one.
strike_from_delta
¶
Invert a signed interior delta with positive deviation. A premium-adjusted call returns the high-strike root, not necessarily the original strike.
BlackSwaptionEngine
¶
BlackSwaptionEngine(vol: SwaptionVolatilityStructure, discount: YieldTermStructure, settings: Settings, model: CashAnnuityModel = SwapRate)
The shifted-lognormal Black-formula swaption engine, European-only.
It prices the underlying swap itself, so that swap needs no engine of its own. The settings passed here must be the same object driving the swaption and its swap: a mismatch prices the two on different evaluation dates with no error raised. The surface's volatility type is checked against the Black formula at pricing time, not construction, so a normal-volatility surface raises from Swaption.npv().
Build an engine reading volatilities off vol and discounting on discount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vol
|
SwaptionVolatilityStructure
|
The surface volatilities are read off. |
required |
discount
|
YieldTermStructure
|
The curve both legs are discounted on. |
required |
settings
|
Settings
|
The explicit settings; must be the same object driving the swaption and its swap. |
required |
model
|
CashAnnuityModel
|
Which date a cash-settled par-yield annuity discounts to. Defaults to SwapRate. |
SwapRate
|
with_flat_vol
staticmethod
¶
with_flat_vol(discount: YieldTermStructure, vol: SimpleQuote, day_counter: DayCounter, displacement: float, settings: Settings, model: CashAnnuityModel = SwapRate) -> BlackSwaptionEngine
Build an engine over a flat volatility quote.
The quote is wrapped internally in a constant surface on a null calendar whose reference date tracks the evaluation date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
discount
|
YieldTermStructure
|
The curve both legs are discounted on. |
required |
vol
|
SimpleQuote
|
The flat Black volatility. |
required |
day_counter
|
DayCounter
|
The day count the constant surface measures time on. |
required |
displacement
|
float
|
The constant surface's lognormal shift. |
required |
settings
|
Settings
|
The explicit settings; must be the same object driving the swaption and its swap. |
required |
model
|
CashAnnuityModel
|
Which date a cash-settled par-yield annuity discounts to. Defaults to SwapRate. |
SwapRate
|
Returns:
| Name | Type | Description |
|---|---|---|
BlackSwaptionEngine |
BlackSwaptionEngine
|
The engine over the flat surface. |
CosHestonEngine
¶
CosHestonEngine(model: HestonModel, l: float = 16.0, n: int = 200)
Fourier cosine expansion retaining its live Heston model.
Construct a COS engine with positive truncation width and series size.
chf
¶
Return the normalized characteristic function as (real, imaginary).
DiscountingBondEngine
¶
Observable discounting engine, with live curve and explicit retained settings.
DiscountingSwapEngine
¶
DiscountingSwapEngine(discount: YieldTermStructure, settings: Settings)
Discounts every leg of a swap over a single yield curve.
Infallible at construction - every precondition (an empty curve handle, an unset evaluation date) is reported when the swap is priced. The core's include_settlement_date_flows, settlement_date and npv_date overrides are not exposed and are always None, so the flow decision follows the settings' own flags and both dates fall back to the curve reference date. The swap this engine prices must carry the same Settings object.
Build an engine discounting every leg on discount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
discount
|
YieldTermStructure
|
The curve every leg is discounted on; the engine registers as an observer of it. |
required |
settings
|
Settings
|
The explicit settings; must be the same object the swap this engine prices was built with, or the two resolve their dates against different evaluation dates and the NPV is silently wrong. |
required |
ExponentialFittingHestonEngine
¶
ExponentialFittingHestonEngine(model: HestonModel, control_variate: ExponentialFittingControlVariate = Optimal, scaling: Optional[float] = None, alpha: float = -0.5)
Exponentially fitted quadrature retaining its live Heston model.
Construct the selected control variate with optional fixed scaling.
FdBlackScholesVanillaEngine
¶
FdBlackScholesVanillaEngine(process: BlackScholesProcess, t_grid: int = 100, x_grid: int = 100, damping_steps: int = 0, scheme: FdScheme = Douglas)
Finite-difference engine for European, American and Bermudan vanilla options.
Build a grid engine retaining the Black-Scholes process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process
|
BlackScholesProcess
|
The market process to price under. |
required |
t_grid
|
int
|
Positive number of time steps; defaults to 100. |
100
|
x_grid
|
int
|
Spatial grid size, at least 3; defaults to 100. |
100
|
damping_steps
|
int
|
Initial implicit-Euler steps; defaults to 0. |
0
|
scheme
|
FdScheme
|
Douglas by default; ImplicitEuler is also supported. |
Douglas
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the grid dimensions are invalid. |
OverflowError
|
If a grid integer is outside the accepted range. |
IsdaCdsEngine
¶
IsdaCdsEngine(probability: DefaultProbabilityTermStructure, recovery: float, discount: YieldTermStructure, settings: Settings, numerical_fix: NumericalFix = Taylor, accrual_bias: AccrualBias = HalfDayBias, forwards_in_coupon_period: ForwardsInCouponPeriod = Piecewise)
The ISDA standard-model credit-default-swap engine: both legs are integrated over the pillar dates of the two curves the engine is built with rather than over the premium schedule alone.
Infallible at construction, like MidPointCdsEngine. The model is specified against curves of a fixed shape, so every check - both curves counting Act/365 (Fixed) and referenced at the evaluation date, the contract settling its accrual, paying at the default time and carrying a face-value claim - is reported as ItofinError when the contract is priced, not from init. The core's include_settlement_date_flows override is not exposed and is always None. The three fidelity flags are trailing keyword arguments defaulting to the C++ defaults Taylor / HalfDayBias / Piecewise, so an engine built without them prices as before; they are taken here rather than through a with_fidelity method because the core builder consumes the engine while set_isda_engine has already cloned it into the contract. The contract this engine prices must carry the same Settings object.
Build an ISDA standard-model engine under the three fidelity flags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
DefaultProbabilityTermStructure
|
The curve default probabilities are read off; must count Act/365 (Fixed) and be referenced at the evaluation date, checked at pricing time. |
required |
recovery
|
float
|
The recovery rate; a default pays 1 - recovery of the notional. |
required |
discount
|
YieldTermStructure
|
The curve both legs are discounted on, under the same shape requirement. |
required |
settings
|
Settings
|
The explicit settings; must be the same object the contract this engine prices was built with. |
required |
numerical_fix
|
NumericalFix
|
How the integrand denominators are kept away from zero. Defaults to Taylor. |
Taylor
|
accrual_bias
|
AccrualBias
|
Whether the premium leg carries the half-day accrual bias. Defaults to HalfDayBias. |
HalfDayBias
|
forwards_in_coupon_period
|
ForwardsInCouponPeriod
|
How forward rates inside a coupon period are integrated. Defaults to Piecewise. |
Piecewise
|
JumpDiffusionEngine
¶
JumpDiffusionEngine(process: Merton76Process, relative_accuracy: float = 0.0001, max_iterations: int = 100)
European Merton pricing by a convergent Poisson mixture of Black prices.
Retain the process and configure relative series accuracy and term limit.
Accuracy must be finite and positive, and the iteration limit must be between 1 and 100000. Failure to converge raises ItofinError when pricing.
MCAmericanEngine
¶
MCAmericanEngine(process: BlackScholesProcess, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, absolute_tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: Optional[int] = None, antithetic: Optional[bool] = None, polynomial_order: Optional[int] = None, calibration_samples: Optional[int] = None, basis_system: int = 0)
The Longstaff-Schwartz least-squares Monte Carlo engine for American and Bermudan payoffs, over the pseudo-random RNG policy. Sobol, Brownian bridge, control variates and multi-asset paths are not exposed.
The option must have American or Bermudan exercise: a European-exercise option raises ItofinError ("wrong exercise given") when priced here.
Pricing is seeded and deterministic: the same seed reproduces the NPV bitwise, the standard error is read back through VanillaOption.error_estimate() and the early-exercise fraction through VanillaOption.exercise_probability().
Build an engine over process, configured through the core factory.
Every argument past process is left unset when omitted, so the core's own validation reports the illegal combinations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process
|
BlackScholesProcess
|
The process paths are drawn from. |
required |
steps
|
int | None
|
The fixed number of time steps per path. |
None
|
steps_per_year
|
int | None
|
The time steps per year, the alternative to steps. |
None
|
samples
|
int | None
|
The fixed number of paths to draw. |
None
|
absolute_tolerance
|
float | None
|
The target standard error, the alternative to samples. |
None
|
max_samples
|
int | None
|
The cap on paths drawn when running to a tolerance. |
None
|
seed
|
int | None
|
The RNG seed; the same seed reproduces the NPV bitwise. |
None
|
antithetic
|
bool | None
|
The antithetic variate, supported here; the core oracle prices with it on. |
None
|
polynomial_order
|
int | None
|
The order of the selected regression basis. The core default is 2. |
None
|
calibration_samples
|
int | None
|
The paths the regression is fitted on. The core default is 2048. |
None
|
basis_system
|
int
|
0 Monomial (default), 1 Laguerre, 2 Hermite, 3 Hyperbolic, or 6 Chebyshev2nd. Legendre (4) and Chebyshev (5) are rejected, matching QuantLib's American path pricer. Chebyshev2nd supports put payoffs only; call pricing returns an error. |
0
|
Raises:
| Type | Description |
|---|---|
ItofinError
|
If neither or both of steps and steps_per_year are given, or if both samples and absolute_tolerance are given. |
MCEuropeanEngine
¶
MCEuropeanEngine(process: BlackScholesProcess, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, absolute_tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: Optional[int] = None, antithetic: Optional[bool] = None)
The Monte Carlo engine for European payoffs, over the pseudo-random RNG policy.
Pricing is seeded and deterministic: the same seed reproduces the NPV bitwise, and the standard error is read back through VanillaOption.error_estimate().
Build an engine over process, configured through the core factory.
Every argument past process is left unset when omitted, so the core's own validation reports the illegal combinations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process
|
BlackScholesProcess
|
The process paths are drawn from. |
required |
steps
|
int | None
|
The fixed number of time steps per path. |
None
|
steps_per_year
|
int | None
|
The time steps per year, the alternative to steps. |
None
|
samples
|
int | None
|
The fixed number of paths to draw. |
None
|
absolute_tolerance
|
float | None
|
The target standard error, the alternative to samples. |
None
|
max_samples
|
int | None
|
The cap on paths drawn when running to a tolerance. |
None
|
seed
|
int | None
|
The RNG seed; the same seed reproduces the NPV bitwise. |
None
|
antithetic
|
bool | None
|
The antithetic variate, supported since 772 lifted the former construction-time rejection.¶ |
None
|
Raises:
| Type | Description |
|---|---|
ItofinError
|
If neither or both of steps and steps_per_year are given, or if both samples and absolute_tolerance are given. |
MCEuropeanGJRGARCHEngine
¶
MCEuropeanGJRGARCHEngine(process: GJRGARCHProcess, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, absolute_tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: Optional[int] = None, antithetic: Optional[bool] = None)
Seeded pseudo-random European pricing on any supported GJR process scheme.
Retains the supplied process snapshot: later model parameter updates do not retarget an existing MC engine. Live spot and yield quotes still update. Standard error is available through VanillaOption.error_estimate(). Brownian bridge and control variates are not supported by this facade.
Configure the core factory, preserving its argument validation.
Specify exactly one of steps and steps_per_year, and exactly one of samples and absolute_tolerance. max_samples caps tolerance-driven draws.
MCEuropeanHestonEngine
¶
MCEuropeanHestonEngine(process: HestonProcess, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, absolute_tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: Optional[int] = None, antithetic: Optional[bool] = None)
The Monte Carlo engine for European payoffs on a Heston process, over the pseudo-random RNG policy. The low-discrepancy policy is not exposed (#454).
Pricing is seeded and deterministic: the same seed reproduces the NPV bitwise, and the standard error is read back through VanillaOption.error_estimate().
Build an engine over process, configured through the core factory.
Every argument past process is left unset when omitted, so the core's own validation reports the illegal combinations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process
|
HestonProcess
|
The Heston process paths are drawn from. |
required |
steps
|
int | None
|
The fixed number of time steps per path. |
None
|
steps_per_year
|
int | None
|
The time steps per year, the alternative to steps. |
None
|
samples
|
int | None
|
The fixed number of paths to draw. |
None
|
absolute_tolerance
|
float | None
|
The target standard error, the alternative to samples. |
None
|
max_samples
|
int | None
|
The cap on paths drawn when running to a tolerance. |
None
|
seed
|
int | None
|
The RNG seed; the same seed reproduces the NPV bitwise. |
None
|
antithetic
|
bool | None
|
The antithetic variate, supported here; the core cached oracle prices with it on. |
None
|
Raises:
| Type | Description |
|---|---|
ItofinError
|
If neither or both of steps and steps_per_year are given, or if both samples and absolute_tolerance are given. |
MCVarianceSwapEngine
¶
MCVarianceSwapEngine(process: BlackScholesProcess, *, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: int = 0)
Estimate integrated log-price diffusion variance, not squared returns.
Exactly one grid selector and one stopping selector are required. Tolerance is an absolute annualized-variance standard-error target, not a cash target. Sampling error excludes grid/integration bias. Nonzero seeds reproduce each recalculation; zero selects the existing randomized convention. No advanced Monte Carlo features or historical observations are supported.
Retain a Black-Scholes process with bounded sampling and grid work.
Fixed samples require at least two. Tolerance sampling starts with 1023 observations and defaults to a 50000-sample maximum. Failure to reach tolerance within the permitted budget raises ItofinError.
MidPointCdsEngine
¶
MidPointCdsEngine(probability: DefaultProbabilityTermStructure, recovery: float, discount: YieldTermStructure, settings: Settings)
The mid-point credit-default-swap engine: each live premium period is priced against the default probability over that period, with the default placed at the period's mid-point.
Infallible at construction - every precondition (an empty curve handle, an unset evaluation date) is reported when the contract is priced. The core's include_settlement_date_flows override is not exposed and is always None, so the settlement-date flow decision follows the settings' own flags. The contract this engine prices must carry the same Settings object.
Build an engine over a default-probability curve and a discount curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
DefaultProbabilityTermStructure
|
The curve default probabilities are read off. |
required |
recovery
|
float
|
The recovery rate; a default pays 1 - recovery of the notional. |
required |
discount
|
YieldTermStructure
|
The curve both legs are discounted on. |
required |
settings
|
Settings
|
The explicit settings; must be the same object the contract this engine prices was built with. |
required |
QMCEuropeanEngine
¶
QMCEuropeanEngine(process: BlackScholesProcess, steps: Optional[int] = None, steps_per_year: Optional[int] = None, samples: Optional[int] = None, absolute_tolerance: Optional[float] = None, max_samples: Optional[int] = None, seed: Optional[int] = None, antithetic: Optional[bool] = None)
Fixed-sample Sobol European engine, without an error estimate.
Build a Sobol engine with a positive fixed sample count.
No statistical error estimate is available. Absolute tolerance and max_samples are rejected. Seed selects Sobol direction initialization; it is deterministic even when omitted or zero.
ReplicatingVarianceSwapEngine
¶
ReplicatingVarianceSwapEngine(process: BlackScholesProcess, call_strikes: Sequence[float], put_strikes: Sequence[float], *, dk: float = 5.0)
Discrete log-payoff replication on a retained live Black-Scholes market.
Each side requires 2..4096 positive finite raw strikes and at least two distinct strikes. The minimum call equals the maximum put exactly. Tail extension dk must remain positive and representable on both sides. This is a finite strip, not infinite-tail integration or a sigma-squared guarantee. Native nonzero-dividend drift has a boundary-dependent mismatch.
Copy list or tuple strike inputs, canonicalizing each side independently.
PyO3 extracts Python sequences before core bounds; additional core allocations are bounded. No iterator-only generator contract is promised.
TreeCallableFixedRateBondEngine
¶
Event-aligned callable fixed/zero bond pricing on the retained Hull-White model.
Retain the existing model and settings; time steps must be positive.
TreeSwaptionEngine
¶
A Hull-White tree engine with a positive number of time steps.
Retain the model and settings; zero steps raise ItofinError.
YoYInflationCapFloorEngine
¶
Prices a year-on-year inflation cap or floor optionlet by optionlet.
The distribution is chosen by the constructor rather than passed as an argument, mirroring C++'s three engine classes: black is lognormal, unit_displaced lognormal in 1 + rate and bachelier normal. The core YoYOptionletDistribution enum is not bound, so distribution() reads back as a string.
The settings behind the volatility surface and behind the cap/floor this engine prices must be the same object, or the two resolve their dates against different evaluation dates and the NPV is silently wrong.
An engine carries the arguments and results of the contract it last priced, so a cap and a floor priced together want one engine each.
black
staticmethod
¶
black(index: YoYInflationIndex, volatility: ConstantYoYOptionletVolatility, nominal_ts: YieldTermStructure) -> YoYInflationCapFloorEngine
Build an engine valuing optionlets under the lognormal model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
YoYInflationIndex
|
The index forwards are read off. |
required |
volatility
|
ConstantYoYOptionletVolatility
|
The surface optionlet volatilities are read off. |
required |
nominal_ts
|
YieldTermStructure
|
The nominal curve optionlets are discounted on. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
YoYInflationCapFloorEngine |
YoYInflationCapFloorEngine
|
The lognormal engine. |
unit_displaced
staticmethod
¶
unit_displaced(index: YoYInflationIndex, volatility: ConstantYoYOptionletVolatility, nominal_ts: YieldTermStructure) -> YoYInflationCapFloorEngine
Build an engine valuing optionlets under the unit-displaced lognormal model.
Lognormal in 1 + rate, the usual quoting convention for a rate that may be negative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
YoYInflationIndex
|
The index forwards are read off. |
required |
volatility
|
ConstantYoYOptionletVolatility
|
The surface optionlet volatilities are read off. |
required |
nominal_ts
|
YieldTermStructure
|
The nominal curve optionlets are discounted on. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
YoYInflationCapFloorEngine |
YoYInflationCapFloorEngine
|
The unit-displaced lognormal engine. |
bachelier
staticmethod
¶
bachelier(index: YoYInflationIndex, volatility: ConstantYoYOptionletVolatility, nominal_ts: YieldTermStructure) -> YoYInflationCapFloorEngine
Build an engine valuing optionlets under the normal model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
YoYInflationIndex
|
The index forwards are read off. |
required |
volatility
|
ConstantYoYOptionletVolatility
|
The surface optionlet volatilities are read off. |
required |
nominal_ts
|
YieldTermStructure
|
The nominal curve optionlets are discounted on. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
YoYInflationCapFloorEngine |
YoYInflationCapFloorEngine
|
The normal engine. |
distribution
¶
Return the distribution optionlets are valued under.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
"black", "unit_displaced" or "bachelier". |
AccrualBias
¶
Whether the premium leg carries the standard model's half-day accrual bias.
The bias shifts the accrual's tstart back by 1/730 of a year. HalfDayBias, the default, includes it as the model's C code does before version 1.8.2; NoBias leaves it out, as from 1.8.2 on.
CashAnnuityModel
¶
Which date a cash-settled par-yield annuity discounts to.
Only the (Cash, ParYieldCurve) settlement pair reads it; every other pair takes the fixed-leg BPS annuity and is insensitive to the choice. The swaption engines default to SwapRate, the branch every ported core test exercises, where C++ defaults to DiscountCurve.
ExponentialFittingControlVariate
¶
Control variate used by the exponentially fitted Heston quadrature.
FdScheme
¶
Supported rollback schemes for a one-dimensional Black-Scholes grid.
ForwardsInCouponPeriod
¶
How the ISDA engine treats forward rates inside a coupon period.
Piecewise, the default, subdivides each period at the integration grid's own nodes; Flat integrates each period in a single step. The two part only where the grid has nodes strictly inside a coupon period, so two flat curves price identically under either.
NumericalFix
¶
How the ISDA engine keeps the integrands' f + h denominators away from zero.
NoFix adds 10^-50 to them instead; Taylor, the default, replaces the quotient by its Taylor expansion once f + h falls below 10^-4. Spelled NoFix rather than C++'s None, which Python cannot name.