Function calibrate
pub fn calibrate(
reference: NaiveDate,
rungs: &[Rung],
fixings: &FixingStore,
fx: &FxRates,
tolerance: Tolerance,
scheme: Interpolation,
) -> Result<Calibrated, CalibrationError>Expand description
Calibrates a discount curve so that every rung prices to zero.
Pillars solve in order, each against the instrument quoted for it. A
piecewise log-linear curve extends its last segment’s forward beyond its
last pillar, so a rung maturing at pillar j depends only on pillars up to
j — which is what makes the sequential solve valid, and what lets each
step carry a curve holding only the pillars solved so far.
Each rung’s instrument both discounts and projects on the curve under
solve — the self-discounting form. For a projection curve solved against a
discount curve already known, see calibrate_with.
Each Newton step runs in forward mode, seeded at the pillar being solved: one input, one output, value and derivative from a single pass. No tape is opened and no reverse sweep runs.
§Errors
CalibrationError if the ladder is malformed, a pillar does not converge,
a pillar has no effect on its own instrument, or a valuation fails.