Skip to main content

Module rate_vol

Module rate_vol 

Expand description

Rate volatility surfaces: at-the-money vols on an expiry × tenor grid, as a market-data store.

A swaption market quotes one vol per (option expiry, underlying tenor) under an explicit VolConvention — normal (Bachelier) or lognormal (Black-76) — and the convention is authoritative: the engine that prices off the surface is chosen by the data, never inferred from the rate level. Both axes are year fractions, not dates, because the same grid serves a second reader: a bond option queries the tenor axis at the underlying’s forward modified duration, which has no date. The surface is unit-agnostic on purpose; the reader decides what it passes.

Like the FX vol store this one holds passive f64 node vols and lifts them: a view interpolates in the pricing mode, so a queried vol carries the adjoints of the nodes it read and vega per node arrives on its own risk axis from the ordinary risk pass.

Interpolation (the named rule): linear in vol across the tenor axis, then linear in total variance σ²·T across the expiry axis, with flat vol extrapolation beyond either grid edge. A uniform bump of every node therefore does not move an interpolated vol by the same amount — node vega is what a desk hedges with, and the sum of node vegas is not the vega of the interpolated vol.

Structs§

RateVolSurface
A rate vol surface over (expiry_years, tenor_years), optionally carrying a smile in absolute rate strikes.
RateVolView
A surface lifted into mode R.

Enums§

RateSmile
A rate smile as a registry holds it: a grid, or a SABR surface beside it.
RateSmileRef
A rate smile as a registry holds it, borrowed.
RateSmileView
A rate smile lifted into mode R, whichever representation it is.
RateVolError
A surface that cannot be built or cannot answer.
StrikeAxis
What the numbers on a surface’s strike axis measure.
VolConvention
The quoting convention a rate vol is expressed in.

Functions§

ascending_axis 🔒
Strictly ascending, finite, non-empty.
interpolate 🔒
Linear interpolation of vals over nodes at x, flat outside, in the mode. The coordinate is passive: the segment and the weight are plain arithmetic and only the node vols carry derivatives.
interpolate_in 🔒
interpolate with the coordinate itself in the mode: the segment is chosen on the passive value, the weight is mode arithmetic, so a query at a market-dependent coordinate (a bond option’s forward duration) carries the coordinate’s adjoints as well as the nodes’.
rate_basis_points
A rate strike as basis points — the exactly comparable form a risk key carries, signed because a cap market quotes a strike below zero. Strikes are small rates, so the product is a modest integer and the cast can neither truncate nor overflow.
years_basis_points
A year fraction as basis points of a year — the exactly comparable form a risk key carries. Grid pillars are small positive year counts, so the product is a modest positive integer and the cast can neither truncate nor lose a sign.