Expand description
The central sensitivity engine: one implementation of bump-and-reprice Greeks, one batch entry point, engine-native fast paths.
Every Greek request routes through here. Engines fall into four routes:
- Grid (finite difference): delta/gamma/theta are read off the solved grid; the higher orders difference whole grid solutions (vanna = d(grid delta)/dσ), which is smoother than price stencils.
- Tree (binomial): same idea on the lattice — value and
delta/gamma/theta from one backward pass, higher orders from bumped
tree solutions (
binomial::pricing_resultshares seven passes). - Analytic (Black-Scholes engine): the payoff-aware
BlackScholesPricerwith closed forms where they exist (vanilla vanna/charm/zomma/volga, the Black-76 futures family). - Bump: everything else (Monte Carlo, Barone-Adesi-Whaley,
Bjerksund-Stensland, analytic Heston) shares the one set of
central-difference stencils below over
EquityOption::price_with— the engine’s repricing kernel, which guarantees common random numbers under Monte Carlo. What used to be four hand-written copies of every stencil now differs only in a [BumpPolicy]: a per-engine table of bump sizes (preserved exactly, so values are bit-identical to the former per-engine code).
The batch entry point pricing_result shares evaluations across
Greeks through a reprice cache: one Monte Carlo price() costs 17
simulations instead of 28, one finite-difference price() costs 9
solves instead of ~16.
Within the bump route, engines expose native fast paths where
their structure allows a better estimator than a stencil:
Monte Carlo pathwise delta/vega on the terminal-GBM route
([montecarlo::pathwise_delta_vega] — one simulation, no
finite-difference bias), the adjoint (AAD) sweep on the
path-simulation routes with continuous payoffs
([montecarlo::aad_greeks] — delta, vega and rho from one backward
pass per path over the core::aad tape), the
Heston vanilla delta read off the price integration
([heston::native_vanilla_delta]), and the Barone-Adesi-Whaley
boundary solve shared across the spot ladder ([baw::SpotKernel],
bit-identical values).
Functions§
- charm
- delta
- gamma
- gamma_p
- Delta elasticity
S * gamma / delta;NaNwhen delta is zero. - pricing_
result - Value plus all reported Greeks, sharing work across them:
grid/tree engines harvest delta/gamma/theta from the base solve, and
bump engines reuse every shifted reprice that appears in more than one
stencil through the [
Repricer] cache. - rho
- theta
- vanna
- vega
- volga
- zomma