Skip to main content

Module sabr

Module sabr 

Expand description

SABR calibration from a grid rate smile: one slice per smiled (expiry, tenor) node, and the record each fit keeps so its parameter risk can be read back onto the quotes that built it.

Per slice. The quoted vols at the node’s strikes (absolute, or the forward plus each spread on a spread cube) are restated in the formula’s convention where the grid’s differs, by repricing at the slice forward. Where the grid quotes the forward itself (a zero spread, or an absolute strike at the forward) that quote is σ_ATM and only ρ and ν are fitted; otherwise σ_ATM is fitted with them. Levenberg–Marquardt runs over smooth bijections — ρ = 0.9999·tanh(x), ν = softplus(y), σ_ATM = softplus(w) — on vega-weighted vol residuals, its Jacobian seeded through Jet1. It starts from a three-point explicit guess read off Hagan’s small-moneyness expansion (a quadratic in log-moneyness through the three strikes nearest the forward, solved for ρ and ν), and restarts from a deterministic Halton sequence until a fit is accepted or the restart budget is spent.

The quote Jacobian is the implicit function theorem on the converged slice’s first-order condition — never a derivative of the optimiser. It keeps the residual-curvature term and the weights’ own dependence on the quotes, so it is exact off a perfect fit.

Structs§

FittedNode 🔒
One fitted cube node: its diagnostics, its parameters, its rows against the cube’s quotes, and its response to a σ_ATM held from an ATM matrix.
QuoteRef 🔒
One grid quote a fit read: its node, and its strike coordinate on the grid’s own axis — none for an ATM matrix, which quotes no smile.
SabrFit
A fitted surface and its slices.
SabrFitRecord
What a fitted SABR surface keeps of its calibration: per node, the quotes it was fitted to and the Jacobian of its parameters with respect to them.
SabrSliceFit
One fitted slice’s parameters and quality.
SabrSliceRecord
One node’s fit: which grid quotes its parameters depend on, and d(σ_ATM, ρ, ν)/d(quote) for each.
SabrSpec
How a grid smile is fitted to SABR.
Slice 🔒
One slice’s market data in the formula’s convention.

Enums§

Atm 🔒
Where a slice’s σ_ATM comes from.
SabrCalibrationError
A grid that could not be fitted.

Constants§

BUTTERFLY_STRIKES 🔒
Strikes on the butterfly check grid.
HALTON_SEED 🔒
Halton restarts start this far into the sequence — the conventional seed.
RHO_SCALE 🔒
ρ = RHO_SCALE·tanh(x) keeps ρ inside the formulas’ bound.

Functions§

bachelier_implied_vol 🔒
A Bachelier vol implying the undiscounted Bachelier call price, by bisection on its monotone vega.
calibrate_sabr
Fits SABR to every (expiry, tenor) node of the smiled grid, each slice at its forward — forwards[expiry][tenor], one row per grid expiry and one value per grid tenor. A slice whose grid quotes the forward itself holds σ_ATM at that quote; any other fits it with ρ and ν.
calibrate_sabr_with_atm
Fits SABR on a dense ATM matrix with a sparse smile cube. σ_ATM comes from atm at every one of its nodes; ρ and ν are fitted at the cube’s nodes with σ_ATM held at the matrix’s quote there, and read onto the matrix’s nodes bilinearly, flat beyond the cube’s edges — the surface’s own read rule. The surface lives on the matrix’s nodes; its fit record maps each node onto the matrix quotes and the cube quotes its parameters depend on.
caplet_forwards
The caplet expiries and forwards on market of the cap on index from effective to termination — the caplets strip_caplet_vols strips, filtered as its nodes are (one per caplet still to fix, a repeated expiry dropped), so the rows line up with the surface it strips. The forwards come one per row, the shape calibrate_sabr reads off a one-tenor cap surface.
check_shape 🔒
Checks forwards has one row per expiry and one value per tenor.
fit_cube 🔒
Fits every node of the smiled cube, σ_ATM held where held gives one.
radical_inverse 🔒
The radical inverse of index in base — one Halton coordinate.
restate 🔒
A quote in convention from restated in the spec’s, by repricing a call at the slice forward — the lognormal side read at the spec’s shift — and the restatement’s slope in the quote: the ratio of the two vegas, since the price is held.
restate_matrix 🔒
An ATM matrix’s quotes restated in the spec’s convention at their forwards, node order, each with its restatement’s slope.
softplus 🔒
softplus_inverse 🔒
softplus_jet 🔒
swaption_forwards
The forward swap rate at each (expiry, tenor): the par rate on market of the swap template drafts starting expiry after spot and running tenor — the underlying a European swaption on that node exercises into. One row per expiry, one value per tenor: the shape calibrate_sabr reads.
vega_of 🔒
The undiscounted vega of a call at vol quoted in convention — the lognormal side read at shift — in mode R.