Credit spread and default
Expected loss, the credit triangle between spread and hazard rate, survival probabilities and the approximate excess return from a spread.
- Model id
fixed_income.credit_spread, version 1- Domain
- Fixed income
- Evidence
- standard
- Cost class
- instant: A closed-form calculation; a hosted run may take up to 2 seconds.
Formula
Where
- Expected loss
expected_loss - Probability of default
probability_of_default - Loss given default, as a share of the exposure
loss_given_default - Exposure at default
exposure - Credit spread per year
spread - Hazard rate: the default intensity per year
hazard_rate - Recovery rate
recovery_rate - Probability of surviving to time T
survival_probability - Probability of defaulting by time T
default_probability - Horizon, in years
horizon - Approximate excess return of the bond over a matched government bond
spread_return - Holding period, in years
holding_period - Spread duration
spread_duration - Change in the spread over the holding period
spread_change
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
Expected credit loss (expected_loss): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Expected credit loss | |
Probability of defaultprobability_of_defaultprobability · [0, 1] | probability | [0, 1] | Probability of default over the horizon |
Loss given defaultloss_given_defaultprobability · [0, 1] | probability | [0, 1] | Fraction of the exposure lost at default (1 less the recovery rate) |
Exposureexposuremoney · [0, 1e+12] | money | [0, 1e+12] | Exposure at default |
Hazard rate implied by a spread (hazard_from_spread): 3 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Hazard rate implied by a spread | |
Spreadspreadrate · [0, 1] | rate | [0, 1] | Credit spread over the risk-free rate, continuously compounded |
Recovery raterecovery_rateprobability · [0, 0.9] | probability | [0, 0.9] | Recovery rate: the fraction of par recovered at default |
Spread implied by a hazard rate (spread_from_hazard): 3 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Spread implied by a hazard rate | |
Hazard ratehazard_raterate · [0, 10] | rate | [0, 10] | Default intensity per year |
Recovery raterecovery_rateprobability · [0, 0.9] | probability | [0, 0.9] | Recovery rate: the fraction of par recovered at default |
Survival and default probabilities (survival): 3 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Survival and default probabilities | |
Hazard ratehazard_raterate · [0, 10] | rate | [0, 10] | Default intensity per year |
Horizonhorizonyears · [0, 100] | years | [0, 100] | Horizon in years |
Approximate excess return from the spread (spread_return): 7 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Approximate excess return from the spread | |
Spreadspreadrate · [0, 1] | rate | [0, 1] | Credit spread per year at the start |
Holding periodholding_periodyears · (0, 10] | years | (0, 10] | Holding period in years |
Spread durationspread_durationyears · [0, 30] | years | [0, 30] | Spread duration: price change per unit of spread |
Spread changespread_changerate · [-0.1, 0.1] | rate | [-0.1, 0.1] | Change in the spread over the holding period |
Probability of defaultprobability_of_defaultprobability · [0, 1] | probability | [0, 1] | Probability of default over the holding period |
Loss given defaultloss_given_defaultprobability · [0, 1] | probability | [0, 1] | Fraction lost at default |
Outputs
Expected credit loss (expected_loss): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Expected credit loss | |
Expected lossexpected_lossmoney · [0, 1e+12] | money | [0, 1e+12] | Probability x loss given default x exposure |
Loss rateloss_rateprobability · [0, 1] | probability | [0, 1] | Expected loss as a fraction of the exposure |
Hazard rate implied by a spread (hazard_from_spread): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Hazard rate implied by a spread | |
Hazard ratehazard_raterate · [0, 10] | rate | [0, 10] | Default intensity per year: s / (1 - R) |
One year default probabilityone_year_default_probabilityprobability · [0, 1] | probability | [0, 1] | Probability of default within a year: 1 - exp(-hazard) |
Spread implied by a hazard rate (spread_from_hazard): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Spread implied by a hazard rate | |
Spreadspreadrate · [0, 10] | rate | [0, 10] | Credit spread: hazard x (1 - R) |
Survival and default probabilities (survival): 3 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Survival and default probabilities | |
Survival probabilitysurvival_probabilityprobability · [0, 1] | probability | [0, 1] | Probability of no default by the horizon: exp(-hazard x T) |
Default probabilitydefault_probabilityprobability · [0, 1] | probability | [0, 1] | Probability of default by the horizon |
Approximate excess return from the spread (spread_return): 5 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Approximate excess return from the spread | |
Carrycarryratio · [-20, 20] | ratio | [-20, 20] | Spread earned over the holding period |
Spread change returnspread_change_returnratio · [-20, 20] | ratio | [-20, 20] | -Spread duration x the change in spread |
Expected lossexpected_lossratio · [-20, 20] | ratio | [-20, 20] | Probability of default x loss given default |
Spread returnspread_returnratio · [-20, 20] | ratio | [-20, 20] | Carry plus the spread-change return less the loss |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
Example loan_expected_loss. Inputs:
{
"calculation": "expected_loss",
"exposure": 1000000,
"loss_given_default": 0.6,
"probability_of_default": 0.02
}Outputs:
{
"calculation": "expected_loss",
"expected_loss": 12000,
"loss_rate": 0.012
}Assumptions
- The hazard rate is constant, so default times are exponential, and the spread and the hazard rate are continuously compounded.
- The credit triangle assumes recovery is a fraction of par paid at default, and that the spread compensates for expected default loss alone (no liquidity or risk premium).
- The spread return is first order in the spread change and treats the expected loss as incurred over the holding period.
Limitations
- The spread return omits convexity, the roll-down of the spread and the risk-free rate's own change.
- Hazard rates that vary with time, and correlated defaults, are out of scope.
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Citations
- Hull, J. C. (2018). Options, Futures, and Other Derivatives, 10th ed. Pearson. https://openlibrary.org/isbn/9780134472089 (Chapter 24, Credit Risk (hazard rates, and the hazard rate implied by a bond yield spread and a recovery rate)). ISBN 9780134472089
- Fabozzi, F. J. (2005). Fixed Income Mathematics: Analytical and Statistical Techniques, 4th ed. McGraw-Hill. https://openlibrary.org/isbn/9780071460736 (Chapter 18 (credit risk concepts and measures for corporate bonds)). ISBN 9780071460736
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/fixed_income.credit_spread/run- MCP tool
run_modelwith the model's id,fixed_income.credit_spread. Connect an assistant- Command line
pyeconomics models run fixed_income.credit_spread --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "expected_loss",
"exposure": 1000000,
"loss_given_default": 0.6,
"probability_of_default": 0.02,
}
result = pyeconomics.run("fixed_income.credit_spread", inputs)
print(result.to_json())
pyeconomics models run fixed_income.credit_spread --inputs - <<'JSON'
{
"calculation": "expected_loss",
"exposure": 1000000,
"loss_given_default": 0.6,
"probability_of_default": 0.02
}
JSON