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§
- Rate
VolSurface - A rate vol surface over
(expiry_years, tenor_years), optionally carrying a smile in absolute rate strikes. - Rate
VolView - A surface lifted into mode
R.
Enums§
- Rate
Smile - A rate smile as a registry holds it: a grid, or a SABR surface beside it.
- Rate
Smile Ref - A rate smile as a registry holds it, borrowed.
- Rate
Smile View - A rate smile lifted into mode
R, whichever representation it is. - Rate
VolError - A surface that cannot be built or cannot answer.
- Strike
Axis - 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
valsovernodesatx, 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 🔒 interpolatewith 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.