Skip to content

Fixed income

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

EL=PD×LGD×EADEL = PD \times LGD \times EADs=λ(1−R),λ=s1−Rs = \lambda (1 - R), \quad \lambda = \frac{s}{1 - R}S(T)=e−λT,PD(T)=1−e−λTS(T) = e^{-\lambda T}, \quad PD(T) = 1 - e^{-\lambda T}rexcess≈s t−Ds Δs−PD×LGDr_{\mathrm{excess}} \approx s\,t - D_s\,\Delta s - PD \times LGD

Where

ELEL
Expected loss expected_loss
PDPD
Probability of default probability_of_default
LGDLGD
Loss given default, as a share of the exposure loss_given_default
EADEAD
Exposure at default exposure
ss
Credit spread per year spread
λ\lambda
Hazard rate: the default intensity per year hazard_rate
RR
Recovery rate recovery_rate
S(T)S(T)
Probability of surviving to time T survival_probability
PD(T)PD(T)
Probability of defaulting by time T default_probability
TT
Horizon, in years horizon
rexcessr_{\mathrm{excess}}
Approximate excess return of the bond over a matched government bond spread_return
tt
Holding period, in years holding_period
DsD_s
Spread duration spread_duration
Δs\Delta s
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
Inputs of the calculation expected_loss
NameDescription
CalculationcalculationtextExpected credit loss
Probability of defaultprobability_of_defaultprobability · [0, 1]Probability of default over the horizon
Loss given defaultloss_given_defaultprobability · [0, 1]Fraction of the exposure lost at default (1 less the recovery rate)
Exposureexposuremoney · [0, 1e+12]Exposure at default
Hazard rate implied by a spread (hazard_from_spread): 3 inputs
Inputs of the calculation hazard_from_spread
NameDescription
CalculationcalculationtextHazard rate implied by a spread
Spreadspreadrate · [0, 1]Credit spread over the risk-free rate, continuously compounded
Recovery raterecovery_rateprobability · [0, 0.9]Recovery rate: the fraction of par recovered at default
Spread implied by a hazard rate (spread_from_hazard): 3 inputs
Inputs of the calculation spread_from_hazard
NameDescription
CalculationcalculationtextSpread implied by a hazard rate
Hazard ratehazard_raterate · [0, 10]Default intensity per year
Recovery raterecovery_rateprobability · [0, 0.9]Recovery rate: the fraction of par recovered at default
Survival and default probabilities (survival): 3 inputs
Inputs of the calculation survival
NameDescription
CalculationcalculationtextSurvival and default probabilities
Hazard ratehazard_raterate · [0, 10]Default intensity per year
Horizonhorizonyears · [0, 100]Horizon in years
Approximate excess return from the spread (spread_return): 7 inputs
Inputs of the calculation spread_return
NameDescription
CalculationcalculationtextApproximate excess return from the spread
Spreadspreadrate · [0, 1]Credit spread per year at the start
Holding periodholding_periodyears · (0, 10]Holding period in years
Spread durationspread_durationyears · [0, 30]Spread duration: price change per unit of spread
Spread changespread_changerate · [-0.1, 0.1]Change in the spread over the holding period
Probability of defaultprobability_of_defaultprobability · [0, 1]Probability of default over the holding period
Loss given defaultloss_given_defaultprobability · [0, 1]Fraction lost at default

Outputs

Expected credit loss (expected_loss): 3 outputs
Outputs of the calculation expected_loss
NameDescription
CalculationcalculationtextExpected credit loss
Expected lossexpected_lossmoney · [0, 1e+12]Probability x loss given default x exposure
Loss rateloss_rateprobability · [0, 1]Expected loss as a fraction of the exposure
Hazard rate implied by a spread (hazard_from_spread): 3 outputs
Outputs of the calculation hazard_from_spread
NameDescription
CalculationcalculationtextHazard rate implied by a spread
Hazard ratehazard_raterate · [0, 10]Default intensity per year: s / (1 - R)
One year default probabilityone_year_default_probabilityprobability · [0, 1]Probability of default within a year: 1 - exp(-hazard)
Spread implied by a hazard rate (spread_from_hazard): 2 outputs
Outputs of the calculation spread_from_hazard
NameDescription
CalculationcalculationtextSpread implied by a hazard rate
Spreadspreadrate · [0, 10]Credit spread: hazard x (1 - R)
Survival and default probabilities (survival): 3 outputs
Outputs of the calculation survival
NameDescription
CalculationcalculationtextSurvival and default probabilities
Survival probabilitysurvival_probabilityprobability · [0, 1]Probability of no default by the horizon: exp(-hazard x T)
Default probabilitydefault_probabilityprobability · [0, 1]Probability of default by the horizon
Approximate excess return from the spread (spread_return): 5 outputs
Outputs of the calculation spread_return
NameDescription
CalculationcalculationtextApproximate excess return from the spread
Carrycarryratio · [-20, 20]Spread earned over the holding period
Spread change returnspread_change_returnratio · [-20, 20]-Spread duration x the change in spread
Expected lossexpected_lossratio · [-20, 20]Probability of default x loss given default
Spread returnspread_returnratio · [-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

  1. 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
  2. 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_model with 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:

Python
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())
Command line
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