Function fair_margin_with
pub fn fair_margin_with<R: Scalar>(
swap: &BondTotalReturnSwap,
view: &PricingView<'_, R>,
) -> Result<R, PricingError>Expand description
The funding margin that zeroes a total return swap, closed-form.
The margin sits on one leg and moves no cashflow’s date, so the package is
exactly affine in it: funding(m) = funding(0) + m·A with A the funding
leg’s annuity, and the fair margin is (return − funding(0)) / A — a
division, not a solve.
§Errors
PricingError::DegenerateAnnuity for a matured swap; otherwise whatever
pricing the legs reports.