Module survival
Expand description
Credit term structures: survival probability and hazard rate.
A separate closed set from the discount families, and deliberately so.
The vocabulary here is survival probability and hazard rate, not discount
factor and zero rate; sharing one enum would mean one of the two carrying
methods it cannot answer. Everything else is the same discipline as the
discount side — storage holds f64 and no AD state, a lift produces a mode
view that borrows it, and the evaluation trait says only what a curve is.
Each family carries its own day count. That is not dead configuration: a hazard rate is quoted under a convention, and ISDA names ACT/365F for the integration specifically, so the curve has to know which one it means.
Macros§
- dispatch 🔒
- Dispatch one
SurvivalProbabilitymethod across every variant.
Structs§
- Density
Survival - A survival curve stated by its default density,
f(t) = −dS/dt. - Density
Survival View DensitySurvivallifted into one pricing mode.- Flat
Hazard - A constant-hazard curve:
S(t) = exp(−h·τ),h(t) = h. - Flat
Hazard View FlatHazardlifted into one pricing mode.- Isda
Survival - The ISDA-standard piecewise-flat-hazard curve — what a CDS bootstrap returns.
- Isda
Survival View IsdaSurvivallifted into one pricing mode.- Piecewise
Survival - A survival curve stored as log-survival at dated pillars — the credit
analogue of the piecewise discount curve, and interchangeable with
IsdaSurvivalbehind the evaluation trait. - Piecewise
Survival View PiecewiseSurvivallifted into one pricing mode.- Scaled
Survival - A base credit curve whose hazard is multiplied by a piecewise-constant
term structure:
β_kon the segment ending at the k-th scaling pillar (right-closed, as the ISDA family’s segments are), the lastβpast it. - Scaled
Survival View ScaledSurvivallifted into one pricing mode.- Shocked
Survival - A base credit curve under a named parallel hazard shock:
h(t) + Δ, and soS(t)·exp(−Δ·τ). - Shocked
Survival View ShockedSurvivallifted into one pricing mode.
Enums§
- Survival
- A stored credit term structure. Passive parameters, no AD state.
- Survival
View - A
Survivallifted into one pricing mode.
Traits§
- Survival
Probability - What a credit pricer sees. Two questions, one mode, no AD vocabulary.
Functions§
- fast_
basis 🔒 - The constant divisor
Kfor a convention that is exactlyactual_days / K, orNonefor every convention that is not — the classification that lets an ordinal query measure time by integer subtraction. Exhaustive with no wildcard on purpose: a new convention must be classified here or the crate stops compiling, because defaulting one into the fast path would return a plausible wrong year fraction on every credit query rather than failing. - year_
fraction_ 🔒fast - The year fraction from
from_ordinaltoordinalunder a fast basis — bit-identical today_count.year_fraction(from, to)for the conventionsfast_basisadmits, becauseactual_daysis exactly this integer difference widened and divided.