Function bond_rung
pub fn bond_rung(
stat: &BondStatic,
quote: &BondQuote,
settlement: NaiveDate,
) -> Result<Rung, BondRungError>Expand description
A priced rung from a quote-less bond static and a tagged market quote.
The exact-fit half of building a curve out of bonds: zeros at the short end, on-the-runs beyond, mixing freely with rate helpers in one ladder. For an overdetermined universe — many more bonds than pillars — a smoother is the right tool and this is not it.
§The quote converts once, here
| measure × units | becomes |
|---|---|
| yield, basis points | a dirty price, through the crate’s street solver |
| clean price, per cent of par | that price plus accrued |
| dirty price, per cent of par | that price |
| a spread | refused: it presupposes the benchmark being calibrated |
Converting once means the ladder never inverts a yield, so no implicit-function splice appears in the solve and the Newton slope is the seeded derivative the solver already computes.
What that costs: a yield-supplied quote’s par sensitivity is then a sensitivity to the bond’s price, not to its yield. Divide by the bond’s own DV01 for the latter.
§Settlement
settlement is the date the quote is for: the accrued and the yield
conversion are taken there, and the rung records it. A bond quoted for the
curve’s own reference date is the common case and is exactly the rung it
always was. One quoted for T+1 is compared with its value at T+1 on the
curve under solve — see QuoteKind::Priced — which no caller could do
beforehand, because DF(T+1) is on the curve being built.
§Errors
BondRungError for an unsupported or circular quote, a static that will
not materialise, or a yield that implies no price.