Pricing Engines Module

Vanilla Engines

AnalyticEuropeanEngine

class pyquantlib.AnalyticEuropeanEngine

Bases: engine

Analytic pricing engine for European vanilla options.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcess) -> None

Constructs engine with a Black-Scholes process.

  1. __init__(process: GeneralizedBlackScholesProcess, discountCurve: YieldTermStructureHandle) -> None

Constructs engine with separate discount curve.

  1. __init__(process: GeneralizedBlackScholesProcess, discountCurve: base.YieldTermStructure) -> None

Constructs engine with separate discount curve (handle created internally).

import pyquantlib as ql

engine = ql.AnalyticEuropeanEngine(process)
option.setPricingEngine(engine)

print(f"NPV:   {option.NPV():.4f}")
print(f"Delta: {option.delta():.4f}")
print(f"Gamma: {option.gamma():.4f}")
print(f"Vega:  {option.vega():.4f}")

IntegralEngine

class pyquantlib.IntegralEngine

Bases: PricingEngine

Pricing engine for European options using integral approach.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs with a Black-Scholes process.

AnalyticHestonEngine

class pyquantlib.AnalyticHestonEngine

Bases: GenericHestonModelEngine

Analytic pricing engine for Heston stochastic volatility model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: HestonModel, relTolerance: SupportsFloat | SupportsIndex, maxEvaluations: SupportsInt | SupportsIndex) -> None

Constructs with adaptive Gauss-Lobatto integration.

  1. __init__(model: HestonModel, integrationOrder: SupportsInt | SupportsIndex = 144) -> None

Constructs with Gauss-Laguerre integration.

  1. __init__(model: HestonModel, cpxLog: ComplexLogFormula, integration: Integration, andersenPiterbargEpsilon: SupportsFloat | SupportsIndex = 1e-25, alpha: SupportsFloat | SupportsIndex = -0.5) -> None

Constructs with full control over integration method.

numberOfEvaluations() int

Returns number of integration evaluations.

priceVanillaPayoff(payoff: PlainVanillaPayoff, maturity: SupportsFloat | SupportsIndex) float

Prices vanilla payoff for given maturity.

heston_process = ql.HestonProcess(
    ql.YieldTermStructureHandle(risk_free),
    ql.YieldTermStructureHandle(dividend),
    ql.QuoteHandle(spot),
    v0=0.04, kappa=1.0, theta=0.04, sigma=0.5, rho=-0.7,
)
heston_model = ql.HestonModel(heston_process)
engine = ql.AnalyticHestonEngine(heston_model)

Note

AnalyticHestonEngine computes NPV only. Greeks under Heston require finite difference engines.

AnalyticBlackVasicekEngine

class pyquantlib.AnalyticBlackVasicekEngine

Bases: PricingEngine

European option engine with stochastic Vasicek interest rates.

__init__(bsProcess: GeneralizedBlackScholesProcess, vasicekProcess: Vasicek, correlation: SupportsFloat | SupportsIndex) None

Constructs with BS process, Vasicek model, and correlation.

European option pricing with stochastic Vasicek interest rates.

vasicek = ql.Vasicek(r0=0.05, a=0.3, b=0.05, sigma=0.01)
engine = ql.AnalyticBlackVasicekEngine(process, vasicek, correlation=0.5)

BatesEngine

class pyquantlib.BatesEngine

Bases: AnalyticHestonEngine

Analytic pricing engine for the Bates model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: BatesModel, integrationOrder: SupportsInt | SupportsIndex = 144) -> None

Constructs with Bates model and integration order.

  1. __init__(model: BatesModel, relTolerance: SupportsFloat | SupportsIndex, maxEvaluations: SupportsInt | SupportsIndex) -> None

Constructs with Bates model, relative tolerance, and max evaluations.

bates_process = ql.BatesProcess(
    risk_free, dividend, spot,
    0.04, 1.0, 0.04, 0.5, -0.7,  # Heston params
    0.1, -0.05, 0.1,              # Jump params
)
model = ql.BatesModel(bates_process)
engine = ql.BatesEngine(model)

COSHestonEngine

class pyquantlib.COSHestonEngine

Bases: PricingEngine

Heston engine using Fourier-cosine series expansion.

__init__(model: HestonModel, L: SupportsFloat | SupportsIndex = 16, N: SupportsInt | SupportsIndex = 200) None

Constructs COS Heston engine.

c1(t: SupportsFloat | SupportsIndex) float
c2(t: SupportsFloat | SupportsIndex) float
c3(t: SupportsFloat | SupportsIndex) float
c4(t: SupportsFloat | SupportsIndex) float
chF(u: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) complex

Returns the normalized characteristic function.

kurtosis(t: SupportsFloat | SupportsIndex) float

Returns the kurtosis.

mu(t: SupportsFloat | SupportsIndex) float

Returns the mean.

skew(t: SupportsFloat | SupportsIndex) float

Returns the skewness.

var(t: SupportsFloat | SupportsIndex) float

Returns the variance.

Fourier-cosine series expansion for fast Heston pricing.

engine = ql.COSHestonEngine(heston_model, L=16, N=200)

ExponentialFittingHestonEngine

class pyquantlib.ExponentialFittingHestonEngine

Bases: PricingEngine

Heston engine using exponentially-fitted Gauss-Laguerre quadrature.

__init__(model: HestonModel, cv: ComplexLogFormula = <ComplexLogFormula.OptimalCV: 7>, scaling: object = None, alpha: SupportsFloat | SupportsIndex = -0.5) None

Constructs exponential fitting Heston engine.

Exponentially-fitted Gauss-Laguerre quadrature for Heston pricing.

AnalyticPTDHestonEngine

class pyquantlib.AnalyticPTDHestonEngine

Bases: PricingEngine

Analytic piecewise time-dependent Heston engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: PiecewiseTimeDependentHestonModel, relTolerance: SupportsFloat | SupportsIndex, maxEvaluations: SupportsInt | SupportsIndex) -> None

Constructs with adaptive Gauss-Lobatto integration.

  1. __init__(model: PiecewiseTimeDependentHestonModel, integrationOrder: SupportsInt | SupportsIndex = 144) -> None

Constructs with Gauss-Laguerre integration.

  1. __init__(model: PiecewiseTimeDependentHestonModel, cpxLog: QuantLib::AnalyticPTDHestonEngine::ComplexLogFormula, integration: Integration, andersenPiterbargEpsilon: SupportsFloat | SupportsIndex = 1e-08) -> None

Constructs with full control over integration method.

numberOfEvaluations() int

Returns number of integration evaluations.

Analytic engine for piecewise time-dependent Heston models.

AnalyticPDFHestonEngine

class pyquantlib.AnalyticPDFHestonEngine

Bases: PricingEngine

PDF-based Heston engine for arbitrary European payoffs.

Pv(x_t: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) float

Returns probability density in log-space.

__init__(model: HestonModel, gaussLobattoEps: SupportsFloat | SupportsIndex = 1e-06, gaussLobattoIntegrationOrder: SupportsInt | SupportsIndex = 10000) None

Constructs PDF Heston engine.

cdf(X: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) float

Returns cumulative distribution function Pr(x < X).

PDF-based Heston engine for arbitrary European payoffs.

HestonExpansionEngine

class pyquantlib.HestonExpansionEngine

Bases: PricingEngine

Heston engine based on analytic expansions (LPP2, LPP3, Forde).

__init__(model: HestonModel, formula: HestonExpansionFormula) None

Constructs Heston expansion engine.

Heston engine based on analytic expansions (LPP2, LPP3, Forde).

engine = ql.HestonExpansionEngine(model, ql.HestonExpansionFormula.LPP3)

AnalyticHestonHullWhiteEngine

class pyquantlib.AnalyticHestonHullWhiteEngine

Bases: AnalyticHestonEngine

Heston engine with Hull-White stochastic interest rates.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(hestonModel: HestonModel, hullWhiteModel: HullWhite, integrationOrder: SupportsInt | SupportsIndex = 144) -> None

Constructs with Gauss-Laguerre integration.

  1. __init__(hestonModel: HestonModel, hullWhiteModel: HullWhite, relTolerance: SupportsFloat | SupportsIndex, maxEvaluations: SupportsInt | SupportsIndex) -> None

Constructs with adaptive Gauss-Lobatto integration.

Heston model with Hull-White stochastic interest rates.

engine = ql.AnalyticHestonHullWhiteEngine(heston_model, hull_white_model)

AnalyticH1HWEngine

class pyquantlib.AnalyticH1HWEngine

Bases: AnalyticHestonHullWhiteEngine

H1-HW approximation with equity-rate correlation.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: HestonModel, hullWhiteModel: HullWhite, rhoSr: SupportsFloat | SupportsIndex, integrationOrder: SupportsInt | SupportsIndex = 144) -> None

Constructs with Gauss-Laguerre integration.

  1. __init__(model: HestonModel, hullWhiteModel: HullWhite, rhoSr: SupportsFloat | SupportsIndex, relTolerance: SupportsFloat | SupportsIndex, maxEvaluations: SupportsInt | SupportsIndex) -> None

Constructs with adaptive Gauss-Lobatto integration.

H1-HW approximation including equity-rate correlation.

engine = ql.AnalyticH1HWEngine(heston_model, hull_white_model, rhoSr=0.3)

BaroneAdesiWhaleyApproximationEngine

class pyquantlib.BaroneAdesiWhaleyApproximationEngine

Bases: PricingEngine

Barone-Adesi and Whaley approximation engine for American options (1987).

static criticalPrice(payoff: base.StrikedTypePayoff, riskFreeDiscount: SupportsFloat | SupportsIndex, dividendDiscount: SupportsFloat | SupportsIndex, variance: SupportsFloat | SupportsIndex, tolerance: SupportsFloat | SupportsIndex = 1e-06) float

Computes the critical price for early exercise.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs from a Black-Scholes process.

BjerksundStenslandApproximationEngine

class pyquantlib.BjerksundStenslandApproximationEngine

Bases: PricingEngine

Bjerksund and Stensland approximation engine for American options (1993).

__init__(process: GeneralizedBlackScholesProcess) None

Constructs from a Black-Scholes process.

BinomialVanillaEngine

class pyquantlib.BinomialVanillaEngine(process: GeneralizedBlackScholesProcess, treeType: str, timeSteps: SupportsInt | SupportsIndex) base.PricingEngine

Bases:

Binomial tree pricing engine for vanilla options.

Parameters:
  • process – Black-Scholes process

  • treeType – Tree type - one of: ‘jr’ or ‘jarrowrudd’: Jarrow-Rudd ‘crr’ or ‘coxrossrubinstein’: Cox-Ross-Rubinstein ‘eqp’ or ‘additiveeqp’: Additive equal probabilities ‘trigeorgis’: Trigeorgis ‘tian’: Tian ‘lr’ or ‘leisenreimer’: Leisen-Reimer ‘joshi’ or ‘joshi4’: Joshi

  • timeSteps – Number of time steps (minimum 2)

engine = ql.BinomialVanillaEngine(process, "crr", 801)

Tree types: jr, crr, eqp, trigeorgis, tian, lr, joshi

FdBlackScholesVanillaEngine

class pyquantlib.FdBlackScholesVanillaEngine

Bases: PricingEngine

Finite-differences Black-Scholes vanilla option engine.

__init__(process: GeneralizedBlackScholesProcess, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f2534e62b70>, localVol: bool = False, illegalLocalVolOverwrite: SupportsFloat | SupportsIndex = -3.4028234663852886e+38, cashDividendModel: CashDividendModel = <CashDividendModel.Spot: 0>) None

Constructs a finite-difference Black-Scholes engine.

Parameters:
  • process – Black-Scholes process

  • tGrid – Number of time steps

  • xGrid – Number of spatial grid points

  • dampingSteps – Damping steps near maturity

  • schemeDesc – FD scheme (Douglas, CrankNicolson, etc.)

  • localVol – Use local volatility

  • illegalLocalVolOverwrite – Override for illegal local vol values

  • cashDividendModel – Spot or Escrowed

engine = ql.FdBlackScholesVanillaEngine(
    process,
    tGrid=100,
    xGrid=100,
    schemeDesc=ql.FdmSchemeDesc.Douglas(),
)

FdHestonVanillaEngine

class pyquantlib.FdHestonVanillaEngine

Bases: PricingEngine

Finite-differences Heston vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: HestonModel, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341fe930>, leverageFct: base.LocalVolTermStructure = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs FD Heston engine.

  1. __init__(model: HestonModel, dividends: collections.abc.Sequence[base.Dividend], tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341c0ff0>, leverageFct: base.LocalVolTermStructure = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs FD Heston engine with dividends.

enableMultipleStrikesCaching(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None

Enables caching for multiple strikes.

Finite-differences Heston vanilla option engine. Supports European and American exercise.

engine = ql.FdHestonVanillaEngine(heston_model, tGrid=100, xGrid=100, vGrid=50)
option.setPricingEngine(engine)

# Multiple-strike caching for efficiency
engine.enableMultipleStrikesCaching([90.0, 100.0, 110.0])

The MakeFdHestonVanillaEngine builder provides a keyword-argument interface:

engine = ql.MakeFdHestonVanillaEngine(heston_model, tGrid=100, xGrid=100, vGrid=50)

FdBatesVanillaEngine

class pyquantlib.FdBatesVanillaEngine

Bases: PricingEngine

Partial integro finite-differences Bates vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: BatesModel, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253436a4f0>) -> None

Constructs FD Bates engine.

  1. __init__(model: BatesModel, dividends: std::vector<std::shared_ptr<QuantLib::Dividend>, std::allocator<std::shared_ptr<QuantLib::Dividend> > >, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341a2e30>) -> None

Constructs FD Bates engine with dividends.

Partial integro finite-differences engine for the Bates model (Heston + jumps).

engine = ql.FdBatesVanillaEngine(bates_model, tGrid=100, xGrid=100, vGrid=50)

FdSabrVanillaEngine

class pyquantlib.FdSabrVanillaEngine

Bases: PricingEngine

Finite-differences SABR vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, nu: SupportsFloat | SupportsIndex, rho: SupportsFloat | SupportsIndex, rTS: YieldTermStructureHandle, tGrid: SupportsInt | SupportsIndex = 50, fGrid: SupportsInt | SupportsIndex = 400, xGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, scalingFactor: SupportsFloat | SupportsIndex = 1.0, eps: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341c03b0>) -> None

Constructs FD SABR engine with handle.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, nu: SupportsFloat | SupportsIndex, rho: SupportsFloat | SupportsIndex, rTS: base.YieldTermStructure, tGrid: SupportsInt | SupportsIndex = 50, fGrid: SupportsInt | SupportsIndex = 400, xGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, scalingFactor: SupportsFloat | SupportsIndex = 1.0, eps: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3c5d30>) -> None

Constructs FD SABR engine (handle created internally).

Finite-differences SABR vanilla option engine. Takes model parameters directly.

engine = ql.FdSabrVanillaEngine(f0, alpha, beta, nu, rho, discount_curve)

FdCEVVanillaEngine

class pyquantlib.FdCEVVanillaEngine

Bases: PricingEngine

Finite-differences CEV vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, discountCurve: YieldTermStructureHandle, tGrid: SupportsInt | SupportsIndex = 50, xGrid: SupportsInt | SupportsIndex = 400, dampingSteps: SupportsInt | SupportsIndex = 0, scalingFactor: SupportsFloat | SupportsIndex = 1.0, eps: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253433e9f0>) -> None

Constructs FD CEV engine with handle.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, discountCurve: base.YieldTermStructure, tGrid: SupportsInt | SupportsIndex = 50, xGrid: SupportsInt | SupportsIndex = 400, dampingSteps: SupportsInt | SupportsIndex = 0, scalingFactor: SupportsFloat | SupportsIndex = 1.0, eps: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341c3330>) -> None

Constructs FD CEV engine (handle created internally).

Finite-differences CEV (constant elasticity of variance) vanilla option engine.

engine = ql.FdCEVVanillaEngine(f0, alpha, beta, discount_curve)

FdBlackScholesShoutEngine

class pyquantlib.FdBlackScholesShoutEngine

Bases: PricingEngine

Finite-differences Black-Scholes shout option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcess, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f2534de0cb0>) -> None

Constructs FD Black-Scholes shout engine.

  1. __init__(process: GeneralizedBlackScholesProcess, dividends: std::vector<std::shared_ptr<QuantLib::Dividend>, std::allocator<std::shared_ptr<QuantLib::Dividend> > >, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3cb470>) -> None

Constructs FD Black-Scholes shout engine with dividends.

Finite-differences engine for shout options (holder can lock in current intrinsic value).

engine = ql.FdBlackScholesShoutEngine(process, tGrid=100, xGrid=100)

FdHestonHullWhiteVanillaEngine

class pyquantlib.FdHestonHullWhiteVanillaEngine

Bases: PricingEngine

Finite-differences Heston + Hull-White vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: HestonModel, hwProcess: HullWhiteProcess, corrEquityShortRate: SupportsFloat | SupportsIndex, tGrid: SupportsInt | SupportsIndex = 50, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 40, rGrid: SupportsInt | SupportsIndex = 20, dampingSteps: SupportsInt | SupportsIndex = 0, controlVariate: bool = True, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25342196b0>) -> None

Constructs FD Heston-HW engine.

  1. __init__(model: HestonModel, hwProcess: HullWhiteProcess, dividends: collections.abc.Sequence[base.Dividend], corrEquityShortRate: SupportsFloat | SupportsIndex, tGrid: SupportsInt | SupportsIndex = 50, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 40, rGrid: SupportsInt | SupportsIndex = 20, dampingSteps: SupportsInt | SupportsIndex = 0, controlVariate: bool = True, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3d72f0>) -> None

Constructs FD Heston-HW engine with dividends.

Finite-differences Heston + Hull-White engine for vanilla options with stochastic rates.

engine = ql.FdHestonHullWhiteVanillaEngine(
    heston_model, hw_process, corrEquityShortRate=0.3,
)

FdOrnsteinUhlenbeckVanillaEngine

class pyquantlib.FdOrnsteinUhlenbeckVanillaEngine

Bases: PricingEngine

Finite-differences Ornstein-Uhlenbeck vanilla option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: OrnsteinUhlenbeckProcess, riskFreeRate: base.YieldTermStructure, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, epsilon: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341c31f0>) -> None

Constructs FD OU engine.

  1. __init__(process: OrnsteinUhlenbeckProcess, riskFreeRate: base.YieldTermStructure, dividends: collections.abc.Sequence[base.Dividend], tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, epsilon: SupportsFloat | SupportsIndex = 0.0001, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3ec130>) -> None

Constructs FD OU engine with dividends.

Finite-differences Ornstein-Uhlenbeck vanilla option engine.

ou_process = ql.OrnsteinUhlenbeckProcess(speed=0.5, volatility=0.01)
engine = ql.FdOrnsteinUhlenbeckVanillaEngine(ou_process, discount_curve)

MCEuropeanEngine

class pyquantlib.MCEuropeanEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Bases:

Monte Carlo European option pricing engine.

Parameters:
  • process – Black-Scholes process

  • rngType – ‘pseudorandom’ or ‘lowdiscrepancy’

  • timeSteps – Number of time steps

  • timeStepsPerYear – Time steps per year (alternative to timeSteps)

  • brownianBridge – Use Brownian bridge

  • antitheticVariate – Use antithetic variates

  • requiredSamples – Number of samples

  • requiredTolerance – Target tolerance (alternative to requiredSamples)

  • maxSamples – Maximum samples

  • seed – Random seed (0 for random)

engine = ql.MCEuropeanEngine(
    process,
    timeSteps=100,
    requiredSamples=100000,
    seed=42,
)
option.setPricingEngine(engine)
print(f"NPV: {option.NPV():.4f}")
print(f"Error: {option.errorEstimate():.6f}")

MCAmericanEngine

class pyquantlib.MCAmericanEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, antitheticVariate: bool = False, controlVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0, polynomialOrder: SupportsInt | SupportsIndex = 2, polynomialType: PolynomialType = <PolynomialType.Monomial: 0>, calibrationSamples: SupportsInt | SupportsIndex = 2048) base.PricingEngine

Bases:

Monte Carlo American option pricing engine (Longstaff-Schwartz).

Parameters:
  • process – Black-Scholes process

  • rngType – ‘pseudorandom’ or ‘lowdiscrepancy’

  • timeSteps – Number of time steps

  • timeStepsPerYear – Time steps per year (alternative to timeSteps)

  • antitheticVariate – Use antithetic variates

  • controlVariate – Use control variate (European option)

  • requiredSamples – Number of samples

  • requiredTolerance – Target tolerance (alternative to requiredSamples)

  • maxSamples – Maximum samples

  • seed – Random seed (0 for random)

  • polynomialOrder – Order of regression polynomial

  • polynomialType – Polynomial basis type (Monomial, Laguerre, etc.)

  • calibrationSamples – Samples for regression calibration

engine = ql.MCAmericanEngine(
    process,
    timeSteps=100,
    antitheticVariate=True,
    calibrationSamples=4096,
    requiredTolerance=0.02,
    seed=42,
)

MCEuropeanHestonEngine

pyquantlib.MCEuropeanHestonEngine(process: HestonProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo European Heston option pricing engine.

Parameters:
  • process – Heston process

  • rngType – ‘pseudorandom’ or ‘lowdiscrepancy’

  • timeSteps – Number of time steps

  • timeStepsPerYear – Time steps per year (alternative to timeSteps)

  • antitheticVariate – Use antithetic variates

  • requiredSamples – Number of samples

  • requiredTolerance – Target tolerance (alternative to requiredSamples)

  • maxSamples – Maximum samples

  • seed – Random seed (0 for random)

Monte Carlo European option engine under the Heston model.

engine = ql.MCEuropeanHestonEngine(
    heston_process,
    timeSteps=100,
    requiredSamples=100000,
    seed=42,
)

MCEuropeanGJRGARCHEngine

pyquantlib.MCEuropeanGJRGARCHEngine(process: GJRGARCHProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo GJR-GARCH European option pricing engine.

Monte Carlo European option engine under the GJR-GARCH(1,1) model.

engine = ql.MCEuropeanGJRGARCHEngine(
    gjrgarch_process,
    timeSteps=100,
    requiredSamples=100000,
    seed=42,
)

AnalyticCEVEngine

class pyquantlib.AnalyticCEVEngine

Bases: PricingEngine

Analytic Constant Elasticity of Variance pricing engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, discountCurve: YieldTermStructureHandle) -> None

Constructs AnalyticCEVEngine.

  1. __init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, discountCurve: base.YieldTermStructure) -> None

Constructs from yield term structure (handle created internally).

Analytic engine for the constant elasticity of variance (CEV) model.

engine = ql.AnalyticCEVEngine(f0, alpha, beta, discount_curve)

CEVCalculator

class pyquantlib.CEVCalculator

Bases: pybind11_object

Constant Elasticity of Variance option value calculator.

__init__(f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex) None

Constructs CEVCalculator.

alpha() float

Returns alpha.

beta() float

Returns beta.

f0() float

Returns initial forward.

value(optionType: OptionType, strike: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) float

Returns CEV option value.

Standalone CEV option value calculator.

calc = ql.CEVCalculator(f0, alpha, beta)
print(calc.value(ql.Call, 100.0, 1.0))

QdFpAmericanEngine

class pyquantlib.QdFpAmericanEngine

Bases: PricingEngine

High performance American option engine based on QD+ fixed-point iteration.

static accurateScheme() QdFpIterationScheme

Returns the accurate iteration scheme (default).

static fastScheme() QdFpIterationScheme

Returns the fast iteration scheme.

static highPrecisionScheme() QdFpIterationScheme

Returns the high precision iteration scheme.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcess) -> None

Constructs with process using default accurate scheme.

  1. __init__(process: GeneralizedBlackScholesProcess, iterationScheme: QdFpIterationScheme, fpEquation: QdFpFixedPointEquation = <QdFpFixedPointEquation.Auto: 2>) -> None

Constructs with process, iteration scheme, and fixed-point equation type.

High-performance American option engine based on QD+ fixed-point iteration.

engine = ql.QdFpAmericanEngine(process)

Warning

QdFpAmericanEngine.calculate() may crash on Windows. Use alternative American engines if needed.

JuQuadraticApproximationEngine

class pyquantlib.JuQuadraticApproximationEngine

Bases: PricingEngine

Ju quadratic approximation for American options.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs Ju quadratic approximation engine.

QdPlusAmericanEngine

class pyquantlib.QdPlusAmericanEngine

Bases: PricingEngine

QD+ American option pricing engine.

__init__(process: GeneralizedBlackScholesProcess, interpolationPoints: SupportsInt | SupportsIndex = 8, solverType: QdPlusAmericanEngineSolverType = <QdPlusAmericanEngineSolverType.Halley: 3>, eps: SupportsFloat | SupportsIndex = 1e-06, maxIter: object = None) None

Constructs QD+ American engine.

class pyquantlib.QdPlusAmericanEngineSolverType

Bases: pybind11_object

Solver type for QD+ American engine.

Members:

Brent

Newton

Ridder

Halley

SuperHalley

__init__(value: SupportsInt | SupportsIndex) None
Brent = <QdPlusAmericanEngineSolverType.Brent: 0>
Halley = <QdPlusAmericanEngineSolverType.Halley: 3>
Newton = <QdPlusAmericanEngineSolverType.Newton: 1>
Ridder = <QdPlusAmericanEngineSolverType.Ridder: 2>
SuperHalley = <QdPlusAmericanEngineSolverType.SuperHalley: 4>
QdPlusAmericanEngineSolverType.name -> str
property value

AnalyticDigitalAmericanEngine

class pyquantlib.AnalyticDigitalAmericanEngine

Bases: PricingEngine

Analytic pricing engine for digital American options (knock-in).

__init__(process: GeneralizedBlackScholesProcess) None

Constructs analytic digital American engine.

AnalyticDigitalAmericanKOEngine

class pyquantlib.AnalyticDigitalAmericanKOEngine

Bases: AnalyticDigitalAmericanEngine

Analytic pricing engine for digital American options (knock-out).

__init__(process: GeneralizedBlackScholesProcess) None

Constructs analytic digital American knock-out engine.

MCDigitalEngine

pyquantlib.MCDigitalEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo digital option pricing engine.

AnalyticDividendEuropeanEngine

class pyquantlib.AnalyticDividendEuropeanEngine

Bases: PricingEngine

European engine with discrete dividends.

__init__(process: GeneralizedBlackScholesProcess, dividends: collections.abc.Sequence[base.Dividend]) None

Constructs analytic dividend European engine.

CashDividendEuropeanEngine

class pyquantlib.CashDividendEuropeanEngine

Bases: PricingEngine

Semi-analytic European engine with cash dividends (Healy, 2021).

__init__(process: GeneralizedBlackScholesProcess, dividends: collections.abc.Sequence[base.Dividend], cashDividendModel: CashDividendModel = <CashDividendModel.Spot: 0>) None

Constructs with process, dividend schedule, and model type.

class pyquantlib.CashDividendModel

Bases: pybind11_object

Cash dividend model type.

Members:

Spot : Spot dividend model.

Escrowed : Escrowed dividend model.

__init__(value: SupportsInt | SupportsIndex) None
Escrowed = <CashDividendModel.Escrowed: 1>
Spot = <CashDividendModel.Spot: 0>
CashDividendModel.name -> str
property value

Semi-analytic European engine with cash dividends (Healy, 2021). Supports Spot and Escrowed dividend models.

dividends = [ql.FixedDividend(2.0, ex_date)]
engine = ql.CashDividendEuropeanEngine(
    process, dividends, ql.CashDividendModel.Spot)

AnalyticBSMHullWhiteEngine

class pyquantlib.AnalyticBSMHullWhiteEngine

Bases: PricingEngine

BSM engine with Hull-White stochastic interest rates.

__init__(equityShortRateCorrelation: SupportsFloat | SupportsIndex, process: GeneralizedBlackScholesProcess, hullWhiteModel: HullWhite) None

Constructs BSM Hull-White engine.

Basket Engines

MCEuropeanBasketEngine

class pyquantlib.MCEuropeanBasketEngine

Bases: PricingEngine

Monte Carlo pricing engine for European basket options (pseudo-random).

__init__(process: StochasticProcessArray, timeSteps: SupportsInt | SupportsIndex = Null<NullSize>(), timeStepsPerYear: SupportsInt | SupportsIndex = Null<NullSize>(), brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: SupportsInt | SupportsIndex = Null<NullSize>(), requiredTolerance: SupportsFloat | SupportsIndex = Null<NullReal>(), maxSamples: SupportsInt | SupportsIndex = Null<NullSize>(), seed: SupportsInt | SupportsIndex = 0) None

Constructs MC European basket engine with pseudo-random numbers.

Fd2dBlackScholesVanillaEngine

class pyquantlib.Fd2dBlackScholesVanillaEngine

Bases: BasketOptionEngine

2D finite-difference Black-Scholes engine for basket options.

__init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex, xGrid: SupportsInt | SupportsIndex = 100, yGrid: SupportsInt | SupportsIndex = 100, tGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3c4770>, localVol: bool = False, illegalLocalVolOverwrite: SupportsFloat | SupportsIndex = -3.4028234663852886e+38) None

Constructs with two processes, correlation, and optional grid/scheme parameters.

KirkEngine

class pyquantlib.KirkEngine

Bases: SpreadBlackScholesVanillaEngine

Kirk engine for spread option pricing on two futures.

__init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex) None

Constructs with two Black-Scholes processes and correlation.

StulzEngine

class pyquantlib.StulzEngine

Bases: BasketOptionEngine

Stulz analytical engine for 2D min/max European basket options.

__init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex) None

Constructs with two Black-Scholes processes and correlation.

ChoiBasketEngine

class pyquantlib.ChoiBasketEngine

Bases: PricingEngine

Choi (2018) N-dimensional basket option engine.

__init__(processes: collections.abc.Sequence[GeneralizedBlackScholesProcess], rho: Matrix, lambda: typing.SupportsFloat | typing.SupportsIndex = 10.0, maxNrIntegrationSteps: typing.SupportsInt | typing.SupportsIndex = 18446744073709551615, calcfwdDelta: bool = False, controlVariate: bool = False) None

Constructs engine.

Choi (2018) analytic engine for average and spread basket options.

SingleFactorBsmBasketEngine

class pyquantlib.SingleFactorBsmBasketEngine

Bases: PricingEngine

Single-factor BSM basket option engine.

__init__(processes: collections.abc.Sequence[GeneralizedBlackScholesProcess], xTol: SupportsFloat | SupportsIndex = 2.220446049250313e-12) None

Constructs engine.

Single-factor BSM approximation for average basket options.

MCAmericanBasketEngine

pyquantlib.MCAmericanBasketEngine(process: StochasticProcessArray, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0, calibrationSamples: object = None, polynomialOrder: SupportsInt | SupportsIndex = 2) base.PricingEngine

Monte Carlo American basket option engine (Longstaff-Schwartz).

Monte Carlo American basket engine using Longstaff-Schwartz regression.

FdndimBlackScholesVanillaEngine

class pyquantlib.FdndimBlackScholesVanillaEngine

Bases: PricingEngine

N-dimensional finite-difference Black-Scholes basket engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(processes: collections.abc.Sequence[GeneralizedBlackScholesProcess], rho: Matrix, xGrids: collections.abc.Sequence[SupportsInt | SupportsIndex], tGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f2534369cb0>) -> None

Constructs with explicit per-dimension grid sizes.

  1. __init__(processes: collections.abc.Sequence[GeneralizedBlackScholesProcess], rho: Matrix, xGrid: SupportsInt | SupportsIndex, tGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3d07f0>) -> None

Constructs with auto-scaling grid sizes.

N-dimensional finite-difference Black-Scholes basket engine.

MCLDEuropeanBasketEngine

class pyquantlib.MCLDEuropeanBasketEngine

Bases: PricingEngine

Monte Carlo pricing engine for European basket options (low-discrepancy/Sobol).

__init__(process: StochasticProcessArray, timeSteps: SupportsInt | SupportsIndex = Null<NullSize>(), timeStepsPerYear: SupportsInt | SupportsIndex = Null<NullSize>(), brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: SupportsInt | SupportsIndex = Null<NullSize>(), requiredTolerance: SupportsFloat | SupportsIndex = Null<NullReal>(), maxSamples: SupportsInt | SupportsIndex = Null<NullSize>(), seed: SupportsInt | SupportsIndex = 0) None

Constructs MC European basket engine with low-discrepancy sequences.

Swaption Engines

BlackSwaptionEngine

class pyquantlib.BlackSwaptionEngine

Bases: PricingEngine

Shifted lognormal Black-formula swaption engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: base.YieldTermStructure, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs from constant volatility.

  1. __init__(discountCurve: base.YieldTermStructure, vol: base.Quote, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs from quote volatility.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs from constant volatility (handle).

  1. __init__(discountCurve: YieldTermStructureHandle, vol: QuoteHandle, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs from quote volatility (handle).

Black-formula (lognormal volatility) swaption engine.

engine = ql.BlackSwaptionEngine(curve, 0.20)
swaption.setPricingEngine(engine)
print(swaption.NPV())

BachelierSwaptionEngine

class pyquantlib.BachelierSwaptionEngine

Bases: PricingEngine

Normal Bachelier-formula swaption engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: base.YieldTermStructure, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs from constant normal volatility.

  1. __init__(discountCurve: base.YieldTermStructure, vol: base.Quote, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs from quote normal volatility.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs from constant normal volatility (handle).

  1. __init__(discountCurve: YieldTermStructureHandle, vol: QuoteHandle, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs from quote normal volatility (handle).

Bachelier (normal volatility) swaption engine.

engine = ql.BachelierSwaptionEngine(curve, 0.005)
swaption.setPricingEngine(engine)
print(swaption.NPV())

TreeSwaptionEngine

class pyquantlib.TreeSwaptionEngine

Bases: PricingEngine

Numerical lattice engine for swaptions.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: base.ShortRateModel, timeSteps: SupportsInt | SupportsIndex, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f253433f0b0>) -> None

Constructs tree engine with model and time steps.

  1. __init__(model: base.ShortRateModel, timeGrid: TimeGrid, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f25342181f0>) -> None

Constructs tree engine with model and time grid.

  1. __init__(model: ShortRateModelHandle, timeSteps: SupportsInt | SupportsIndex, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f253438f930>) -> None

Constructs tree engine with model handle and time steps.

  1. __init__(model: base.ShortRateModel, timeSteps: SupportsInt | SupportsIndex, termStructure: base.YieldTermStructure) -> None

Constructs tree engine with model, time steps, and term structure.

Numerical lattice engine for swaptions using short-rate models.

model = ql.HullWhite(curve, a=0.1, sigma=0.01)
engine = ql.TreeSwaptionEngine(model, timeSteps=100)
swaption.setPricingEngine(engine)

JamshidianSwaptionEngine

class pyquantlib.JamshidianSwaptionEngine

Bases: PricingEngine

Jamshidian swaption engine using bond option decomposition.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: base.OneFactorAffineModel, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f25341ff4f0>) -> None

Constructs Jamshidian engine with one-factor affine model.

  1. __init__(model: base.OneFactorAffineModel, termStructure: base.YieldTermStructure) -> None

Constructs Jamshidian engine with model and term structure.

Analytic swaption engine using Jamshidian’s bond option decomposition.

model = ql.HullWhite(curve, a=0.1, sigma=0.01)
engine = ql.JamshidianSwaptionEngine(model)
swaption.setPricingEngine(engine)

G2SwaptionEngine

class pyquantlib.G2SwaptionEngine

Bases: PricingEngine

Swaption engine for two-factor G2++ model.

__init__(model: G2, range: SupportsFloat | SupportsIndex, intervals: SupportsInt | SupportsIndex) None

Constructs G2 swaption engine with integration parameters.

Swaption engine for the G2++ two-factor model.

model = ql.G2(curve, a=0.1, sigma=0.01, b=0.1, eta=0.01, rho=-0.75)
engine = ql.G2SwaptionEngine(model, range=6.0, intervals=200)
swaption.setPricingEngine(engine)

FdHullWhiteSwaptionEngine

class pyquantlib.FdHullWhiteSwaptionEngine

Bases: PricingEngine

Finite-differences swaption engine for Hull-White model.

__init__(model: HullWhite, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, invEps: SupportsFloat | SupportsIndex = 1e-05, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253434fab0>) None

Constructs FD Hull-White swaption engine.

Finite-differences swaption engine for the Hull-White model.

model = ql.HullWhite(curve, a=0.1, sigma=0.01)
engine = ql.FdHullWhiteSwaptionEngine(model, tGrid=100, xGrid=100)
swaption.setPricingEngine(engine)

FdG2SwaptionEngine

class pyquantlib.FdG2SwaptionEngine

Bases: PricingEngine

Finite-differences swaption engine for G2++ two-factor model.

__init__(model: G2, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 50, yGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, invEps: SupportsFloat | SupportsIndex = 1e-05, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3c4af0>) None

Constructs FD G2 swaption engine.

Finite-differences swaption engine for the G2++ two-factor model.

model = ql.G2(curve, a=0.1, sigma=0.01, b=0.1, eta=0.01, rho=-0.75)
engine = ql.FdG2SwaptionEngine(model, tGrid=100, xGrid=50, yGrid=50)
swaption.setPricingEngine(engine)

Gaussian1dSwaptionEngine

class pyquantlib.Gaussian1dSwaptionEngine

Bases: PricingEngine

Gaussian 1-D swaption engine for Bermudan/European swaptions.

class Probabilities

Bases: pybind11_object

Probability adjustment type.

Members:

None_

Naive

Digital

__init__(value: SupportsInt | SupportsIndex) None
Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>
Gaussian1dSwaptionEngine.Probabilities.name -> str
property value
__init__(model: base.Gaussian1dModel, integrationPoints: SupportsInt | SupportsIndex = 64, stddevs: SupportsFloat | SupportsIndex = 7.0, extrapolatePayoff: bool = True, flatPayoffExtrapolation: bool = False, discountCurve: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f25341c2c70>, probabilities: Gaussian1dSwaptionEngine.Probabilities = <Probabilities.None_: 0>) None

Constructs Gaussian 1-D swaption engine.

Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>

Gaussian 1-D model swaption engine with numerical integration. Supports European and Bermudan exercise.

model = ql.Gsr(curve, [ql.Date(15, 1, 2025)], [0.01], 0.01)
engine = ql.Gaussian1dSwaptionEngine(model, integrationPoints=64)
swaption.setPricingEngine(engine)
print(swaption.NPV())

Gaussian1dJamshidianSwaptionEngine

class pyquantlib.Gaussian1dJamshidianSwaptionEngine

Bases: PricingEngine

Gaussian 1-D Jamshidian swaption engine (analytic decomposition).

__init__(model: base.Gaussian1dModel) None

Constructs Jamshidian swaption engine.

Jamshidian decomposition swaption engine for Gaussian 1-D models. European exercise only.

engine = ql.Gaussian1dJamshidianSwaptionEngine(model)
swaption.setPricingEngine(engine)

Gaussian1dNonstandardSwaptionEngine

class pyquantlib.Gaussian1dNonstandardSwaptionEngine

Bases: PricingEngine

Gaussian 1-D engine for nonstandard swaptions.

class Probabilities

Bases: pybind11_object

Probability adjustment type.

Members:

None_

Naive

Digital

__init__(value: SupportsInt | SupportsIndex) None
Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>
Gaussian1dNonstandardSwaptionEngine.Probabilities.name -> str
property value
__init__(model: base.Gaussian1dModel, integrationPoints: SupportsInt | SupportsIndex = 64, stddevs: SupportsFloat | SupportsIndex = 7.0, extrapolatePayoff: bool = True, flatPayoffExtrapolation: bool = False, oas: QuoteHandle = <QuoteHandle object at 0x7f252f3d51f0>, discountCurve: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f252f3f0db0>, probabilities: Gaussian1dNonstandardSwaptionEngine.Probabilities = <Probabilities.None_: 0>) None

Constructs Gaussian 1-D nonstandard swaption engine.

Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>

Gaussian 1-D model engine for nonstandard swaptions (period-varying notionals and strikes).

Gaussian1dFloatFloatSwaptionEngine

class pyquantlib.Gaussian1dFloatFloatSwaptionEngine

Bases: PricingEngine

Gaussian 1-D engine for float-float swaptions.

class Probabilities

Bases: pybind11_object

Probability adjustment type.

Members:

None_

Naive

Digital

__init__(value: SupportsInt | SupportsIndex) None
Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>
Gaussian1dFloatFloatSwaptionEngine.Probabilities.name -> str
property value
__init__(model: base.Gaussian1dModel, integrationPoints: SupportsInt | SupportsIndex = 64, stddevs: SupportsFloat | SupportsIndex = 7.0, extrapolatePayoff: bool = True, flatPayoffExtrapolation: bool = False, oas: QuoteHandle = <QuoteHandle object at 0x7f25341ffeb0>, discountCurve: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f2534e63e30>, includeTodaysExercise: bool = False, probabilities: Gaussian1dFloatFloatSwaptionEngine.Probabilities = <Probabilities.None_: 0>) None

Constructs Gaussian 1-D float-float swaption engine.

Digital = <Probabilities.Digital: 2>
Naive = <Probabilities.Naive: 1>
None_ = <Probabilities.None_: 0>

Gaussian 1-D model engine for float-float swaptions.

Barrier Engines

AnalyticBarrierEngine

class pyquantlib.AnalyticBarrierEngine

Bases: PricingEngine

Analytic barrier option engine (Haug).

__init__(process: GeneralizedBlackScholesProcess) None

Constructs AnalyticBarrierEngine.

Analytic pricing using Haug’s formulas.

engine = ql.AnalyticBarrierEngine(process)

AnalyticDoubleBarrierEngine

class pyquantlib.AnalyticDoubleBarrierEngine

Bases: PricingEngine

Analytic double barrier option engine (Ikeda-Kunitomo).

__init__(process: GeneralizedBlackScholesProcess, series: SupportsInt | SupportsIndex = 5) None

Constructs AnalyticDoubleBarrierEngine.

Analytic double barrier engine using Ikeda-Kunitomo series.

engine = ql.AnalyticDoubleBarrierEngine(process, series=5)

FdBlackScholesBarrierEngine

class pyquantlib.FdBlackScholesBarrierEngine

Bases: PricingEngine

Finite-differences Black-Scholes barrier option engine.

__init__(process: GeneralizedBlackScholesProcess, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253438fe30>, localVol: bool = False, illegalLocalVolOverwrite: SupportsFloat | SupportsIndex = -3.4028234663852886e+38) None

Constructs FdBlackScholesBarrierEngine.

Finite-differences barrier option engine.

engine = ql.FdBlackScholesBarrierEngine(process, tGrid=100, xGrid=100)

FdBlackScholesRebateEngine

class pyquantlib.FdBlackScholesRebateEngine

Bases: PricingEngine

Finite-differences Black-Scholes barrier option rebate engine.

__init__(process: GeneralizedBlackScholesProcess, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253436bbb0>, localVol: bool = False, illegalLocalVolOverwrite: SupportsFloat | SupportsIndex = -3.4028234663852886e+38) None

Constructs FdBlackScholesRebateEngine.

Finite-differences rebate engine for barrier options.

engine = ql.FdBlackScholesRebateEngine(process, tGrid=100, xGrid=100)

AnalyticDoubleBarrierBinaryEngine

class pyquantlib.AnalyticDoubleBarrierBinaryEngine

Bases: PricingEngine

Analytic double barrier binary (one-touch) option engine (Hui).

__init__(process: GeneralizedBlackScholesProcess) None

Constructs AnalyticDoubleBarrierBinaryEngine.

Analytic double barrier binary (one-touch) option engine (Hui).

engine = ql.AnalyticDoubleBarrierBinaryEngine(process)

MCBarrierEngine

pyquantlib.MCBarrierEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, isBiased: bool = False, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo barrier option pricing engine.

Uses Brownian-bridge correction for the barrier by default. Set isBiased=True for the simpler (biased) path pricer.

Monte Carlo barrier option engine with optional Brownian bridge bias correction.

engine = ql.MCBarrierEngine(
    process, timeSteps=50, requiredSamples=10000, seed=42,
)

MCDoubleBarrierEngine

pyquantlib.MCDoubleBarrierEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', timeSteps: object = None, timeStepsPerYear: object = None, brownianBridge: bool = False, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo double barrier option pricing engine.

Monte Carlo double barrier option engine.

engine = ql.MCDoubleBarrierEngine(
    process, timeSteps=50, requiredSamples=10000, seed=42,
)

AnalyticBinaryBarrierEngine

class pyquantlib.AnalyticBinaryBarrierEngine

Bases: PricingEngine

Analytic binary barrier option engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

Analytic binary (one-touch) barrier option engine.

BinomialBarrierEngine

pyquantlib.BinomialBarrierEngine(process: GeneralizedBlackScholesProcess, treeType: str, timeSteps: SupportsInt | SupportsIndex, maxTimeSteps: SupportsInt | SupportsIndex = 0, discretization: str = 'default') base.PricingEngine

Binomial tree barrier option engine.

Parameters:
  • treeType – jr, crr, eqp, trigeorgis, tian, lr, joshi

  • discretization – ‘default’ or ‘dermankani’

Binomial tree barrier engine with configurable tree type and discretization.

engine = ql.BinomialBarrierEngine(process, "crr", 200)
engine = ql.BinomialBarrierEngine(process, "crr", 200, discretization="dermankani")

FdHestonBarrierEngine

class pyquantlib.FdHestonBarrierEngine

Bases: PricingEngine

Finite-difference Heston barrier option engine.

__init__(model: HestonModel, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341d0a30>) None

Constructs engine.

Finite-difference Heston barrier option engine.

FdHestonDoubleBarrierEngine

class pyquantlib.FdHestonDoubleBarrierEngine

Bases: PricingEngine

Finite-difference Heston double barrier option engine.

__init__(model: HestonModel, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25343499f0>) None

Constructs engine.

Finite-difference Heston double barrier option engine.

FdHestonRebateEngine

class pyquantlib.FdHestonRebateEngine

Bases: PricingEngine

Finite-difference Heston rebate engine.

__init__(model: HestonModel, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, vGrid: SupportsInt | SupportsIndex = 50, dampingSteps: SupportsInt | SupportsIndex = 0, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3c62b0>) None

Constructs engine.

Finite-difference Heston rebate engine for barrier options.

AnalyticPartialTimeBarrierOptionEngine

class pyquantlib.AnalyticPartialTimeBarrierOptionEngine

Bases: PricingEngine

Analytic partial-time barrier option engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

Analytic engine for partial-time barrier options (Heynen-Kat).

AnalyticSoftBarrierEngine

class pyquantlib.AnalyticSoftBarrierEngine

Bases: PricingEngine

Analytic soft barrier option engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

Analytic engine for soft barrier options.

AnalyticTwoAssetBarrierEngine

class pyquantlib.AnalyticTwoAssetBarrierEngine

Bases: PricingEngine

Analytic two-asset barrier option engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, rho: QuoteHandle) -> None

Constructs engine with two processes and correlation.

  1. __init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, rho: base.Quote) -> None

Constructs engine (handle created internally).

Analytic engine for two-asset barrier options.

Asian Engines

AnalyticContinuousGeometricAveragePriceAsianEngine

class pyquantlib.AnalyticContinuousGeometricAveragePriceAsianEngine

Bases: PricingEngine

Analytic continuous geometric average price Asian engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

AnalyticDiscreteGeometricAveragePriceAsianEngine

class pyquantlib.AnalyticDiscreteGeometricAveragePriceAsianEngine

Bases: PricingEngine

Analytic discrete geometric average price Asian engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

TurnbullWakemanAsianEngine

class pyquantlib.TurnbullWakemanAsianEngine

Bases: PricingEngine

Turnbull-Wakeman moment-matching discrete arithmetic Asian engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs TurnbullWakemanAsianEngine.

Moment-matching approximation for discrete arithmetic average price Asian options.

engine = ql.TurnbullWakemanAsianEngine(process)

MCDiscreteArithmeticAPEngine

class pyquantlib.MCDiscreteArithmeticAPEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', brownianBridge: bool = True, antitheticVariate: bool = False, controlVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Bases:

Monte Carlo discrete arithmetic average price Asian engine.

Monte Carlo engine for discrete arithmetic average price Asian options.

engine = ql.MCDiscreteArithmeticAPEngine(
    process, requiredSamples=100000, seed=42, controlVariate=True,
)

ChoiAsianEngine

class pyquantlib.ChoiAsianEngine

Bases: PricingEngine

Choi (2018) discrete arithmetic Asian option engine.

__init__(process: GeneralizedBlackScholesProcess, lambda: SupportsFloat | SupportsIndex = 15.0, maxNrIntegrationSteps: SupportsInt | SupportsIndex = 4194304) None

Constructs engine.

Choi (2018) analytic discrete arithmetic Asian engine.

AnalyticDiscreteGeometricAverageStrikeAsianEngine

class pyquantlib.AnalyticDiscreteGeometricAverageStrikeAsianEngine

Bases: PricingEngine

Analytic discrete geometric average strike Asian engine.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs engine.

ContinuousArithmeticAsianLevyEngine

class pyquantlib.ContinuousArithmeticAsianLevyEngine

Bases: PricingEngine

Levy (1992) continuous arithmetic Asian engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcess, currentAverage: QuoteHandle) -> None

Constructs engine with process and current running average.

  1. __init__(process: GeneralizedBlackScholesProcess, currentAverage: base.Quote) -> None

Constructs engine (handle created internally).

Levy (1992) continuous arithmetic average price Asian engine.

FdBlackScholesAsianEngine

class pyquantlib.FdBlackScholesAsianEngine

Bases: PricingEngine

Finite-difference Black-Scholes discrete Asian engine.

__init__(process: GeneralizedBlackScholesProcess, tGrid: SupportsInt | SupportsIndex = 100, xGrid: SupportsInt | SupportsIndex = 100, aGrid: SupportsInt | SupportsIndex = 50, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3f3a30>) None

Constructs engine.

Finite-difference Black-Scholes engine for discrete Asian options.

MCDiscreteArithmeticASEngine

pyquantlib.MCDiscreteArithmeticASEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', brownianBridge: bool = True, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo discrete arithmetic average strike Asian engine.

Monte Carlo discrete arithmetic average strike Asian engine.

MCDiscreteGeometricAPEngine

pyquantlib.MCDiscreteGeometricAPEngine(process: GeneralizedBlackScholesProcess, rngType: str = 'pseudorandom', brownianBridge: bool = True, antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0) base.PricingEngine

Monte Carlo discrete geometric average price Asian engine.

Monte Carlo discrete geometric average price Asian engine.

MCDiscreteArithmeticAPHestonEngine

pyquantlib.MCDiscreteArithmeticAPHestonEngine(process: HestonProcess, rngType: str = 'pseudorandom', antitheticVariate: bool = False, controlVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0, timeSteps: object = None, timeStepsPerYear: object = None) base.PricingEngine

Monte Carlo discrete arithmetic average price Asian engine (Heston).

Monte Carlo discrete arithmetic Asian engine under Heston dynamics.

MCDiscreteGeometricAPHestonEngine

pyquantlib.MCDiscreteGeometricAPHestonEngine(process: HestonProcess, rngType: str = 'pseudorandom', antitheticVariate: bool = False, requiredSamples: object = None, requiredTolerance: object = None, maxSamples: object = None, seed: SupportsInt | SupportsIndex = 0, timeSteps: object = None, timeStepsPerYear: object = None) base.PricingEngine

Monte Carlo discrete geometric average price Asian engine (Heston).

Monte Carlo discrete geometric Asian engine under Heston dynamics.

Lookback Engines

AnalyticContinuousFloatingLookbackEngine

class pyquantlib.AnalyticContinuousFloatingLookbackEngine

Bases: PricingEngine

Analytic engine for continuous floating-strike lookback options.

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticContinuousFixedLookbackEngine

class pyquantlib.AnalyticContinuousFixedLookbackEngine

Bases: PricingEngine

Analytic engine for continuous fixed-strike lookback options.

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticContinuousPartialFloatingLookbackEngine

class pyquantlib.AnalyticContinuousPartialFloatingLookbackEngine

Bases: PricingEngine

Analytic engine for continuous partial floating-strike lookback options.

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticContinuousPartialFixedLookbackEngine

class pyquantlib.AnalyticContinuousPartialFixedLookbackEngine

Bases: PricingEngine

Analytic engine for continuous partial fixed-strike lookback options.

__init__(process: GeneralizedBlackScholesProcess) None
payoff = ql.FloatingTypePayoff(ql.Call)
exercise = ql.EuropeanExercise(expiry)
option = ql.ContinuousFloatingLookbackOption(100.0, payoff, exercise)
option.setPricingEngine(ql.AnalyticContinuousFloatingLookbackEngine(process))
print(option.NPV())

Cliquet Engines

AnalyticCliquetEngine

class pyquantlib.AnalyticCliquetEngine

Bases: PricingEngine

Analytic engine for cliquet options.

__init__(process: GeneralizedBlackScholesProcess) None
engine = ql.AnalyticCliquetEngine(process)
cliquet.setPricingEngine(engine)
print(cliquet.NPV())

Exotic Engines

AnalyticCompoundOptionEngine

class pyquantlib.AnalyticCompoundOptionEngine

Bases: PricingEngine

Analytic engine for compound options (option on an option).

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticSimpleChooserEngine

class pyquantlib.AnalyticSimpleChooserEngine

Bases: PricingEngine

Analytic engine for simple chooser options.

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticComplexChooserEngine

class pyquantlib.AnalyticComplexChooserEngine

Bases: PricingEngine

Analytic engine for complex chooser options.

__init__(process: GeneralizedBlackScholesProcess) None

AnalyticEuropeanMargrabeEngine

class pyquantlib.AnalyticEuropeanMargrabeEngine

Bases: PricingEngine

Analytic engine for European exchange (Margrabe) options.

__init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex) None

Takes two Black-Scholes-Merton processes and a correlation parameter.

engine = ql.AnalyticEuropeanMargrabeEngine(process1, process2, 0.5)
option.setPricingEngine(engine)

AnalyticAmericanMargrabeEngine

class pyquantlib.AnalyticAmericanMargrabeEngine

Bases: PricingEngine

Analytic engine for American exchange (Margrabe) options.

__init__(process1: GeneralizedBlackScholesProcess, process2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex) None

Forward-Start Engines

ForwardEuropeanEngine

class pyquantlib.ForwardEuropeanEngine

Bases: PricingEngine

Forward-start European option engine (Black-Scholes).

__init__(process: GeneralizedBlackScholesProcess) None

ForwardPerformanceEuropeanEngine

class pyquantlib.ForwardPerformanceEuropeanEngine

Bases: PricingEngine

Forward-start performance European option engine.

__init__(process: GeneralizedBlackScholesProcess) None
option = ql.ForwardVanillaOption(1.0, reset_date, payoff, exercise)
option.setPricingEngine(ql.ForwardEuropeanEngine(process))
print(option.NPV())

Quanto Engines

QuantoVanillaEngine

class pyquantlib.QuantoVanillaEngine

Bases: PricingEngine

Quanto European option engine (currency-adjusted Black-Scholes).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcess, foreignRiskFreeRate: YieldTermStructureHandle, exchangeRateVolatility: BlackVolTermStructureHandle, correlation: QuoteHandle) -> None

  2. __init__(process: GeneralizedBlackScholesProcess, foreignRiskFreeRate: base.YieldTermStructure, exchangeRateVolatility: base.BlackVolTermStructure, correlation: base.Quote) -> None

Constructs from shared_ptr objects (handles created internally).

Quanto European option engine (currency-adjusted Black-Scholes). Accepts explicit Handle arguments or raw objects (hidden handles).

engine = ql.QuantoVanillaEngine(
    process, foreign_rate, fx_vol, correlation,
)
option.setPricingEngine(engine)
print(option.NPV(), option.qvega(), option.qrho(), option.qlambda())

Cap/Floor Engines

BlackCapFloorEngine

class pyquantlib.BlackCapFloorEngine

Bases: PricingEngine

Black-formula cap/floor engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs with flat volatility (handle).

  1. __init__(discountCurve: base.YieldTermStructure, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs with flat volatility.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: QuoteHandle, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs with quote volatility (handle).

  1. __init__(discountCurve: base.YieldTermStructure, vol: base.Quote, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>, displacement: SupportsFloat | SupportsIndex = 0.0) -> None

Constructs with quote volatility.

Black-formula cap/floor engine (lognormal volatility).

engine = ql.BlackCapFloorEngine(curve, 0.20)
cap.setPricingEngine(engine)
print(cap.NPV())

BachelierCapFloorEngine

class pyquantlib.BachelierCapFloorEngine

Bases: PricingEngine

Bachelier (normal) cap/floor engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs with flat normal volatility (handle).

  1. __init__(discountCurve: base.YieldTermStructure, vol: SupportsFloat | SupportsIndex, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs with flat normal volatility.

  1. __init__(discountCurve: YieldTermStructureHandle, vol: QuoteHandle, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs with quote normal volatility (handle).

  1. __init__(discountCurve: base.YieldTermStructure, vol: base.Quote, dayCounter: DayCounter = <DayCounter: Actual/365 (Fixed)>) -> None

Constructs with quote normal volatility.

Bachelier (normal volatility) cap/floor engine.

engine = ql.BachelierCapFloorEngine(curve, 0.005)
cap.setPricingEngine(engine)
print(cap.NPV())

AnalyticCapFloorEngine

class pyquantlib.AnalyticCapFloorEngine

Bases: PricingEngine

Analytic cap/floor engine for affine short-rate models.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: base.AffineModel, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f25341c1ef0>) -> None

Constructs analytic cap/floor engine.

  1. __init__(model: base.AffineModel, termStructure: base.YieldTermStructure) -> None

Constructs analytic cap/floor engine (handle created internally).

Analytic cap/floor engine for affine short-rate models (Hull-White, CIR, G2++).

TreeCapFloorEngine

class pyquantlib.TreeCapFloorEngine

Bases: PricingEngine

Lattice cap/floor engine for short-rate models.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: base.ShortRateModel, timeSteps: SupportsInt | SupportsIndex, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f252f3d1cf0>) -> None

Constructs tree cap/floor engine with time steps.

  1. __init__(model: base.ShortRateModel, timeGrid: TimeGrid, termStructure: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f2534de3f30>) -> None

Constructs tree cap/floor engine with time grid.

  1. __init__(model: base.ShortRateModel, timeSteps: SupportsInt | SupportsIndex, termStructure: base.YieldTermStructure) -> None

Constructs tree cap/floor engine (handle created internally).

Lattice-based cap/floor engine for short-rate models.

Gaussian1dCapFloorEngine

class pyquantlib.Gaussian1dCapFloorEngine

Bases: PricingEngine

Gaussian 1-D cap/floor pricing engine.

__init__(model: base.Gaussian1dModel, integrationPoints: SupportsInt | SupportsIndex = 64, stddevs: SupportsFloat | SupportsIndex = 7.0, extrapolatePayoff: bool = True, flatPayoffExtrapolation: bool = False, discountCurve: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f2534e7edf0>) None

Constructs Gaussian 1-D cap/floor engine.

Gaussian 1-D model cap/floor engine with numerical integration.

model = ql.Gsr(curve, [ql.Date(15, 1, 2025)], [0.01], 0.01)
engine = ql.Gaussian1dCapFloorEngine(model, integrationPoints=64)
cap.setPricingEngine(engine)
print(cap.NPV())

YoY Inflation Cap/Floor Engines

YoYInflationBlackCapFloorEngine

class pyquantlib.YoYInflationBlackCapFloorEngine

Bases: PricingEngine

Black-formula engine for YoY inflation cap/floor.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(index: YoYInflationIndex, volatility: YoYOptionletVolatilitySurfaceHandle, nominalTermStructure: YieldTermStructureHandle) -> None

Constructs a Black YoY inflation cap/floor engine.

  1. __init__(index: YoYInflationIndex, volatility: base.YoYOptionletVolatilitySurface, nominalTermStructure: YieldTermStructureHandle) -> None

Constructs with vol surface (handle created internally).

  1. __init__(index: YoYInflationIndex, volatility: YoYOptionletVolatilitySurfaceHandle, nominalTermStructure: base.YieldTermStructure) -> None

Constructs with nominal curve (handle created internally).

  1. __init__(index: YoYInflationIndex, volatility: base.YoYOptionletVolatilitySurface, nominalTermStructure: base.YieldTermStructure) -> None

Constructs with both handles created internally.

Black-formula engine for YoY inflation caps and floors (lognormal volatility).

engine = ql.YoYInflationBlackCapFloorEngine(yoy_index, yoy_vol_handle, curve_handle)
cap.setPricingEngine(engine)
print(cap.NPV())

YoYInflationUnitDisplacedBlackCapFloorEngine

class pyquantlib.YoYInflationUnitDisplacedBlackCapFloorEngine

Bases: PricingEngine

Unit-displaced Black engine for YoY inflation cap/floor.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(index: YoYInflationIndex, volatility: YoYOptionletVolatilitySurfaceHandle, nominalTermStructure: YieldTermStructureHandle) -> None

Constructs a unit-displaced Black YoY inflation cap/floor engine.

  1. __init__(index: YoYInflationIndex, volatility: base.YoYOptionletVolatilitySurface, nominalTermStructure: base.YieldTermStructure) -> None

Constructs with both handles created internally.

Unit-displaced Black-formula engine for YoY inflation caps and floors.

YoYInflationBachelierCapFloorEngine

class pyquantlib.YoYInflationBachelierCapFloorEngine

Bases: PricingEngine

Bachelier (normal) engine for YoY inflation cap/floor.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(index: YoYInflationIndex, volatility: YoYOptionletVolatilitySurfaceHandle, nominalTermStructure: YieldTermStructureHandle) -> None

Constructs a Bachelier YoY inflation cap/floor engine.

  1. __init__(index: YoYInflationIndex, volatility: base.YoYOptionletVolatilitySurface, nominalTermStructure: base.YieldTermStructure) -> None

Constructs with both handles created internally.

Bachelier (normal volatility) engine for YoY inflation caps and floors.

Bond Engines

DiscountingBondEngine

class pyquantlib.DiscountingBondEngine

Bases: engine

Discounting engine for bonds.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: YieldTermStructureHandle = <YieldTermStructureHandle object at 0x7f252f3f26b0>, includeSettlementDateFlows: bool | None = None) -> None

Constructs discounting bond engine.

  1. __init__(discountCurve: base.YieldTermStructure, includeSettlementDateFlows: bool | None = None) -> None

Constructs discounting bond engine from term structure.

discountCurve() YieldTermStructureHandle

Returns the discount curve handle.

engine = ql.DiscountingBondEngine(curve_handle)
bond.setPricingEngine(engine)
print(bond.cleanPrice())

Convertible Bond Engines

BinomialConvertibleEngine

class pyquantlib.BinomialConvertibleEngine(*args, **kwargs)

Bases:

Overloaded function.

  1. BinomialConvertibleEngine(process: GeneralizedBlackScholesProcess, treeType: str, timeSteps: SupportsInt | SupportsIndex, creditSpread: base.Quote, dividends: collections.abc.Sequence[base.Dividend] = []) -> base.PricingEngine

Binomial Tsiveriotis-Fernandes engine for convertible bonds.

Parameters:
  • process – Black-Scholes process for the underlying equity

  • treeType – Tree type - one of: ‘jr’ or ‘jarrowrudd’: Jarrow-Rudd ‘crr’ or ‘coxrossrubinstein’: Cox-Ross-Rubinstein ‘eqp’ or ‘additiveeqp’: Additive equal probabilities ‘trigeorgis’: Trigeorgis ‘tian’: Tian ‘lr’ or ‘leisenreimer’: Leisen-Reimer ‘joshi’ or ‘joshi4’: Joshi

  • timeSteps – Number of time steps

  • creditSpread – Credit spread quote

  • dividends – Dividend schedule (optional)

  1. BinomialConvertibleEngine(process: GeneralizedBlackScholesProcess, treeType: str, timeSteps: SupportsInt | SupportsIndex, creditSpread: QuoteHandle, dividends: collections.abc.Sequence[base.Dividend] = []) -> base.PricingEngine

Binomial Tsiveriotis-Fernandes engine for convertible bonds (Handle version).

Tsiveriotis-Fernandes binomial lattice engine for convertible bonds.

engine = ql.BinomialConvertibleEngine(process, "crr", 801)
bond.setPricingEngine(engine)
print(bond.NPV())

Tree types: jr, crr, eqp, trigeorgis, tian, lr, joshi

Also accepts an optional creditSpread parameter:

engine = ql.BinomialConvertibleEngine(process, "crr", 801, creditSpread=spread)

Credit Engines

MidPointCdsEngine

class pyquantlib.MidPointCdsEngine

Bases: PricingEngine

Mid-point engine for credit default swaps.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(probability: DefaultProbabilityTermStructureHandle, recoveryRate: SupportsFloat | SupportsIndex, discountCurve: YieldTermStructureHandle, includeSettlementDateFlows: bool | None = None) -> None

Constructs from handles.

  1. __init__(probability: base.DefaultProbabilityTermStructure, recoveryRate: SupportsFloat | SupportsIndex, discountCurve: base.YieldTermStructure, includeSettlementDateFlows: bool | None = None) -> None

Constructs from term structures (handles created internally).

Mid-point CDS pricing engine.

engine = ql.MidPointCdsEngine(default_curve, 0.4, discount_curve)
cds.setPricingEngine(engine)
print(cds.NPV())

IsdaCdsEngine

class pyquantlib.IsdaCdsEngine

Bases: PricingEngine

ISDA-compliant CDS engine.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(probability: DefaultProbabilityTermStructureHandle, recoveryRate: SupportsFloat | SupportsIndex, discountCurve: YieldTermStructureHandle, includeSettlementDateFlows: bool | None = None, numericalFix: IsdaNumericalFix = <IsdaNumericalFix.Taylor: 1>, accrualBias: IsdaAccrualBias = <IsdaAccrualBias.HalfDayBias: 0>, forwardsInCouponPeriod: IsdaForwardsInCouponPeriod = <IsdaForwardsInCouponPeriod.Piecewise: 1>) -> None

Constructs from handles.

  1. __init__(probability: base.DefaultProbabilityTermStructure, recoveryRate: SupportsFloat | SupportsIndex, discountCurve: base.YieldTermStructure, includeSettlementDateFlows: bool | None = None, numericalFix: IsdaNumericalFix = <IsdaNumericalFix.Taylor: 1>, accrualBias: IsdaAccrualBias = <IsdaAccrualBias.HalfDayBias: 0>, forwardsInCouponPeriod: IsdaForwardsInCouponPeriod = <IsdaForwardsInCouponPeriod.Piecewise: 1>) -> None

Constructs from term structures (handles created internally).

isdaCreditCurve() DefaultProbabilityTermStructureHandle

ISDA credit curve.

isdaRateCurve() YieldTermStructureHandle

ISDA rate curve.

ISDA-standard CDS pricing engine.

engine = ql.IsdaCdsEngine(default_curve, 0.4, discount_curve)
cds.setPricingEngine(engine)
print(cds.NPV())

Enum

Values

IsdaNumericalFix

IsdaNone, Taylor

IsdaAccrualBias

HalfDayBias, NoBias

IsdaForwardsInCouponPeriod

Flat, Piecewise

Swap Engines

DiscountingSwapEngine

class pyquantlib.DiscountingSwapEngine

Bases: engine

Discounting engine for swaps.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(discountCurve: YieldTermStructureHandle, includeSettlementDateFlows: bool | None = None, settlementDate: Date = <Date: null date>, npvDate: Date = <Date: null date>) -> None

Constructs discounting swap engine.

  1. __init__(discountCurve: base.YieldTermStructure, includeSettlementDateFlows: bool | None = None, settlementDate: Date = <Date: null date>, npvDate: Date = <Date: null date>) -> None

Constructs discounting swap engine from term structure.

discountCurve() YieldTermStructureHandle

Returns the discount curve handle.

Bond Functions

BondFunctions

class pyquantlib.BondFunctions

Bases: pybind11_object

Static bond analytics functions.

static accrualDays(bond: Bond, settlementDate: Date = <Date: null date>) int

Accrual days.

static accrualEndDate(bond: Bond, settlementDate: Date = <Date: null date>) Date

Accrual end date.

static accrualPeriod(bond: Bond, settlementDate: Date = <Date: null date>) float

Accrual period as a year fraction.

static accrualStartDate(bond: Bond, settlementDate: Date = <Date: null date>) Date

Accrual start date.

static accruedAmount(bond: Bond, settlementDate: Date = <Date: null date>) float

Accrued amount.

static accruedDays(bond: Bond, settlementDate: Date = <Date: null date>) int

Accrued days.

static accruedPeriod(bond: Bond, settlementDate: Date = <Date: null date>) float

Accrued period as a year fraction.

static basisPointValue(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>) float

Basis point value (DV01).

static bondYield(bond: Bond, price: BondPrice, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>, accuracy: SupportsFloat | SupportsIndex = 1e-10, maxIterations: SupportsInt | SupportsIndex = 100, guess: SupportsFloat | SupportsIndex = 0.05) float

Bond yield (IRR) from price.

static bps(bond: Bond, discountCurve: base.YieldTermStructure, settlementDate: Date = <Date: null date>) float

Basis point sensitivity from discount curve.

static cleanPrice(bond: Bond, discountCurve: base.YieldTermStructure, settlementDate: Date = <Date: null date>) float

Clean price from discount curve.

static cleanPriceFromYield(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>) float

Clean price from yield.

static convexity(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>) float

Bond convexity.

static dirtyPrice(bond: Bond, discountCurve: base.YieldTermStructure, settlementDate: Date = <Date: null date>) float

Dirty price from discount curve.

static dirtyPriceFromYield(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>) float

Dirty price from yield.

static duration(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, type: DurationType = <DurationType.Modified: 2>, settlementDate: Date = <Date: null date>) float

Bond duration.

static isTradable(bond: Bond, settlementDate: Date = <Date: null date>) bool

Whether the bond is tradable at the given date.

static maturityDate(bond: Bond) Date

Maturity date of the bond.

static nextCashFlowAmount(bond: Bond, refDate: Date = <Date: null date>) float

Amount of the next cash flow.

static nextCashFlowDate(bond: Bond, refDate: Date = <Date: null date>) Date

Date of the next cash flow.

static nextCouponRate(bond: Bond, settlementDate: Date = <Date: null date>) float

Next coupon rate.

static previousCashFlowAmount(bond: Bond, refDate: Date = <Date: null date>) float

Amount of the previous cash flow.

static previousCashFlowDate(bond: Bond, refDate: Date = <Date: null date>) Date

Date of the previous cash flow.

static previousCouponRate(bond: Bond, settlementDate: Date = <Date: null date>) float

Previous coupon rate.

static startDate(bond: Bond) Date

Start date of the bond.

static yieldValueBasisPoint(bond: Bond, yield: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>) float

Yield value of a basis point.

static zSpread(bond: Bond, price: BondPrice, discountCurve: base.YieldTermStructure, dayCounter: DayCounter, compounding: Compounding, frequency: Frequency, settlementDate: Date = <Date: null date>, accuracy: SupportsFloat | SupportsIndex = 1e-10, maxIterations: SupportsInt | SupportsIndex = 100, guess: SupportsFloat | SupportsIndex = 0.0) float

Z-spread over a discount curve.

__init__(*args, **kwargs)

Static functions for bond analytics.

Function

Description

cleanPrice(bond, rate)

Clean price from yield

dirtyPrice(bond, rate)

Dirty price from yield

bps(bond, rate)

Basis point sensitivity

bondYield(bond, cleanPrice, dc, comp, freq)

Yield from clean price

duration(bond, rate, type)

Duration (Modified, Macaulay, or Simple)

convexity(bond, rate)

Convexity

basisPointValue(bond, rate)

Basis point value

yieldValueBasisPoint(bond, rate)

Yield value of a basis point

zSpread(bond, cleanPrice, curve, dc, comp, freq)

Z-spread

rate = ql.InterestRate(0.05, ql.Actual365Fixed(), ql.Compounded, ql.Annual)
print(ql.BondFunctions.cleanPrice(bond, rate))
print(ql.BondFunctions.duration(bond, rate, ql.DurationType.Modified))
print(ql.BondFunctions.convexity(bond, rate))

Variance Swap Engines

ReplicatingVarianceSwapEngine

class pyquantlib.ReplicatingVarianceSwapEngine

Bases: PricingEngine

Variance swap engine using replicating portfolio.

__init__(process: GeneralizedBlackScholesProcess, dk: SupportsFloat | SupportsIndex = 5.0, callStrikes: collections.abc.Sequence[SupportsFloat | SupportsIndex] = [], putStrikes: collections.abc.Sequence[SupportsFloat | SupportsIndex] = []) None

Constructs the replicating variance swap engine.

Calculators

BlackCalculator

class pyquantlib.BlackCalculator

Bases: pybind11_object

Black 1976 calculator for option pricing and Greeks.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(payoff: base.StrikedTypePayoff, forward: SupportsFloat | SupportsIndex, stdDev: SupportsFloat | SupportsIndex, discount: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from payoff, forward, stdDev, and discount.

  1. __init__(optionType: OptionType, strike: SupportsFloat | SupportsIndex, forward: SupportsFloat | SupportsIndex, stdDev: SupportsFloat | SupportsIndex, discount: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from option type, strike, forward, stdDev, and discount.

alpha() float

Returns alpha.

beta() float

Returns beta.

delta(spot: SupportsFloat | SupportsIndex) float

Sensitivity to change in the underlying spot price.

deltaForward() float

Sensitivity to change in the underlying forward price.

dividendRho(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to dividend/growth rate.

elasticity(spot: SupportsFloat | SupportsIndex) float

Percent sensitivity to percent change in spot price.

elasticityForward() float

Percent sensitivity to percent change in forward price.

gamma(spot: SupportsFloat | SupportsIndex) float

Second order derivative w.r.t. spot price.

gammaForward() float

Second order derivative w.r.t. forward price.

itmAssetProbability() float

Probability of being ITM in asset martingale measure, N(d1).

itmCashProbability() float

Probability of being ITM in bond martingale measure, N(d2).

rho(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to discounting rate.

strikeGamma() float

Gamma w.r.t. strike.

strikeSensitivity() float

Sensitivity to strike.

theta(spot: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex) float

Sensitivity to time to maturity.

thetaPerDay(spot: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex) float

Sensitivity to time to maturity per day (365-day basis).

value() float

Returns the option value.

vega(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to volatility.

Black 1976 pricing and Greeks calculator. Provides delta, gamma, theta, vega, rho, and more.

calc = ql.BlackCalculator(payoff, forward, stdDev, discount)
print(calc.value(), calc.delta(spot), calc.gamma(spot), calc.vega(T))

BachelierCalculator

class pyquantlib.BachelierCalculator

Bases: pybind11_object

Bachelier (normal-volatility) calculator for option pricing and Greeks.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(payoff: base.StrikedTypePayoff, forward: SupportsFloat | SupportsIndex, stdDev: SupportsFloat | SupportsIndex, discount: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from payoff, forward, stdDev, and discount.

  1. __init__(optionType: OptionType, strike: SupportsFloat | SupportsIndex, forward: SupportsFloat | SupportsIndex, stdDev: SupportsFloat | SupportsIndex, discount: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from option type, strike, forward, stdDev, and discount.

alpha() float

Returns alpha.

beta() float

Returns beta.

delta(spot: SupportsFloat | SupportsIndex) float

Sensitivity to change in the underlying spot price.

deltaForward() float

Sensitivity to change in the underlying forward price.

dividendRho(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to dividend/growth rate.

elasticity(spot: SupportsFloat | SupportsIndex) float

Percent sensitivity to percent change in spot price.

elasticityForward() float

Percent sensitivity to percent change in forward price.

gamma(spot: SupportsFloat | SupportsIndex) float

Second order derivative w.r.t. spot price.

gammaForward() float

Second order derivative w.r.t. forward price.

itmAssetProbability() float

Probability of being ITM in asset martingale measure.

itmCashProbability() float

Probability of being ITM in bond martingale measure.

rho(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to discounting rate.

strikeGamma() float

Gamma w.r.t. strike.

strikeSensitivity() float

Sensitivity to strike.

theta(spot: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex) float

Sensitivity to time to maturity.

thetaPerDay(spot: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex) float

Sensitivity to time to maturity per day (365-day basis).

value() float

Returns the option value.

vega(maturity: SupportsFloat | SupportsIndex) float

Sensitivity to volatility.

Bachelier (normal-volatility) pricing and Greeks calculator. Same API as BlackCalculator.

calc = ql.BachelierCalculator(payoff, forward, stdDev, discount)
print(calc.value(), calc.delta(spot), calc.gamma(spot), calc.vega(T))

Functions

Black-76 (Lognormal)

Function

Description

blackFormula(optionType, strike, forward, stdDev, ...)

Option price

blackFormulaImpliedStdDev(optionType, strike, forward, blackPrice, ...)

Implied volatility × √T

blackFormulaImpliedStdDevApproximation(...)

Fast implied vol approximation

blackFormulaStdDevDerivative(strike, forward, stdDev, ...)

Vega / √T

blackFormulaVolDerivative(strike, forward, stdDev, expiry, ...)

Vega

blackFormulaForwardDerivative(optionType, strike, forward, stdDev, ...)

Delta (forward)

blackFormulaCashItmProbability(optionType, strike, forward, stdDev, ...)

N(d2)

blackFormulaAssetItmProbability(optionType, strike, forward, stdDev, ...)

N(d1)

Bachelier (Normal)

Function

Description

bachelierBlackFormula(optionType, strike, forward, stdDev, ...)

Option price

bachelierBlackFormulaImpliedVol(optionType, strike, forward, tte, price, ...)

Implied vol

bachelierBlackFormulaStdDevDerivative(strike, forward, stdDev, ...)

Vega component

import pyquantlib as ql

forward = 100.0
strike = 100.0
vol = 0.20
T = 1.0
stdDev = vol * (T ** 0.5)

price = ql.blackFormula(ql.OptionType.Call, strike, forward, stdDev)
impliedStdDev = ql.blackFormulaImpliedStdDev(ql.OptionType.Call, strike, forward, price)

Note

The abstract PricingEngine base class is available in pyquantlib.base for custom engine implementations.