Expand description
Recombining binomial lattices, asset-class agnostic.
Every classic parameterization reduces to one recombining structure:
a node after j up-moves out of i steps sits at
S(i, j) = S0 * exp(j*log_up + (i-j)*log_down), with up-probability
p_up — LatticeParams. The BinomialTreeType enum supplies the
(log_up, log_down, p_up) triple for Cox-Ross-Rubinstein, Jarrow-Rudd,
Tian, Trigeorgis, Leisen-Reimer (Peizer-Pratt method 2, strike-aware,
second-order smooth convergence) and the equal-probability additive
tree (Clewlow-Strickland / QuantLib’s AdditiveEQPBinomialTree).
Three engines share the parameterization:
price_backward— the production engine: a rolling one-dimensional value array (O(n) memory, no tree materialized) with the layer spot levels rebuilt from two precomputed power tables.price_backward_with_greeks— the same rolling pass, additionally keeping the first two layers so the value and the tree delta/gamma/theta come from a single induction.price_with_diagnostics— the debug engine: keeps the full spot and value trees, records the early-exercise boundary per layer, tree Greeks read off the first layers, and wall-clock time.
convergence_study prices across a ladder of step counts (with
per-point timing) to expose each scheme’s convergence behavior — CRR
oscillates at first order, Leisen-Reimer converges smoothly at second.
Payoffs and early exercise enter as closures, so the same lattice prices equity payoffs today and other asset classes later.
Structs§
- Convergence
Point - One rung of a convergence ladder.
- Lattice
Config - Lattice engine configuration carried by an instrument.
- Lattice
Diagnostics - Everything the debug lattice records beyond the price.
- Lattice
Params - The general recombining step:
S(i, j) = S0 e^{j lu + (i-j) ld}, up with probabilityp_up. - Lattice
Solution - Value and the tree Greeks read off a single backward pass.
- Term
Lattice - A recombining binomial lattice under time-dependent parameters: term structures of rates, carry and volatility applied directly on the tree.
- Trinomial
Branch - One node’s branching: the middle child’s absolute index on the
next layer and the probabilities onto
(target+1, target, target-1). - Trinomial
Lattice - A recombining trinomial lattice over the integer state grid
x_j = j * dx(the caller mapsjto its own state, e.g.r(i, j) = alpha_i + j * dxfor a fitted short-rate tree).
Enums§
- Binomial
Tree Type - The lattice parameterization: how
(u, d, p)are chosen.
Functions§
- convergence_
study - Price the same contract across a ladder of step counts on the optimized engine, timing each rung — the raw material for studying a scheme’s convergence order and oscillation.
- diffusion_
branching - Moment-matched branching for a constant-coefficient diffusion
dx_t = nu dt + sigma dWon spacingdx(Boyle / Kamrad-Ritchken:dx = sigma sqrt(3 dt)gives the classic 1/6, 2/3, 1/6 weights at zero drift). Same rule at every node — the equity-style tree. - hull_
white_ branching - Hull-White branching for the mean-reverting state
dx_t = -a x_t dt + sigma dWwithdx = sigma sqrt(3 dt): standard branching in the interior, switching to downward branching at+j_capand upward at-j_capso probabilities stay positive (Hull’sj_max = ceil(0.184 / (a dt))is the usual cap). - hull_
white_ j_ cap - Hull’s recommended clamp for
hull_white_branching. - price_
backward - Backward induction on a rolling one-dimensional array: O(n) memory, O(n^2) work, spot levels rebuilt from two precomputed power tables.
- price_
backward_ with_ greeks - The same rolling-array induction as
price_backward(identical price, bit for bit) that additionally keeps the first two layers, so the value and the tree delta/gamma/theta come out of one pass — no re-pricing per Greek. - price_
with_ diagnostics - The debug engine: same induction as
price_backwardbut keeping every layer, the exercise boundary, tree Greeks and timing.