The pre-existing Models/Credit/Credit.lean derives the CDS fair spread c = h · (1 − R) for constant hazard h via the cds_leg_equality identity. The annuity factor cancels because both legs share it.
This file extends to time-varying hazard h : ℝ → ℝ. The cash-flow balance is
c · annuity(T) = (1 − R) · losses(T),
where (with constant recovery R for simplicity)
annuity(T) = ∫_0^T S(s) · e^{−rs} ds, losses(T) = ∫_0^T h(s) · S(s) · e^{−rs} ds,
and S(s) = exp(−∫_0^s h(u) du) is the survival from HazardCurve.lean. Under no arbitrage, the fair spread is c* = (1 − R) · losses(T) / annuity(T). No integral is evaluated — the balance is stated at the cash- flow level.
The discrete piecewise-constant survival decomposition (multi-period survival = exp of sum of hazard × duration) is a direct application of Real.exp_sum and is recorded as survival_product_eq_exp_sum for the finance-side narrative.
Why this is "first principles"
The existing constant-hazard derivation specialises to a single rate h for all time; this file gives the general cash-flow balance that holds for any deterministic hazard curve.
Main results
cdsFairSpread_TV_cash_flow_balance: for a nonzero annuity, the balance equation c · annuity = (1 − R) · losses solved for the spread; the hazard enters only through the two legs (Cox.cdsFairSpreadTV_balances is the Cox-model instance).survival_product_eq_exp_sum: multi-period survival factorisation, i.e. ∏ exp(−h_i Δt_i) = exp(−∑ h_i Δt_i) (a direct Real.exp_sum application stated in finance variables).
Tags
credit default swap, CDS spread, hazard rate, protection leg, premium leg, fair spread, survival probability, MSC 91G40, JEL G12