Methods Module

Monte Carlo simulation and finite-difference grid infrastructure.

Paths

Path

class pyquantlib.Path

Bases: pybind11_object

Single-factor random walk.

__init__(timeGrid: TimeGrid, values: Array = Array([])) None

Constructs a path on the given time grid.

back() float

Returns last value.

empty() bool

True if path is empty.

front() float

Returns first value.

length() int

Number of points in the path.

time(i: SupportsInt | SupportsIndex) float

Returns time at index i.

timeGrid() TimeGrid

Returns the underlying time grid.

value(i: SupportsInt | SupportsIndex) float

Returns value at index i.

Single-factor price path storing values at discrete time points.

grid = ql.TimeGrid(1.0, 4)  # 4 steps over 1 year
path = ql.Path(grid)

# Access values
path[0]           # first value
path[-1]          # last value
path.front()      # same as path[0]
path.back()       # same as path[-1]
len(path)         # number of path values
path.timeGrid()   # underlying TimeGrid

MultiPath

class pyquantlib.MultiPath

Bases: pybind11_object

Correlated multiple asset paths.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(nAsset: SupportsInt | SupportsIndex, timeGrid: TimeGrid) -> None

Constructs paths for nAsset assets on the given time grid.

  1. __init__(paths: collections.abc.Sequence[Path]) -> None

Constructs from a vector of single-asset paths.

assetNumber() int

Number of assets.

pathSize() int

Number of points in each path.

Correlated multi-asset paths, each sharing the same time grid.

grid = ql.TimeGrid(1.0, 4)
mp = ql.MultiPath(2, grid)  # 2 assets

mp[0]               # Path for first asset
mp[1]               # Path for second asset
mp.assetNumber()     # 2
mp.pathSize()        # number of time points
len(mp)              # same as assetNumber()

Sample Types

class pyquantlib.SamplePath

Bases: pybind11_object

Weighted path sample (value + weight).

__init__(*args, **kwargs)
property value

Sample path.

property weight

Sample weight.

class pyquantlib.SampleMultiPath

Bases: pybind11_object

Weighted multi-path sample (value + weight).

__init__(*args, **kwargs)
property value

Sample multi-path.

property weight

Sample weight.

Weighted path samples returned by path generators. Each has value (the path) and weight (the sample weight).

Brownian Bridge

BrownianBridge

class pyquantlib.BrownianBridge

Bases: pybind11_object

Builds Wiener process paths using Gaussian variates.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(steps: SupportsInt | SupportsIndex) -> None

Constructs a bridge with the given number of unit-time steps.

  1. __init__(timeGrid: TimeGrid) -> None

Constructs a bridge from a time grid.

  1. __init__(times: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> None

Constructs a bridge from step times.

bridgeIndex() list[int]

Bridge construction indices.

leftIndex() list[int]

Left interpolation indices.

leftWeight() list[float]

Left interpolation weights.

rightIndex() list[int]

Right interpolation indices.

rightWeight() list[float]

Right interpolation weights.

size() int

Number of steps.

stdDeviation() list[float]

Standard deviations.

times() list[float]

Step times.

transform(input: collections.abc.Sequence[SupportsFloat | SupportsIndex]) list[float]

Transforms random variates into Brownian bridge path variations.

Builds Wiener process paths using Gaussian variates via bridge construction (variance reduction).

# From number of steps
bb = ql.BrownianBridge(10)

# From time grid
grid = ql.TimeGrid(1.0, 10)
bb = ql.BrownianBridge(timeGrid=grid)

# Transform random variates into bridge path
import random
variates = [random.gauss(0, 1) for _ in range(bb.size())]
output = bb.transform(variates)

# Inspect bridge construction
bb.bridgeIndex()   # construction order
bb.leftWeight()    # interpolation weights
bb.stdDeviation()  # step standard deviations

Path Generators

GaussianPathGenerator

class pyquantlib.GaussianPathGenerator

Bases: pybind11_object

Single-factor path generator using pseudo-random Gaussian variates.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: base.StochasticProcess, length: SupportsFloat | SupportsIndex, timeSteps: SupportsInt | SupportsIndex, generator: GaussianRandomSequenceGenerator, brownianBridge: bool) -> None

Constructs from process, time length, steps, and generator.

  1. __init__(process: base.StochasticProcess, timeGrid: TimeGrid, generator: GaussianRandomSequenceGenerator, brownianBridge: bool) -> None

Constructs from process, time grid, and generator.

antithetic() SamplePath

Generates the antithetic path sample.

next() SamplePath

Generates the next path sample.

size() int

Generator dimensionality.

timeGrid() TimeGrid

Returns the underlying time grid.

Single-factor path generator using pseudo-random Gaussian variates (Mersenne Twister).

process = ql.BlackScholesMertonProcess(spot, div, rf, vol)
rsg = ql.GaussianRandomSequenceGenerator(
    ql.UniformRandomSequenceGenerator(10, ql.MersenneTwisterUniformRng(42))
)

gen = ql.GaussianPathGenerator(process, 1.0, 10, rsg, False)
sample = gen.next()       # SamplePath
path = sample.value       # Path object
weight = sample.weight    # sample weight

anti = gen.antithetic()   # antithetic sample

GaussianSobolPathGenerator

class pyquantlib.GaussianSobolPathGenerator

Bases: pybind11_object

Single-factor path generator using Sobol low-discrepancy variates.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: base.StochasticProcess, length: SupportsFloat | SupportsIndex, timeSteps: SupportsInt | SupportsIndex, generator: GaussianLowDiscrepancySequenceGenerator, brownianBridge: bool) -> None

Constructs from process, time length, steps, and generator.

  1. __init__(process: base.StochasticProcess, timeGrid: TimeGrid, generator: GaussianLowDiscrepancySequenceGenerator, brownianBridge: bool) -> None

Constructs from process, time grid, and generator.

antithetic() SamplePath

Generates the antithetic path sample.

next() SamplePath

Generates the next path sample.

size() int

Generator dimensionality.

timeGrid() TimeGrid

Returns the underlying time grid.

Single-factor path generator using Sobol low-discrepancy variates.

sobol_rsg = ql.GaussianLowDiscrepancySequenceGenerator(
    ql.SobolRsg(10)
)
gen = ql.GaussianSobolPathGenerator(process, 1.0, 10, sobol_rsg, True)

GaussianMultiPathGenerator

class pyquantlib.GaussianMultiPathGenerator

Bases: pybind11_object

Multi-factor path generator using pseudo-random Gaussian variates.

__init__(process: base.StochasticProcess, timeGrid: TimeGrid, generator: GaussianRandomSequenceGenerator, brownianBridge: bool = False) None

Constructs from process, time grid, and generator.

antithetic() SampleMultiPath

Generates the antithetic multi-path sample.

next() SampleMultiPath

Generates the next multi-path sample.

Multi-factor path generator using pseudo-random Gaussian variates.

heston = ql.HestonProcess(rf, div, spot, 0.04, 1.0, 0.04, 0.5, -0.7)
grid = ql.TimeGrid(1.0, 50)
rsg = ql.GaussianRandomSequenceGenerator(
    ql.UniformRandomSequenceGenerator(
        heston.factors() * 50, ql.MersenneTwisterUniformRng(42)
    )
)

gen = ql.GaussianMultiPathGenerator(heston, grid, rsg)
sample = gen.next()         # SampleMultiPath
mp = sample.value           # MultiPath
spot_path = mp[0]           # Path for spot
var_path = mp[1]            # Path for variance

GaussianSobolMultiPathGenerator

class pyquantlib.GaussianSobolMultiPathGenerator

Bases: pybind11_object

Multi-factor path generator using Sobol low-discrepancy variates.

__init__(process: base.StochasticProcess, timeGrid: TimeGrid, generator: GaussianLowDiscrepancySequenceGenerator, brownianBridge: bool = False) None

Constructs from process, time grid, and generator.

antithetic() SampleMultiPath

Generates the antithetic multi-path sample.

next() SampleMultiPath

Generates the next multi-path sample.

Multi-factor path generator using Sobol low-discrepancy variates.

Brownian Generators

Low-level generators for producing correlated Brownian increments. Used internally by MC engines and SLV models.

MTBrownianGenerator

class pyquantlib.MTBrownianGenerator

Bases: BrownianGenerator

Mersenne-Twister Brownian generator.

__init__(factors: SupportsInt | SupportsIndex, steps: SupportsInt | SupportsIndex, seed: SupportsInt | SupportsIndex = 0) None

Constructs from dimensions and optional seed.

Mersenne-Twister-based Brownian generator.

gen = ql.MTBrownianGenerator(factors=2, steps=10, seed=42)
weight, variates = gen.nextStep()  # single time step
path = gen.nextPath()              # full path weight

MTBrownianGeneratorFactory

class pyquantlib.MTBrownianGeneratorFactory

Bases: BrownianGeneratorFactory

Factory for Mersenne-Twister Brownian generators.

__init__(seed: SupportsInt | SupportsIndex = 0) None

Constructs with optional seed.

SobolBrownianGenerator

class pyquantlib.SobolBrownianGenerator

Bases: BrownianGenerator

Sobol Brownian generator with Brownian bridging.

__init__(factors: SupportsInt | SupportsIndex, steps: SupportsInt | SupportsIndex, ordering: Ordering, seed: SupportsInt | SupportsIndex = 0, directionIntegers: SobolRsg.DirectionIntegers = <DirectionIntegers.Jaeckel: 1>) None

Constructs a Sobol Brownian generator.

Sobol-based Brownian generator with configurable ordering.

gen = ql.SobolBrownianGenerator(
    factors=2, steps=10,
    ordering=ql.Ordering.Steps,
)

SobolBrownianGeneratorFactory

class pyquantlib.SobolBrownianGeneratorFactory

Bases: BrownianGeneratorFactory

Factory for Sobol Brownian generators.

__init__(ordering: Ordering, seed: SupportsInt | SupportsIndex = 0, directionIntegers: SobolRsg.DirectionIntegers = <DirectionIntegers.Jaeckel: 1>) None

Constructs a Sobol Brownian generator factory.

Burley2020SobolBrownianGenerator

class pyquantlib.Burley2020SobolBrownianGenerator

Bases: BrownianGenerator

Scrambled Sobol Brownian generator with Brownian bridging.

__init__(factors: SupportsInt | SupportsIndex, steps: SupportsInt | SupportsIndex, ordering: Ordering, seed: SupportsInt | SupportsIndex = 42, directionIntegers: SobolRsg.DirectionIntegers = <DirectionIntegers.Jaeckel: 1>, scrambleSeed: SupportsInt | SupportsIndex = 43) None

Constructs a scrambled Sobol Brownian generator.

Scrambled Sobol Brownian generator (Burley 2020 hash-based Owen scrambling).

Burley2020SobolBrownianGeneratorFactory

class pyquantlib.Burley2020SobolBrownianGeneratorFactory

Bases: BrownianGeneratorFactory

Factory for scrambled Sobol Brownian generators.

__init__(ordering: Ordering, seed: SupportsInt | SupportsIndex = 42, directionIntegers: SobolRsg.DirectionIntegers = <DirectionIntegers.Jaeckel: 1>, scrambleSeed: SupportsInt | SupportsIndex = 43) None

Constructs a scrambled Sobol Brownian generator factory.

FDM Enums

FdmSchemeDesc

class pyquantlib.FdmSchemeDesc

Bases: pybind11_object

Finite difference scheme descriptor.

static CraigSneyd() FdmSchemeDesc

Craig-Sneyd scheme.

static CrankNicolson() FdmSchemeDesc

Crank-Nicolson scheme.

static Douglas() FdmSchemeDesc

Douglas scheme (same as Crank-Nicolson in 1D).

static ExplicitEuler() FdmSchemeDesc

Explicit Euler scheme.

static Hundsdorfer() FdmSchemeDesc

Hundsdorfer scheme.

static ImplicitEuler() FdmSchemeDesc

Implicit Euler scheme.

static MethodOfLines(eps: SupportsFloat | SupportsIndex = 0.001, relInitStepSize: SupportsFloat | SupportsIndex = 0.01) FdmSchemeDesc

Method of lines scheme.

static ModifiedCraigSneyd() FdmSchemeDesc

Modified Craig-Sneyd scheme.

static ModifiedHundsdorfer() FdmSchemeDesc

Modified Hundsdorfer scheme.

static TrBDF2() FdmSchemeDesc

TR-BDF2 scheme.

__init__(type: FdmSchemeType, theta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex) None

Constructs with scheme type, theta, and mu.

property mu
property theta
property type

Finite difference scheme descriptors used by FD engines and the Heston SLV FDM calibration.

FdmHestonGreensFctAlgorithm

class pyquantlib.FdmHestonGreensFctAlgorithm

Bases: pybind11_object

Algorithm for Heston Fokker-Planck Green’s function.

Members:

ZeroCorrelation

Gaussian

SemiAnalytical

__init__(value: SupportsInt | SupportsIndex) None
Gaussian = <FdmHestonGreensFctAlgorithm.Gaussian: 1>
SemiAnalytical = <FdmHestonGreensFctAlgorithm.SemiAnalytical: 2>
ZeroCorrelation = <FdmHestonGreensFctAlgorithm.ZeroCorrelation: 0>
FdmHestonGreensFctAlgorithm.name -> str
property value

Algorithm for computing Heston Fokker-Planck Green’s functions: ZeroCorrelation, Gaussian, SemiAnalytical.

FdmSquareRootFwdOpTransformationType

class pyquantlib.FdmSquareRootFwdOpTransformationType

Bases: pybind11_object

Coordinate transformation for square-root process FD scheme.

Members:

Plain

Power

Log

__init__(value: SupportsInt | SupportsIndex) None
Log = <FdmSquareRootFwdOpTransformationType.Log: 2>
Plain = <FdmSquareRootFwdOpTransformationType.Plain: 0>
Power = <FdmSquareRootFwdOpTransformationType.Power: 1>
FdmSquareRootFwdOpTransformationType.name -> str
property value

Coordinate transformation for the square-root forward operator: Plain, Power, Log.

FDM Grid Infrastructure

Layout, iterators, and meshers for multi-dimensional finite-difference grids.

FdmLinearOpIterator

class pyquantlib.FdmLinearOpIterator

Bases: pybind11_object

Iterator for a FDM linear operator layout.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(index: SupportsInt | SupportsIndex = 0) -> None

Constructs with a flat index.

  1. __init__(dim: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> None

Constructs from grid dimensions.

  1. __init__(dim: collections.abc.Sequence[SupportsInt | SupportsIndex], coordinates: collections.abc.Sequence[SupportsInt | SupportsIndex], index: SupportsInt | SupportsIndex) -> None

Constructs from dimensions, coordinates, and flat index.

coordinates() list[int]

Returns the coordinate vector.

increment() None

Advances the iterator by one position.

index() int

Returns the flat index.

notEqual(other: FdmLinearOpIterator) bool

Returns true if iterators differ.

Iterator over grid points in an FDM layout. Tracks flat index and multi-dimensional coordinates.

layout = ql.FdmLinearOpLayout([5, 3])
it = layout.begin()
it.index()        # 0
it.coordinates()  # [0, 0]
it.increment()
it.index()        # 1
it.coordinates()  # [1, 0]

FdmLinearOpLayout

class pyquantlib.FdmLinearOpLayout

Bases: pybind11_object

Memory layout of a FDM linear operator grid.

__init__(dim: collections.abc.Sequence[SupportsInt | SupportsIndex]) None

Constructs from grid dimensions.

begin() FdmLinearOpIterator

Returns an iterator to the first element.

dim() list[int]

Returns the dimension vector.

end() FdmLinearOpIterator

Returns an iterator past the last element.

index(coordinates: collections.abc.Sequence[SupportsInt | SupportsIndex]) int

Returns the flat index for given coordinates.

iter_neighbourhood(iterator: FdmLinearOpIterator, i: SupportsInt | SupportsIndex, offset: SupportsInt | SupportsIndex) FdmLinearOpIterator

Returns a neighbour iterator in dimension i.

neighbourhood(*args, **kwargs)

Overloaded function.

  1. neighbourhood(iterator: FdmLinearOpIterator, i: SupportsInt | SupportsIndex, offset: SupportsInt | SupportsIndex) -> int

Returns neighbour flat index in dimension i.

  1. neighbourhood(iterator: FdmLinearOpIterator, i1: SupportsInt | SupportsIndex, offset1: SupportsInt | SupportsIndex, i2: SupportsInt | SupportsIndex, offset2: SupportsInt | SupportsIndex) -> int

Returns neighbour flat index in dimensions i1 and i2.

size() int

Returns the total number of grid points.

spacing() list[int]

Returns the spacing (stride) vector.

Memory layout for multi-dimensional FDM grids. Supports Python iteration.

layout = ql.FdmLinearOpLayout([5, 3])
len(layout)            # 15
layout.dim()           # [5, 3]
layout.spacing()       # stride vector

for it in layout:
    print(it.index(), it.coordinates())

Fdm1dMesher

class pyquantlib.Fdm1dMesher

Bases: pybind11_object

Base class for one-dimensional FDM meshers.

__init__(size: SupportsInt | SupportsIndex) None

Constructs a 1D mesher of the given size.

dminus(index: SupportsInt | SupportsIndex) float

Returns the backward difference at index.

dplus(index: SupportsInt | SupportsIndex) float

Returns the forward difference at index.

location(index: SupportsInt | SupportsIndex) float

Returns the location at index.

locations() list[float]

Returns all grid locations.

size() int

Returns the number of grid points.

Base class for one-dimensional FDM meshers. All 1D meshers below inherit from this.

mesher = ql.Uniform1dMesher(0.0, 1.0, 5)
mesher.locations()  # grid point locations
mesher.dplus(0)     # forward difference at index 0
mesher.dminus(1)    # backward difference at index 1

Uniform1dMesher

class pyquantlib.Uniform1dMesher

Bases: Fdm1dMesher

One-dimensional uniform grid mesher.

__init__(start: SupportsFloat | SupportsIndex, end: SupportsFloat | SupportsIndex, size: SupportsInt | SupportsIndex) None

Constructs a uniform grid from start to end.

Uniform grid between start and end values.

Concentrating1dMesher

class pyquantlib.Concentrating1dMesher

Bases: Fdm1dMesher

One-dimensional mesher concentrating around critical points.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(start: SupportsFloat | SupportsIndex, end: SupportsFloat | SupportsIndex, size: SupportsInt | SupportsIndex, cPoint: object = None, requireCPoint: bool = False) -> None

Constructs with optional concentration point (location, density).

  1. __init__(start: SupportsFloat | SupportsIndex, end: SupportsFloat | SupportsIndex, size: SupportsInt | SupportsIndex, cPoints: collections.abc.Sequence[tuple[SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex, bool]], tol: SupportsFloat | SupportsIndex = 1e-08) -> None

Constructs with multiple concentration points.

Grid concentrating points around one or more critical points.

# Single concentration point at 100.0 with density 0.1
mesher = ql.Concentrating1dMesher(50.0, 150.0, 100, cPoint=(100.0, 0.1))

# Multiple concentration points
mesher = ql.Concentrating1dMesher(
    50.0, 150.0, 100,
    cPoints=[(100.0, 0.1, False), (120.0, 0.05, False)]
)

Predefined1dMesher

class pyquantlib.Predefined1dMesher

Bases: Fdm1dMesher

One-dimensional mesher from predefined grid points.

__init__(x: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None

Constructs from explicit grid locations.

Mesher from user-supplied grid points.

FdmBlackScholesMesher

class pyquantlib.FdmBlackScholesMesher

Bases: Fdm1dMesher

One-dimensional mesher for the Black-Scholes process (in ln(S)).

static processHelper(s0: QuoteHandle, rTS: YieldTermStructureHandle, qTS: YieldTermStructureHandle, vol: SupportsFloat | SupportsIndex) GeneralizedBlackScholesProcess

Creates a GeneralizedBlackScholesProcess from basic inputs.

__init__(size: SupportsInt | SupportsIndex, process: GeneralizedBlackScholesProcess, maturity: SupportsFloat | SupportsIndex, strike: SupportsFloat | SupportsIndex, xMinConstraint: object = None, xMaxConstraint: object = None, eps: SupportsFloat | SupportsIndex = 0.0001, scaleFactor: SupportsFloat | SupportsIndex = 1.5, cPoint: object = None, dividendSchedule: collections.abc.Sequence[base.Dividend] = [], fdmQuantoHelper: FdmQuantoHelper = None, spotAdjustment: SupportsFloat | SupportsIndex = 0.0) None

Constructs a Black-Scholes mesher.

One-dimensional mesher for the Black-Scholes process (in ln(S)).

process = ql.BlackScholesMertonProcess(spot, div, rf, vol)
mesher = ql.FdmBlackScholesMesher(100, process, 1.0, 100.0)

FdmHestonVarianceMesher

class pyquantlib.FdmHestonVarianceMesher

Bases: Fdm1dMesher

One-dimensional variance mesher for the Heston model.

__init__(size: SupportsInt | SupportsIndex, process: HestonProcess, maturity: SupportsFloat | SupportsIndex, tAvgSteps: SupportsInt | SupportsIndex = 10, epsilon: SupportsFloat | SupportsIndex = 0.0001, mixingFactor: SupportsFloat | SupportsIndex = 1.0) None

Constructs a Heston variance mesher.

volaEstimate() float

Returns the volatility estimate.

Variance dimension mesher for Heston models with volatility estimate.

heston = ql.HestonProcess(rf, div, spot, 0.04, 1.0, 0.04, 0.5, -0.7)
mesher = ql.FdmHestonVarianceMesher(10, heston, 1.0)
mesher.volaEstimate()  # estimated volatility

FdmHestonLocalVolatilityVarianceMesher

class pyquantlib.FdmHestonLocalVolatilityVarianceMesher

Bases: Fdm1dMesher

Variance mesher for the Heston model with local volatility.

__init__(size: SupportsInt | SupportsIndex, process: HestonProcess, leverageFct: base.LocalVolTermStructure, maturity: SupportsFloat | SupportsIndex, tAvgSteps: SupportsInt | SupportsIndex = 10, epsilon: SupportsFloat | SupportsIndex = 0.0001, mixingFactor: SupportsFloat | SupportsIndex = 1.0) None

Constructs a Heston local vol variance mesher.

volaEstimate() float

Returns the volatility estimate.

Heston variance mesher incorporating local volatility leverage.

FdmCEV1dMesher

class pyquantlib.FdmCEV1dMesher

Bases: Fdm1dMesher

One-dimensional mesher for the CEV model.

__init__(size: SupportsInt | SupportsIndex, f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex, eps: SupportsFloat | SupportsIndex = 0.0001, scaleFactor: SupportsFloat | SupportsIndex = 1.5, cPoint: object = None) None

Constructs a CEV mesher.

One-dimensional mesher for the CEV model.

FdmSimpleProcess1dMesher

class pyquantlib.FdmSimpleProcess1dMesher

Bases: Fdm1dMesher

One-dimensional mesher for a generic stochastic process.

__init__(size: SupportsInt | SupportsIndex, process: base.StochasticProcess1D, maturity: SupportsFloat | SupportsIndex, tAvgSteps: SupportsInt | SupportsIndex = 10, epsilon: SupportsFloat | SupportsIndex = 0.0001, mandatoryPoint: object = None) None

Constructs from a 1D stochastic process.

Generic one-dimensional mesher for any 1D stochastic process.

FdmMesherComposite

class pyquantlib.FdmMesherComposite

Bases: FdmMesher

Composite multi-dimensional mesher built from 1D meshers.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(meshers: collections.abc.Sequence[Fdm1dMesher]) -> None

Constructs from a vector of 1D meshers.

  1. __init__(layout: FdmLinearOpLayout, meshers: collections.abc.Sequence[Fdm1dMesher]) -> None

Constructs from a layout and vector of 1D meshers.

  1. __init__(mesher: Fdm1dMesher) -> None

Constructs a 1D composite mesher.

  1. __init__(m1: Fdm1dMesher, m2: Fdm1dMesher) -> None

Constructs a 2D composite mesher.

  1. __init__(m1: Fdm1dMesher, m2: Fdm1dMesher, m3: Fdm1dMesher) -> None

Constructs a 3D composite mesher.

  1. __init__(m1: Fdm1dMesher, m2: Fdm1dMesher, m3: Fdm1dMesher, m4: Fdm1dMesher) -> None

Constructs a 4D composite mesher.

getFdm1dMeshers() list[Fdm1dMesher]

Returns the underlying 1D meshers.

Composite multi-dimensional mesher built from 1D meshers.

# 2D grid from two 1D meshers
m1 = ql.FdmBlackScholesMesher(100, process, 1.0, 100.0)
m2 = ql.FdmHestonVarianceMesher(10, heston, 1.0)
mesher = ql.FdmMesherComposite(m1, m2)

mesher.layout()            # FdmLinearOpLayout
mesher.getFdm1dMeshers()   # underlying 1D meshers

FdmQuantoHelper

class pyquantlib.FdmQuantoHelper

Bases: Observable

Helper storing market data for FDM quanto adjustment.

__init__(rTS: base.YieldTermStructure, fTS: base.YieldTermStructure, fxVolTS: base.BlackVolTermStructure, equityFxCorrelation: SupportsFloat | SupportsIndex, exchRateATMlevel: SupportsFloat | SupportsIndex) None

Constructs from rate curves, FX vol, correlation, and FX rate.

quantoAdjustment(*args, **kwargs)

Overloaded function.

  1. quantoAdjustment(equityVol: SupportsFloat | SupportsIndex, t1: SupportsFloat | SupportsIndex, t2: SupportsFloat | SupportsIndex) -> float

Returns the quanto adjustment for scalar equity volatility.

  1. quantoAdjustment(equityVol: Array, t1: SupportsFloat | SupportsIndex, t2: SupportsFloat | SupportsIndex) -> Array

Returns the quanto adjustment for an Array of equity volatilities.

property equityFxCorrelation
property exchRateATMlevel
property fTS
property fxVolTS
property rTS

Helper for applying quanto adjustments in FDM pricing.

FDM Boundary Conditions

BoundaryConditionSide

class pyquantlib.BoundaryConditionSide

Bases: pybind11_object

Boundary condition side.

Members:

None_

Upper

Lower

__init__(value: SupportsInt | SupportsIndex) None
Lower = <BoundaryConditionSide.Lower: 2>
None_ = <BoundaryConditionSide.None_: 0>
Upper = <BoundaryConditionSide.Upper: 1>
BoundaryConditionSide.name -> str
property value

Side of the domain for boundary conditions: None_, Upper, Lower.

FdmBoundaryCondition

class pyquantlib.FdmBoundaryCondition

Bases: pybind11_object

Boundary condition for FDM operators.

__init__(*args, **kwargs)
setTime(t: SupportsFloat | SupportsIndex) None

Sets the current time for time-dependent conditions.

Abstract boundary condition for FDM operators. Used in boundary condition sets passed to schemes.

FDM Operators

Building Block Operators

TripleBandLinearOp

class pyquantlib.TripleBandLinearOp

Bases: FdmLinearOp

Triple-band (tridiagonal) linear operator.

__init__(direction: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs from direction and mesher.

add(*args, **kwargs)

Overloaded function.

  1. add(m: TripleBandLinearOp) -> TripleBandLinearOp

Adds another triple-band operator.

  1. add(u: Array) -> TripleBandLinearOp

Adds a diagonal array.

apply(r: Array) Array

Applies the operator to an array.

axpyb(a: Array, x: TripleBandLinearOp, y: TripleBandLinearOp, b: Array) None

Computes a*x + y + b (in-place).

mult(u: Array) TripleBandLinearOp

Left-multiplies by a diagonal matrix.

multR(u: Array) TripleBandLinearOp

Right-multiplies by a diagonal matrix.

solve_splitting(r: Array, a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex = 1.0) Array

Solves the splitting step.

Tridiagonal (triple-band) linear operator on one grid dimension.

mesher = ql.FdmMesherComposite(ql.Uniform1dMesher(0.0, 1.0, 10))
op = ql.TripleBandLinearOp(0, mesher)

result = op.apply(array)
result = op.solve_splitting(rhs, a, b)
op2 = op.mult(array)
op3 = op.add(other_op)

FirstDerivativeOp

class pyquantlib.FirstDerivativeOp

Bases: TripleBandLinearOp

First derivative operator on an FDM grid.

__init__(direction: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs from direction and mesher.

Central first-derivative operator (inherits from TripleBandLinearOp).

d_dx = ql.FirstDerivativeOp(0, mesher)
gradient = d_dx.apply(values)

SecondDerivativeOp

class pyquantlib.SecondDerivativeOp

Bases: TripleBandLinearOp

Second derivative operator on an FDM grid.

__init__(direction: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs from direction and mesher.

Central second-derivative operator (inherits from TripleBandLinearOp).

d2_dx2 = ql.SecondDerivativeOp(0, mesher)
laplacian = d2_dx2.apply(values)

NinePointLinearOp

class pyquantlib.NinePointLinearOp

Bases: FdmLinearOp

Nine-point linear operator for 2D FDM grids.

__init__(d0: SupportsInt | SupportsIndex, d1: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs from two directions and a mesher.

apply(r: Array) Array

Applies the operator to an array.

mult(u: Array) NinePointLinearOp

Left-multiplies by a diagonal matrix.

Nine-point cross-derivative operator on two grid dimensions.

SecondOrderMixedDerivativeOp

class pyquantlib.SecondOrderMixedDerivativeOp

Bases: NinePointLinearOp

Second-order mixed derivative operator for 2D FDM grids.

__init__(d0: SupportsInt | SupportsIndex, d1: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs from two directions and a mesher.

Second-order mixed partial derivative operator (inherits from NinePointLinearOp).

d2_dxdy = ql.SecondOrderMixedDerivativeOp(0, 1, mesher)

Process Operators

Process-specific PDE operators, all inheriting from FdmLinearOpComposite. These encode the drift, diffusion, and cross terms for a given stochastic process. Constructed from a mesher and the corresponding process; the inherited methods (size, setTime, apply, apply_mixed, apply_direction, solve_splitting, preconditioner) are called internally by FDM schemes.

FdmBlackScholesOp

class pyquantlib.FdmBlackScholesOp

Bases: FdmLinearOpComposite

Black-Scholes FDM operator.

__init__(mesher: FdmMesher, process: GeneralizedBlackScholesProcess, strike: SupportsFloat | SupportsIndex, localVol: bool = False, illegalLocalVolOverwrite: object = None, direction: SupportsInt | SupportsIndex = 0, quantoHelper: FdmQuantoHelper = None) None

Constructs a Black-Scholes operator.

Black-Scholes PDE operator.

op = ql.FdmBlackScholesOp(mesher, process, strike=100.0)

FdmBlackScholesFwdOp

class pyquantlib.FdmBlackScholesFwdOp

Bases: FdmLinearOpComposite

Black-Scholes Fokker-Planck forward operator.

__init__(mesher: FdmMesher, process: GeneralizedBlackScholesProcess, strike: SupportsFloat | SupportsIndex, localVol: bool = False, illegalLocalVolOverwrite: object = None, direction: SupportsInt | SupportsIndex = 0) None

Constructs a Black-Scholes forward operator.

Black-Scholes forward (Fokker-Planck) operator.

Fdm2dBlackScholesOp

class pyquantlib.Fdm2dBlackScholesOp

Bases: FdmLinearOpComposite

Two-dimensional Black-Scholes FDM operator.

__init__(mesher: FdmMesher, p1: GeneralizedBlackScholesProcess, p2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex, maturity: SupportsFloat | SupportsIndex, localVol: bool = False, illegalLocalVolOverwrite: object = None) None

Constructs a 2D Black-Scholes operator.

Two-dimensional correlated Black-Scholes operator.

FdmHestonOp

class pyquantlib.FdmHestonOp

Bases: FdmLinearOpComposite

Heston stochastic volatility FDM operator.

__init__(mesher: FdmMesher, hestonProcess: HestonProcess, quantoHelper: FdmQuantoHelper = None, leverageFct: base.LocalVolTermStructure = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) None

Constructs a Heston operator.

Heston stochastic volatility PDE operator.

op = ql.FdmHestonOp(mesher, heston_process)

FdmHestonFwdOp

class pyquantlib.FdmHestonFwdOp

Bases: FdmLinearOpComposite

Heston Fokker-Planck forward operator.

__init__(mesher: FdmMesher, process: HestonProcess, type: FdmSquareRootFwdOpTransformationType = <FdmSquareRootFwdOpTransformationType.Plain: 0>, leverageFct: base.LocalVolTermStructure = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) None

Constructs a Heston forward operator.

Heston forward (Fokker-Planck) operator.

FdmHestonHullWhiteOp

class pyquantlib.FdmHestonHullWhiteOp

Bases: FdmLinearOpComposite

Heston-Hull-White FDM operator.

__init__(mesher: FdmMesher, hestonProcess: HestonProcess, hwProcess: HullWhiteProcess, equityShortRateCorrelation: SupportsFloat | SupportsIndex) None

Constructs a Heston-Hull-White operator.

Three-factor Heston plus Hull-White operator.

FdmBatesOp

class pyquantlib.FdmBatesOp

Bases: FdmLinearOpComposite

Bates (Heston + jumps) FDM operator.

__init__(mesher: FdmMesher, batesProcess: BatesProcess, bcSet: collections.abc.Sequence[FdmBoundaryCondition], integroIntegrationOrder: SupportsInt | SupportsIndex, quantoHelper: FdmQuantoHelper = None) None

Constructs a Bates operator.

Bates (Heston + jumps) PDE operator.

FdmHullWhiteOp

class pyquantlib.FdmHullWhiteOp

Bases: FdmLinearOpComposite

Hull-White interest rate FDM operator.

__init__(mesher: FdmMesher, model: QuantLib::HullWhite, direction: SupportsInt | SupportsIndex) None

Constructs a Hull-White operator.

Hull-White short-rate PDE operator.

FdmG2Op

class pyquantlib.FdmG2Op

Bases: FdmLinearOpComposite

G2++ two-factor interest rate FDM operator.

__init__(mesher: FdmMesher, model: QuantLib::G2, direction1: SupportsInt | SupportsIndex, direction2: SupportsInt | SupportsIndex) None

Constructs a G2 operator.

Two-factor Gaussian short-rate (G2) PDE operator.

FdmCEVOp

class pyquantlib.FdmCEVOp

Bases: FdmLinearOpComposite

Constant Elasticity of Variance FDM operator.

__init__(mesher: FdmMesher, rTS: base.YieldTermStructure, f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, direction: SupportsInt | SupportsIndex) None

Constructs a CEV operator.

Constant Elasticity of Variance PDE operator.

FdmSabrOp

class pyquantlib.FdmSabrOp

Bases: FdmLinearOpComposite

SABR stochastic volatility FDM operator.

__init__(mesher: FdmMesher, rTS: base.YieldTermStructure, f0: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex, nu: SupportsFloat | SupportsIndex, rho: SupportsFloat | SupportsIndex) None

Constructs a SABR operator.

SABR stochastic volatility PDE operator.

FdmLocalVolFwdOp

class pyquantlib.FdmLocalVolFwdOp

Bases: FdmLinearOpComposite

Local volatility Fokker-Planck forward operator.

__init__(mesher: FdmMesher, spot: base.Quote, rTS: base.YieldTermStructure, qTS: base.YieldTermStructure, localVol: base.LocalVolTermStructure, direction: SupportsInt | SupportsIndex = 0) None

Constructs a local volatility forward operator.

Local volatility forward (Fokker-Planck) operator.

FdmSquareRootFwdOp

class pyquantlib.FdmSquareRootFwdOp

Bases: FdmLinearOpComposite

Square-root process Fokker-Planck forward operator.

__init__(mesher: FdmMesher, kappa: SupportsFloat | SupportsIndex, theta: SupportsFloat | SupportsIndex, sigma: SupportsFloat | SupportsIndex, direction: SupportsInt | SupportsIndex, type: FdmSquareRootFwdOpTransformationType = <FdmSquareRootFwdOpTransformationType.Plain: 0>) None

Constructs a square-root forward operator.

lowerBoundaryFactor(type: FdmSquareRootFwdOpTransformationType = <FdmSquareRootFwdOpTransformationType.Plain: 0>) float

Returns the lower boundary factor.

upperBoundaryFactor(type: FdmSquareRootFwdOpTransformationType = <FdmSquareRootFwdOpTransformationType.Plain: 0>) float

Returns the upper boundary factor.

v(i: SupportsInt | SupportsIndex) float

Returns the transformed value at index i.

Square-root (CIR) forward operator, used in Heston SLV calibration.

FdmOrnsteinUhlenbeckOp

class pyquantlib.FdmOrnsteinUhlenbeckOp

Bases: FdmLinearOpComposite

Ornstein-Uhlenbeck process FDM operator.

__init__(mesher: FdmMesher, process: OrnsteinUhlenbeckProcess, rTS: base.YieldTermStructure, direction: SupportsInt | SupportsIndex = 0) None

Constructs an Ornstein-Uhlenbeck operator.

Ornstein-Uhlenbeck mean-reverting PDE operator.

FDM Schemes

Time-stepping schemes for evolving the PDE solution backward (or forward) in time. All schemes share the same interface:

scheme.setStep(dt)                 # set time step size
array = scheme.step(array, t)      # advance one step from time t

The step method returns the modified array (Python copy semantics).

ExplicitEulerScheme

class pyquantlib.ExplicitEulerScheme

Bases: pybind11_object

Explicit Euler time-stepping scheme.

__init__(map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from operator and boundary conditions.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Forward Euler (explicit) time stepping.

ImplicitEulerScheme

class pyquantlib.ImplicitEulerScheme

Bases: pybind11_object

Implicit Euler time-stepping scheme.

__init__(map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = [], relTol: SupportsFloat | SupportsIndex = 1e-08, solverType: ImplicitEulerSolverType = <ImplicitEulerSolverType.BiCGstab: 0>) None

Constructs from operator, boundary conditions, and solver settings.

numberOfIterations() int

Returns the number of solver iterations in the last step.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Backward Euler (implicit) time stepping with iterative solver.

scheme = ql.ImplicitEulerScheme(op, relTol=1e-8)
scheme.numberOfIterations()  # solver iterations from last step

ImplicitEulerSolverType

class pyquantlib.ImplicitEulerSolverType

Bases: pybind11_object

Iterative solver type for implicit schemes.

Members:

BiCGstab

GMRES

__init__(value: SupportsInt | SupportsIndex) None
BiCGstab = <ImplicitEulerSolverType.BiCGstab: 0>
GMRES = <ImplicitEulerSolverType.GMRES: 1>
ImplicitEulerSolverType.name -> str
property value

Iterative solver for implicit schemes: BiCGstab, GMRES.

CrankNicolsonScheme

class pyquantlib.CrankNicolsonScheme

Bases: pybind11_object

Crank-Nicolson time-stepping scheme.

__init__(theta: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = [], relTol: SupportsFloat | SupportsIndex = 1e-08, solverType: ImplicitEulerSolverType = <ImplicitEulerSolverType.BiCGstab: 0>) None

Constructs from theta, operator, and solver settings.

numberOfIterations() int

Returns the number of solver iterations in the last step.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Crank-Nicolson (theta = 0.5) time stepping.

scheme = ql.CrankNicolsonScheme(0.5, op)
scheme.numberOfIterations()

DouglasScheme

class pyquantlib.DouglasScheme

Bases: pybind11_object

Douglas ADI time-stepping scheme.

__init__(theta: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from theta, operator, and boundary conditions.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Douglas ADI time-stepping scheme.

CraigSneydScheme

class pyquantlib.CraigSneydScheme

Bases: pybind11_object

Craig-Sneyd ADI time-stepping scheme.

__init__(theta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from theta, mu, operator, and boundary conditions.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Craig-Sneyd ADI time-stepping scheme.

HundsdorferScheme

class pyquantlib.HundsdorferScheme

Bases: pybind11_object

Hundsdorfer ADI time-stepping scheme.

__init__(theta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from theta, mu, operator, and boundary conditions.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Hundsdorfer ADI time-stepping scheme.

ModifiedCraigSneydScheme

class pyquantlib.ModifiedCraigSneydScheme

Bases: pybind11_object

Modified Craig-Sneyd ADI time-stepping scheme.

__init__(theta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from theta, mu, operator, and boundary conditions.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Modified Craig-Sneyd ADI time-stepping scheme.

MethodOfLinesScheme

class pyquantlib.MethodOfLinesScheme

Bases: pybind11_object

Method of lines time-stepping scheme (Runge-Kutta).

__init__(eps: SupportsFloat | SupportsIndex, relInitStepSize: SupportsFloat | SupportsIndex, map: FdmLinearOpComposite, bcSet: collections.abc.Sequence[FdmBoundaryCondition] = []) None

Constructs from tolerance, initial step size, operator, and BCs.

setStep(dt: SupportsFloat | SupportsIndex) None

Sets the time step size.

step(a: Array, t: SupportsFloat | SupportsIndex) Array

Applies one time step and returns the modified array.

Method of lines (Runge-Kutta) time-stepping scheme.

FDM Inner Value Calculators

Inner value calculators evaluate the payoff at grid points, used by step conditions and solvers.

FdmCellAveragingInnerValue

class pyquantlib.FdmCellAveragingInnerValue

Bases: FdmInnerValueCalculator

Cell-averaging inner value calculator for FDM grids.

__init__(payoff: base.Payoff, mesher: FdmMesher, direction: SupportsInt | SupportsIndex, gridMapping: object = None) None

Constructs with payoff, mesher, direction, and optional grid mapping.

Cell-averaging inner value calculator. Evaluates payoff with optional grid mapping.

payoff = ql.PlainVanillaPayoff(ql.OptionType.Call, 100.0)
calculator = ql.FdmCellAveragingInnerValue(payoff, mesher, 0)

# With custom grid mapping (e.g., exp for log-space)
import math
calculator = ql.FdmCellAveragingInnerValue(payoff, mesher, 0, gridMapping=math.exp)

FdmLogInnerValue

class pyquantlib.FdmLogInnerValue

Bases: FdmCellAveragingInnerValue

Log-space inner value calculator for equity options.

__init__(payoff: base.Payoff, mesher: FdmMesher, direction: SupportsInt | SupportsIndex) None

Constructs with payoff, mesher, and direction.

Log-space inner value calculator for equity options. Applies exp() mapping automatically.

calculator = ql.FdmLogInnerValue(payoff, mesher, 0)

FdmLogBasketInnerValue

class pyquantlib.FdmLogBasketInnerValue

Bases: FdmInnerValueCalculator

Log-space inner value calculator for basket options.

__init__(payoff: QuantLib::BasketPayoff, mesher: FdmMesher) None

Constructs with basket payoff and mesher.

Log-space inner value calculator for basket options.

FdmZeroInnerValue

class pyquantlib.FdmZeroInnerValue

Bases: FdmInnerValueCalculator

Zero inner value calculator (always returns 0).

__init__() None

Always returns zero. Used when no exercise value is needed.

FDM Step Conditions

Step conditions apply constraints or modifications at each time step during the backward PDE solve.

FdmSnapshotCondition

class pyquantlib.FdmSnapshotCondition

Bases: FdmStepCondition

Captures array values at a specific time (for theta calculation).

__init__(t: SupportsFloat | SupportsIndex) None

Constructs with snapshot time.

getTime() float

Returns the snapshot time.

getValues() Array

Returns the captured values.

Captures the solution array at a specified time.

snapshot = ql.FdmSnapshotCondition(0.5)  # capture at t=0.5
snapshot.getTime()     # 0.5
snapshot.getValues()   # Array (available after solve)

FdmAmericanStepCondition

class pyquantlib.FdmAmericanStepCondition

Bases: FdmStepCondition

American-style early exercise step condition.

__init__(mesher: FdmMesher, calculator: base.FdmInnerValueCalculator) None

Constructs with mesher and inner value calculator.

Applies early exercise at every time step (American-style).

condition = ql.FdmAmericanStepCondition(mesher, calculator)

FdmBermudanStepCondition

class pyquantlib.FdmBermudanStepCondition

Bases: FdmStepCondition

Bermudan-style early exercise step condition.

__init__(exerciseDates: collections.abc.Sequence[Date], referenceDate: Date, dayCounter: DayCounter, mesher: FdmMesher, calculator: base.FdmInnerValueCalculator) None

Constructs with exercise dates, reference date, day counter, mesher, and calculator.

exerciseTimes() list[float]

Returns exercise times.

Applies early exercise at discrete dates (Bermudan-style).

condition = ql.FdmBermudanStepCondition(
    exerciseDates, referenceDate, dayCounter, mesher, calculator
)
condition.exerciseTimes()  # list of exercise times

FdmDividendHandler

class pyquantlib.FdmDividendHandler

Bases: FdmStepCondition

Applies discrete dividends as a step condition.

__init__(schedule: collections.abc.Sequence[base.Dividend], mesher: FdmMesher, referenceDate: Date, dayCounter: DayCounter, equityDirection: SupportsInt | SupportsIndex) None

Constructs with dividend schedule, mesher, reference date, day counter, and equity direction.

dividendDates() list[Date]

Returns dividend payment dates.

dividendTimes() list[float]

Returns dividend payment times.

dividends() list[float]

Returns dividend amounts.

Adjusts grid values for discrete dividends during backward solve.

handler = ql.FdmDividendHandler(dividends, mesher, refDate, dc, equityDirection=0)
handler.dividendTimes()   # list of dividend times
handler.dividendDates()   # list of dividend dates
handler.dividends()       # list of Dividend objects

FdmStepConditionComposite

class pyquantlib.FdmStepConditionComposite

Bases: FdmStepCondition

Composite of FDM step conditions.

static joinConditions(snapshotCondition: FdmSnapshotCondition, composite: FdmStepConditionComposite) FdmStepConditionComposite

Joins a snapshot condition with an existing composite.

static vanillaComposite(dividendSchedule: collections.abc.Sequence[base.Dividend], exercise: Exercise, mesher: FdmMesher, calculator: base.FdmInnerValueCalculator, referenceDate: Date, dayCounter: DayCounter) FdmStepConditionComposite

Creates a standard composite for vanilla option FDM pricing.

__init__(stoppingTimes: collections.abc.Sequence[collections.abc.Sequence[SupportsFloat | SupportsIndex]], conditions: collections.abc.Sequence[base.FdmStepCondition]) None

Constructs from stopping times and conditions.

conditions() list[base.FdmStepCondition]

Returns the list of conditions.

stoppingTimes() list[float]

Returns merged stopping times.

Combines multiple step conditions into one. Provides factory methods for common setups.

# Vanilla option composite (handles dividends + exercise)
composite = ql.FdmStepConditionComposite.vanillaComposite(
    dividends, exercise, mesher, calculator, refDate, dc
)
composite.stoppingTimes()    # combined stopping times
composite.conditions()       # list of step conditions

# Join snapshot with composite
joined = ql.FdmStepConditionComposite.joinConditions(snapshot, composite)

FDM Solvers

FdmSolverDesc

class pyquantlib.FdmSolverDesc

Bases: pybind11_object

Descriptor for FDM solver configuration.

__init__(mesher: FdmMesher, bcSet: collections.abc.Sequence[FdmBoundaryCondition], condition: FdmStepConditionComposite, calculator: base.FdmInnerValueCalculator, maturity: SupportsFloat | SupportsIndex, timeSteps: SupportsInt | SupportsIndex, dampingSteps: SupportsInt | SupportsIndex = 0) None

Constructs solver descriptor.

property bcSet
property calculator
property condition
property dampingSteps
property maturity
property mesher
property timeSteps

Descriptor aggregating all inputs for an FDM solver.

desc = ql.FdmSolverDesc(
    mesher=mesher,
    bcSet=[],                  # boundary conditions
    condition=composite,       # step condition composite
    calculator=calculator,     # inner value calculator
    maturity=1.0,
    timeSteps=100,
    dampingSteps=0
)

FdmBackwardSolver

class pyquantlib.FdmBackwardSolver

Bases: pybind11_object

Core FDM backward solver performing PDE rollback.

__init__(map: QuantLib::FdmLinearOpComposite, bcSet: collections.abc.Sequence[QuantLib::BoundaryCondition<QuantLib::FdmLinearOp>] = [], condition: object = None, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f2534371630>) None

Constructs with operator, boundary conditions, step conditions, and scheme.

rollback(a: Array, from_: SupportsFloat | SupportsIndex, to: SupportsFloat | SupportsIndex, steps: SupportsInt | SupportsIndex, dampingSteps: SupportsInt | SupportsIndex) Array

Rolls back array from time ‘from’ to time ‘to’ (returns modified copy).

Core backward PDE solver performing time rollback with a specified scheme.

solver = ql.FdmBackwardSolver(op, bcSet=[], schemeDesc=ql.FdmSchemeDesc.Douglas())
result = solver.rollback(array, from_=1.0, to=0.0, steps=100, dampingSteps=0)

Fdm1DimSolver

class pyquantlib.Fdm1DimSolver

Bases: LazyObject

1D FDM solver with cubic interpolation.

__init__(solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc, op: FdmLinearOpComposite) None

Constructs with solver descriptor, scheme descriptor, and operator.

derivativeX(x: SupportsFloat | SupportsIndex) float

Returns first derivative at coordinate x.

derivativeXX(x: SupportsFloat | SupportsIndex) float

Returns second derivative at coordinate x.

interpolateAt(x: SupportsFloat | SupportsIndex) float

Interpolates solution at coordinate x.

thetaAt(x: SupportsFloat | SupportsIndex) float

Returns theta at coordinate x.

One-dimensional FDM solver with interpolation.

solver = ql.Fdm1DimSolver(desc, ql.FdmSchemeDesc.Douglas(), op)
solver.interpolateAt(x)     # solution value at x
solver.thetaAt(x)           # theta at x
solver.derivativeX(x)       # first derivative
solver.derivativeXX(x)      # second derivative

Fdm2DimSolver

class pyquantlib.Fdm2DimSolver

Bases: LazyObject

2D FDM solver with bicubic spline interpolation.

__init__(solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc, op: FdmLinearOpComposite) None

Constructs with solver descriptor, scheme descriptor, and operator.

derivativeX(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns first derivative w.r.t. x.

derivativeXX(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns second derivative w.r.t. x.

derivativeXY(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns cross derivative w.r.t. x and y.

derivativeY(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns first derivative w.r.t. y.

derivativeYY(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns second derivative w.r.t. y.

interpolateAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Interpolates solution at coordinates (x, y).

thetaAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns theta at coordinates (x, y).

Two-dimensional FDM solver with bilinear interpolation.

solver = ql.Fdm2DimSolver(desc, ql.FdmSchemeDesc.Hundsdorfer(), op)
solver.interpolateAt(x, y)
solver.thetaAt(x, y)
solver.derivativeX(x, y)
solver.derivativeY(x, y)
solver.derivativeXX(x, y)
solver.derivativeYY(x, y)
solver.derivativeXY(x, y)

Fdm3DimSolver

class pyquantlib.Fdm3DimSolver

Bases: LazyObject

3D FDM solver with bicubic spline interpolation.

__init__(solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc, op: FdmLinearOpComposite) None

Constructs with solver descriptor, scheme descriptor, and operator.

interpolateAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex, z: SupportsFloat | SupportsIndex) float

Interpolates solution at coordinates (x, y, z).

thetaAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex, z: SupportsFloat | SupportsIndex) float

Returns theta at coordinates (x, y, z).

Three-dimensional FDM solver.

solver = ql.Fdm3DimSolver(desc, ql.FdmSchemeDesc.Douglas(), op)
solver.interpolateAt(x, y, z)
solver.thetaAt(x, y, z)

FdmBlackScholesSolver

class pyquantlib.FdmBlackScholesSolver

Bases: LazyObject

Specialized 1D FDM solver for Black-Scholes processes.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: GeneralizedBlackScholesProcessHandle, strike: SupportsFloat | SupportsIndex, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341b29b0>, localVol: bool = False, illegalLocalVolOverwrite: object = None, quantoHelper: object = None) -> None

Constructs from process handle.

  1. __init__(process: GeneralizedBlackScholesProcess, strike: SupportsFloat | SupportsIndex, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3eedb0>, localVol: bool = False, illegalLocalVolOverwrite: object = None, quantoHelper: object = None) -> None

Constructs from process (handle created internally).

deltaAt(s: SupportsFloat | SupportsIndex) float

Returns delta at spot price s.

gammaAt(s: SupportsFloat | SupportsIndex) float

Returns gamma at spot price s.

thetaAt(s: SupportsFloat | SupportsIndex) float

Returns theta at spot price s.

valueAt(s: SupportsFloat | SupportsIndex) float

Returns option value at spot price s.

Specialized 1D solver for Black-Scholes processes. Accepts the process directly (no need to build operators manually).

solver = ql.FdmBlackScholesSolver(process, strike, desc)
solver.valueAt(spot)    # option value
solver.deltaAt(spot)    # delta
solver.gammaAt(spot)    # gamma
solver.thetaAt(spot)    # theta

FdmHestonSolver

class pyquantlib.FdmHestonSolver

Bases: LazyObject

Specialized 2D FDM solver for Heston stochastic volatility.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: HestonProcessHandle, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f2534349430>, quantoHelper: object = None, leverageFct: object = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from Heston process handle.

  1. __init__(process: HestonProcess, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341d2fb0>, quantoHelper: object = None, leverageFct: object = None, mixingFactor: SupportsFloat | SupportsIndex = 1.0) -> None

Constructs from Heston process (handle created internally).

deltaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns delta at spot s and variance v.

gammaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns gamma at spot s and variance v.

meanVarianceDeltaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns mean-variance adjusted delta.

meanVarianceGammaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns mean-variance adjusted gamma.

thetaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns theta at spot s and variance v.

valueAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns option value at spot s and variance v.

FdmBatesSolver

class pyquantlib.FdmBatesSolver

Bases: LazyObject

Specialized 2D FDM solver for Bates jump-diffusion model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(process: BatesProcessHandle, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341a1ab0>, integroIntegrationOrder: SupportsInt | SupportsIndex = 12, quantoHelper: object = None) -> None

Constructs from Bates process handle.

  1. __init__(process: BatesProcess, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3afc70>, integroIntegrationOrder: SupportsInt | SupportsIndex = 12, quantoHelper: object = None) -> None

Constructs from Bates process (handle created internally).

deltaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns delta at spot s and variance v.

gammaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns gamma at spot s and variance v.

thetaAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns theta at spot s and variance v.

valueAt(s: SupportsFloat | SupportsIndex, v: SupportsFloat | SupportsIndex) float

Returns option value at spot s and variance v.

FdmHullWhiteSolver

class pyquantlib.FdmHullWhiteSolver

Bases: LazyObject

Specialized 1D FDM solver for Hull-White interest rate model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: QuantLib::Handle<QuantLib::HullWhite>, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341c0730>) -> None

Constructs from Hull-White model handle.

  1. __init__(model: QuantLib::HullWhite, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253438ed70>) -> None

Constructs from Hull-White model (handle created internally).

valueAt(r: SupportsFloat | SupportsIndex) float

Returns option value at interest rate r.

FdmG2Solver

class pyquantlib.FdmG2Solver

Bases: LazyObject

Specialized 2D FDM solver for G2++ two-factor interest rate model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(model: QuantLib::Handle<QuantLib::G2>, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f253418ebb0>) -> None

Constructs from G2 model handle.

  1. __init__(model: QuantLib::G2, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341a2ff0>) -> None

Constructs from G2 model (handle created internally).

valueAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns option value at state variables x and y.

Fdm2dBlackScholesSolver

class pyquantlib.Fdm2dBlackScholesSolver

Bases: LazyObject

Specialized 2D FDM solver for two-asset Black-Scholes.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(p1: GeneralizedBlackScholesProcessHandle, p2: GeneralizedBlackScholesProcessHandle, correlation: SupportsFloat | SupportsIndex, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f252f3d7630>, localVol: bool = False, illegalLocalVolOverwrite: object = None) -> None

Constructs from two BS process handles and correlation.

  1. __init__(p1: GeneralizedBlackScholesProcess, p2: GeneralizedBlackScholesProcess, correlation: SupportsFloat | SupportsIndex, solverDesc: FdmSolverDesc, schemeDesc: FdmSchemeDesc = <FdmSchemeDesc object at 0x7f25341feff0>, localVol: bool = False, illegalLocalVolOverwrite: object = None) -> None

Constructs from two BS processes (handles created internally).

deltaXat(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns delta with respect to first asset.

deltaYat(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns delta with respect to second asset.

gammaXYat(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns cross-gamma between assets.

gammaXat(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns gamma with respect to first asset.

gammaYat(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns gamma with respect to second asset.

thetaAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns theta.

valueAt(x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) float

Returns option value at spot prices x and y.

Boundary Conditions

FdmDirichletBoundary

class pyquantlib.FdmDirichletBoundary

Bases: FdmBoundaryCondition

Dirichlet boundary condition for FDM. Sets a fixed value on a boundary.

__init__(mesher: FdmMesher, valueOnBoundary: SupportsFloat | SupportsIndex, direction: SupportsInt | SupportsIndex, side: BoundaryConditionSide) None

Constructs with mesher, boundary value, direction, and side.

FdmDiscountDirichletBoundary

class pyquantlib.FdmDiscountDirichletBoundary

Bases: FdmBoundaryCondition

Discounted Dirichlet boundary condition for FDM.

__init__(mesher: FdmMesher, rTS: base.YieldTermStructure, maturityTime: SupportsFloat | SupportsIndex, valueOnBoundary: SupportsFloat | SupportsIndex, direction: SupportsInt | SupportsIndex, side: BoundaryConditionSide) None

Constructs with mesher, yield curve, maturity time, boundary value, direction, and side.

FdmTimeDepDirichletBoundary

class pyquantlib.FdmTimeDepDirichletBoundary

Bases: FdmBoundaryCondition

Time-dependent Dirichlet boundary condition for FDM.

__init__(mesher: FdmMesher, valueOnBoundary: collections.abc.Callable[[SupportsFloat | SupportsIndex], float], direction: SupportsInt | SupportsIndex, side: BoundaryConditionSide) None

Constructs with scalar time-dependent boundary value function.

Additional Meshers

ExponentialJump1dMesher

class pyquantlib.ExponentialJump1dMesher

Bases: Fdm1dMesher

1D mesher for exponential jump-diffusion processes.

__init__(steps: SupportsInt | SupportsIndex, beta: SupportsFloat | SupportsIndex, jumpIntensity: SupportsFloat | SupportsIndex, eta: SupportsFloat | SupportsIndex, eps: SupportsFloat | SupportsIndex = 0.001) None

Constructs with step count and jump parameters.

jumpSizeDensity(*args, **kwargs)

Overloaded function.

  1. jumpSizeDensity(x: SupportsFloat | SupportsIndex) -> float

Asymptotic jump size density (t -> infinity).

  1. jumpSizeDensity(x: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) -> float

Time-dependent jump size density.

jumpSizeDistribution(*args, **kwargs)

Overloaded function.

  1. jumpSizeDistribution(x: SupportsFloat | SupportsIndex) -> float

Asymptotic jump size distribution.

  1. jumpSizeDistribution(x: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) -> float

Time-dependent jump size distribution.

Glued1dMesher

class pyquantlib.Glued1dMesher

Bases: Fdm1dMesher

Combines two 1D meshers into one by gluing at their boundary.

__init__(leftMesher: Fdm1dMesher, rightMesher: Fdm1dMesher) None

Constructs by gluing left and right meshers.

Additional Step Conditions

FdmArithmeticAverageCondition

class pyquantlib.FdmArithmeticAverageCondition

Bases: FdmStepCondition

Arithmetic average step condition for Asian option FDM pricing.

__init__(averageTimes: collections.abc.Sequence[SupportsFloat | SupportsIndex], runningAverage: SupportsFloat | SupportsIndex, pastFixings: SupportsInt | SupportsIndex, mesher: FdmMesher, equityDirection: SupportsInt | SupportsIndex) None

Constructs with averaging times, running average, past fixings, mesher, and equity direction index.

FdmSimpleSwingCondition

class pyquantlib.FdmSimpleSwingCondition

Bases: FdmStepCondition

Simple swing option step condition for FDM pricing.

__init__(exerciseTimes: collections.abc.Sequence[SupportsFloat | SupportsIndex], mesher: FdmMesher, calculator: base.FdmInnerValueCalculator, swingDirection: SupportsInt | SupportsIndex, minExercises: SupportsInt | SupportsIndex = 0) None

Constructs with exercise times, mesher, calculator, swing direction index, and minimum exercises.

Additional Operators

NthOrderDerivativeOp

class pyquantlib.NthOrderDerivativeOp

Bases: FdmLinearOp

Nth-order finite difference derivative operator.

__init__(direction: SupportsInt | SupportsIndex, order: SupportsInt | SupportsIndex, nPoints: SupportsInt | SupportsIndex, mesher: FdmMesher) None

Constructs with direction, derivative order, stencil width, and mesher.

Risk-Neutral Density Calculators

Compute probability density, cumulative distribution, and inverse CDF under the risk-neutral measure.

BSMRNDCalculator

class pyquantlib.BSMRNDCalculator

Bases: RiskNeutralDensityCalculator

Black-Scholes-Merton risk-neutral density calculator.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs with a Black-Scholes process.

Black-Scholes-Merton risk-neutral density calculator. Operates in log-space (x = ln(S)).

import math
calc = ql.BSMRNDCalculator(process)
calc.pdf(math.log(100.0), 1.0)     # density at ln(S)=ln(100), t=1
calc.cdf(math.log(100.0), 1.0)     # CDF at ln(S)=ln(100), t=1
calc.invcdf(0.5, 1.0)              # inverse CDF (returns ln(S))

GBSMRNDCalculator

class pyquantlib.GBSMRNDCalculator

Bases: RiskNeutralDensityCalculator

Generalized Black-Scholes-Merton risk-neutral density calculator.

__init__(process: GeneralizedBlackScholesProcess) None

Constructs with a generalized Black-Scholes process.

Generalized BSM risk-neutral density calculator. Operates in spot-space (x = S).

calc = ql.GBSMRNDCalculator(process)
calc.pdf(100.0, 1.0)     # density at S=100, t=1
calc.cdf(100.0, 1.0)     # CDF at S=100, t=1
calc.invcdf(0.5, 1.0)    # inverse CDF (returns S)

HestonRNDCalculator

class pyquantlib.HestonRNDCalculator

Bases: RiskNeutralDensityCalculator

Heston model risk-neutral density calculator.

__init__(hestonProcess: HestonProcess, integrationEps: SupportsFloat | SupportsIndex = 1e-06, maxIntegrationIterations: SupportsInt | SupportsIndex = 10000) None

Constructs with Heston process and integration parameters.

Heston stochastic volatility risk-neutral density calculator. Operates in log-space (x = ln(S)).

calc = ql.HestonRNDCalculator(heston_process, integrationEps=1e-8, maxIntegrationIterations=100000)
calc.pdf(math.log(100.0), 1.0)
calc.cdf(math.log(100.0), 1.0)

CEVRNDCalculator

class pyquantlib.CEVRNDCalculator

Bases: RiskNeutralDensityCalculator

Constant Elasticity of Variance risk-neutral density calculator.

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

Constructs with forward price, alpha, and beta.

massAtZero(t: SupportsFloat | SupportsIndex) float

Returns probability mass at zero for time t.

Constant Elasticity of Variance risk-neutral density calculator.

calc = ql.CEVRNDCalculator(f0=100.0, alpha=0.3, beta=0.5)
calc.pdf(100.0, 1.0)
calc.cdf(100.0, 1.0)
calc.massAtZero(1.0)   # probability mass at zero

SquareRootProcessRNDCalculator

class pyquantlib.SquareRootProcessRNDCalculator

Bases: RiskNeutralDensityCalculator

Square-root process risk-neutral density calculator.

__init__(v0: SupportsFloat | SupportsIndex, kappa: SupportsFloat | SupportsIndex, theta: SupportsFloat | SupportsIndex, sigma: SupportsFloat | SupportsIndex) None

Constructs with initial value, mean reversion, long-run mean, and volatility.

stationary_cdf(v: SupportsFloat | SupportsIndex) float

Returns stationary cumulative distribution at v.

stationary_invcdf(q: SupportsFloat | SupportsIndex) float

Returns stationary inverse CDF at quantile q.

stationary_pdf(v: SupportsFloat | SupportsIndex) float

Returns stationary probability density at v.

Square-root (CIR) process risk-neutral density calculator. Includes stationary distribution methods.

calc = ql.SquareRootProcessRNDCalculator(v0=0.04, kappa=1.0, theta=0.04, sigma=0.2)
calc.pdf(0.04, 1.0)
calc.cdf(0.04, 1.0)

# Stationary distribution
calc.stationary_pdf(0.04)
calc.stationary_cdf(0.04)
calc.stationary_invcdf(0.5)

LocalVolRNDCalculator

class pyquantlib.LocalVolRNDCalculator

Bases: RiskNeutralDensityCalculator

Risk-neutral density calculator using local volatility and FDM.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(spot: base.Quote, rTS: base.YieldTermStructure, qTS: base.YieldTermStructure, localVol: base.LocalVolTermStructure, xGrid: SupportsInt | SupportsIndex = 101, tGrid: SupportsInt | SupportsIndex = 51, x0Density: SupportsFloat | SupportsIndex = 0.1, localVolProbEps: SupportsFloat | SupportsIndex = 1e-06, maxIter: SupportsInt | SupportsIndex = 10000, gaussianStepSize: object = None) -> None

Constructs from spot, yield curves, local vol surface, and grid parameters.

  1. __init__(spot: base.Quote, rTS: base.YieldTermStructure, qTS: base.YieldTermStructure, localVol: base.LocalVolTermStructure, timeGrid: TimeGrid, xGrid: SupportsInt | SupportsIndex = 101, x0Density: SupportsFloat | SupportsIndex = 0.1, eps: SupportsFloat | SupportsIndex = 1e-06, maxIter: SupportsInt | SupportsIndex = 10000, gaussianStepSize: object = None) -> None

Constructs from spot, yield curves, local vol, and explicit time grid.

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

Returns the cumulative distribution at x and time t.

invcdf(p: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) float

Returns the inverse CDF at probability p and time t.

mesher(t: SupportsFloat | SupportsIndex) Fdm1dMesher

Returns the 1D mesher at time t.

pdf(x: SupportsFloat | SupportsIndex, t: SupportsFloat | SupportsIndex) float

Returns the probability density at x and time t.

timeGrid() TimeGrid

Returns the time grid.

Local volatility-based RND calculator using FDM. Operates in log-space (x = ln(S)).

Note

Abstract base classes FdmLinearOp, FdmLinearOpComposite, BrownianGenerator, BrownianGeneratorFactory, FdmMesher, FdmStepCondition, FdmInnerValueCalculator, and RiskNeutralDensityCalculator are available in pyquantlib.base for type checking.