Skip to main content

spread_over_curve

Function spread_over_curve 

pub fn spread_over_curve<C: YieldCurve<f64>>(
    bond: &FixedRateBond,
    curve: &C,
    dirty: f64,
    settlement: NaiveDate,
    basis: YieldBasis,
) -> Result<f64, SpreadSolveError>
Expand description

The bond’s yield less curve’s zero rate at the bond’s maturity, both on basis.

The one kernel behind G-spread and I-spread. The two measures differ by the curve a caller passes and by nothing else, so this keeps both verbs while keeping one implementation.

The reference is the curve’s zero rate at maturity — a single point on a term structure — not the yield of a selected benchmark security. Picking an on-the-run issue is a different measure needing a concept this library does not have, and conflating the two would make the number mean whichever the reader assumed.

§Errors

SpreadSolveError::Unbracketed or Unconverged from the bond’s own yield solve; SpreadSolveError::Curve from the reference query.