Skip to main content

year_fraction_under

Function year_fraction_under 

pub fn year_fraction_under(
    day_count: DayCountFraction,
    reference: NaiveDate,
    date: NaiveDate,
) -> Result<f64, CurveError>
Expand description

Year fraction from reference to date under day_count.

The measured form every rate reading goes through. The discount families default to ACT/365 and parametrise their pillars on year_fraction; the credit and inflation families carry their own convention, because a hazard rate is quoted under one and ISDA names ACT/365F specifically.

Bit-identical to year_fraction when day_count is DayCountFraction::Act365Fixed — both are days / 365 over the same day difference — which is what lets the default path stay untouched.

§Errors

CurveError::BeforeReference if date precedes reference.