Skip to main content

Module sabr

Module sabr 

Expand description

SABR implied volatilities and the at-the-money α solve that lets a surface be parameterised by the ATM vol a desk quotes.

The model is dF = α̂(F + s)^β dW₁, dα̂ = να̂ dW₂, dW₁dW₂ = ρ dt, under the forward’s own measure. Three readings of its implied vol:

  • SabrFormula::HaganLognormal — eq. 2.17a: a Black vol of F + s struck at K + s.
  • SabrFormula::HaganNormal — eq. B.69a: a Bachelier vol, forward and strike shifted by s.
  • SabrFormula::NormalBetaZero — eq. B.59a with a constant local vol: α·ζ/x(ζ)·(1 + (2 − 3ρ²)ν²τ/24), ζ = (ν/α)(F − K). Defined at any forward and strike, negative ones included; β and the shift are not read.

Stability. Every expression is generic in the AD scalar and stays exact where the closed form is 0/0 or cancels:

  • at the money z/x(z) is its Taylor series 1 − ρz/2 + (2 − 3ρ²)z²/12 + (5ρ − 6ρ³)z³/24 (from the Legendre series of 1/√(1 − 2ρu + u²), exact through third order, so Jet2 is exact there), and ln(F/K) is ln_1p((F − K)/K);
  • x(z) is taken as ln_1p of its excess over one, with √B − 1 written (z² − 2ρz)/(√B + 1); for z < 0, where √B + z − ρ cancels, in its conjugate form ln[(1 + ρ)/(√B − z + ρ)] (the identity B − (z − ρ)² = 1 − ρ²), so no branch takes the log of a cancelled sum;
  • a vol the expansion’s correction takes to zero or below is refused, not floored: a floored branch is one an adjoint would differentiate silently.

Argument order is (α, β, ρ, ν) throughout helixio; a fixture stated in another order maps it explicitly.

Structs§

SabrParams
The SABR parameters a smile is read at.

Enums§

SabrError
SABR inputs the formulas cannot evaluate.
SabrFormula
Which expansion of the SABR implied vol is read.

Constants§

RHO_BOUND
The largest |ρ| admitted: at ±1 the map x(z) is singular.
SMALL_Z 🔒
Below this |z| the ratio z/x(z) is its Taylor series through z³. Its truncation is O(z⁴) and the closed form’s own round-off O(ε/z); both are under 1e-12 at the switch.

Functions§

alpha_from_atm
The α that reproduces atm_vol at forward: the smallest positive real root of the ATM cubic, polished by Newton on passive values, then carried into the mode by two Newton steps on the cubic with its coefficients in the mode — exact derivatives to second order (the implicit function theorem, without differentiating a root search).
atm_cubic 🔒
The ATM cubic c₁α³ + c₂α² + c₃α + c₄ (West 2005) whose root is the α that reproduces atm_vol at forward — σ_ATM(α) multiplied through by the ATM factor. Coefficients in the mode.
check 🔒
cubic_at 🔒
log_moneyness 🔒
ln(f/k) for positive f, k, as ln_1p((f − k)/k).
pow 🔒
x^e for positive x.
real_roots 🔒
The real roots of a x³ + b x² + c x + d, degenerating to the quadratic and linear cases when the leading coefficients vanish.
sabr_vol
The SABR implied vol of strike at forward and expiry_years under formula.
z_over_x 🔒
z / x(z), x(z) = ln[(√(1 − 2ρz + z²) + z − ρ)/(1 − ρ)], stable at every z: its Taylor series near zero, the conjugate form for z < 0.