Function calibrate_survival
pub fn calibrate_survival(
reference: NaiveDate,
discount: &Curve,
rungs: &[Rung],
recovery: Option<f64>,
fixings: &FixingStore,
fx: &FxRates,
tolerance: Tolerance,
day_count: DayCountFraction,
) -> Result<CalibratedSurvival, CalibrationError>Expand description
Calibrates an ISDA survival curve to a ladder of credit default swaps, discounted on a curve already known.
The pillar date is the contract’s maturity, and it is the caller’s. The
ISDA curve holds one constant hazard per segment, right-closed at its pillar
and extending past the last, so a contract protecting to pillar j reads no
hazard beyond j and the ladder is triangular: no sweeps, one pass.
Two quote shapes, no new rung kind. A spread-quoted contract is a
Rung::par built at its running spread with no upfront: the residual is
its value, and the quote is verified against its fair spread, which at zero
value is the coupon exactly because the risky annuity carries accrual on
default. An upfront-quoted contract is a Rung::priced on the contract
without its upfront, the upfront as the quote and the notional as the money
per unit quote, so the residual is the buyer’s value less what the buyer
would pay — the rung is stated on the protection buyer’s side.
recovery is the entity’s market recovery. A contract that fixes its own
uses that; one that needs the market’s and finds None fails through its
own error, naming what is missing, rather than solving on a default.
Each pillar is solved by the same damped Newton step a rate ladder uses —
newton_on_pillar is one body — seeded on the segment hazard. The first
pillar starts from the credit triangle, spread / (1 − recovery); each later
one from the hazard just solved. The discount curve is lifted passive, so the
step is exactly the residual’s sensitivity through the survival path, and a
rung the pillar cannot move reports CalibrationError::Insensitive.
§Errors
CalibrationError if the ladder is malformed, a pillar does not converge,
a pillar has no effect on its own instrument, a pillar solves to a negative
hazard, or a valuation fails.