Skip to main content

Module lattice

Module lattice 

Expand description

The Hull-White trinomial lattice, written once against Scalar.

This is the general trinomial lattice — per-step Δt from an exact-dates TimeGrid, variance-matched node spacing Δx_{i+1} = √(3·v²_i), mean-centered branching with a precomputed branch table, and per-slice displacements α_i fitted by Arrow-Debreu forward induction to reprice the curve — and the geometry is active. Spacing and branch probabilities are not passive f64 with vega taken by bump-recalibration; mean reversion and volatility arrive as market inputs in the pricing mode, so ∂PV/∂σ and ∂PV/∂a fall out of the ordinary risk pass and Jet2 reaches σ-gamma through this same body. The passive instantiation is plain f64 arithmetic.

The one discrete ingredient — the branch re-centering index k — is an index, not a value: it is computed from passive magnitudes (value()) and stays an integer, while the smooth remainder u that feeds the probabilities is computed in the mode. Derivatives are exact away from re-centering boundaries, a measure-zero kink set that a bump scheme steps over silently.

Structs§

HullWhiteLattice
The Hull-White trinomial lattice at one mode. Geometry, displacements and rollback values are all R; only node indices are integers.
StepCredit
An issuer’s credit on a lattice’s steps: for step i (slice i to i + 1), the survival over it S(tᵢ₊₁)/S(tᵢ) and the recovery a default in it pays at its end, R·F(tᵢ)·(1 − S(tᵢ₊₁)/S(tᵢ)) on the face alive at its start. Branch probabilities sum to one, so the recovery needs none.
TimeGrid
The lattice time grid: slice dates and their year fractions from valuation.

Constants§

DEFAULT_STEPS_PER_YEAR
A sensible default lattice resolution: within a few × 10⁻³ of analytic prices by ~70 steps/year on convergence runs; 50 balances price and accuracy for production use.

Traits§

DiscretizedAsset
A product valued by backward induction on a HullWhiteLattice. The lattice rolls it back; the asset injects its cashflows and exercise at each slice, in the pricing mode.

Functions§

compounded_oas
Quotes a continuously compounded spread at a periodic frequency: s_m = m·(e^{s/m} − 1) with m the periods per year. The engine’s canonical spread (the OAS the lattice discounts with) is continuous; this conversion is presentation only.
drift_convexity 🔒
The drift convexity C(t) the displacement carries over the forward, α(t) = f(0, t) + C(t): (σ²/2a²)(1 − e^{−at})² for a flat volatility (½σ²t² as a → 0), the term’s own C(t) otherwise.
step_variance 🔒
The conditional variance of x over one step from t0 to t1: σ²(1−e^{−2a·dt})/(2a) for a flat volatility, degenerating to σ²·dt as a → 0 (the branch selected on the passive value); under a term, the term’s own V(t0, t1), so a piece boundary inside the step is integrated over it rather than snapped to a slice. The arithmetic runs in the mode.
yf 🔒
Act/365F year fraction — the lattice’s time metric.