21 — Default, Recovery, and CDS¶
Free learning pack¶
resources/fixed_income.mdreference/fixed_income/default_recovery.md,cds_and_basis.md
Do not search for more material until these are insufficient.
PREDICT¶
Two issuers both have a 3% annual hazard rate. One has a 40% expected recovery rate, the other 20%. Which one should trade at a wider credit spread, and by roughly how much (in relative terms)?
Formulas¶
Survival(t) = exp(-hazard_rate * t)
ExpectedLoss = Notional * PD * (1 - RecoveryRate)
ParSpread ≈ hazard_rate * (1 - RecoveryRate)
import numpy as np
hazard_rate = 0.03
recovery_rate = 0.40
notional = 10_000_000
one_year_pd = 1 - np.exp(-hazard_rate * 1) # probability of default within 1 year
# MANUAL FIRST:
# compute the 1-year and 5-year survival probabilities, the expected loss
# on `notional` over 1 year using `one_year_pd`, and the approximate par
# credit spread implied by hazard_rate and recovery_rate.
survival_1y = None
survival_5y = None
expected_loss_1y = None
par_spread = None
print(survival_1y, survival_5y, expected_loss_1y, par_spread)
PREDICT (basis)¶
A bond's Z-spread is 220bp; the same issuer's 5-year CDS trades at 195bp. Is the CDS-bond basis positive or negative? Name one non-credit reason (a technical, not a fundamental) this basis might exist.
cds_spread = 0.0195
bond_spread = 0.0220
# MANUAL FIRST:
# compute the CDS-bond basis.
basis = None
print(basis)
Not implemented here: OAS and migration risk¶
No code cells for these — both require machinery beyond this repo's
closed-form/root-finding scope (a term-structure model for OAS, a rating
transition matrix for migration). Read reference/fixed_income/oas.md
and reference/fixed_income/credit_migration.md for what they are and
why they're conceptual pages here rather than working code.
Experiment¶
Recompute the par spread for a hazard rate that doubles (6%) with the same recovery rate. Does the spread also double? Why or why not, given the formula.
Reference¶
reference/fixed_income/default_recovery.md
reference/fixed_income/cds_and_basis.md
Promote¶
Use src/pm/fixed_income/credit.py (survival_probability,
expected_loss, credit_spread_from_hazard, cds_bond_basis) only after
your own implementation.
Test¶
pytest tests/test_fixed_income.py
ORAL CHECK¶
Explain to a PM why a persistently nonzero CDS-bond basis is itself a trade, not just a modeling artifact.
Try /tutor fixed-income cds basis for an adaptive walkthrough.