Skip to main content

pv_weighted_time

Function pv_weighted_time 

pub fn pv_weighted_time(flows: &[(f64, f64)], y: f64, basis: YieldBasis) -> f64
Expand description

The t-weighted PV moment of flows: Σ t·PV(t) / Σ PV(t).

One mechanism, two names. In yield space this is Macaulay duration; in curve space, applied to a note’s projected flows, it is spread duration. Both are −(1/P)·∂P/∂s for a flat continuous overlay s on the discounting, because such an overlay scales each discount factor by exp(−s·t). So both are taken by seeding that overlay at zero and reading the first derivative off the pricing body — not by writing the weighted sum out a second time.

That matters beyond tidiness: the textbook conversion Macaulay = modified · (1 + y/f) holds only for periodic compounding and is undefined under simple interest, while this is the same number under every basis.