Rating Transition Matrix
Retrieves the rating transition matrix of a credit rating agency: for every rating at the start of a period, the share of ratings that ended the period in each rating category, in default or withdrawn. It is the input of rating migration and default models, such as the Jarrow-Lando-Turnbull model, and of credit portfolio models.
The data comes from CEREP, the central repository where every credit rating agency registered in the European Union reports its ratings to ESMA, published twice a year with periods from 1989. It covers the global ratings of agencies such as S&P, Moody’s, Fitch, DBRS and Scope, for corporates (non-financial, financial and insurance), sovereigns, structured finance and covered bonds, in each agency’s own rating scale. No API key is needed.
By default the matrix is withdrawal-adjusted, the convention of the agencies’ own default studies: ratings withdrawn during the period are left out, so each row sums to 1. The matrix compares the rating at the start of the period with the rating at its end, so a default that was followed by a new rating within the period (as after a distressed exchange) shows as that new rating; get_default_rates counts every default within the period and is the measure to calibrate default rates on. With include_withdrawals=True they are a separate “Withdrawals” column, and with probabilities=False the counts are returned instead.
See definition: https://registers.esma.europa.eu/cerep-publication/
Also known as: rating migration matrix, credit migration matrix, transition probabilities.
Rating Transition Matrix in Python
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_rating_transition_matrix as shown below.
from financetoolkit import FixedIncome
fixedincome = FixedIncome(end_date="2025-12-31")
transition_matrix = fixedincome.get_rating_transition_matrix(agency='S&P', year=2025)
transition_matrix.loc['AAA':'CCC', ['AAA', 'AA', 'A', 'BBB', 'BB', 'B', 'CCC', 'D']]
Which returns:
| From Rating | AAA | AA | A | BBB | BB | B | CCC | D |
|---|---|---|---|---|---|---|---|---|
| AAA | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| AA | 0 | 0.9518 | 0.0482 | 0 | 0 | 0 | 0 | 0 |
| A | 0 | 0.0135 | 0.9646 | 0.0219 | 0 | 0 | 0 | 0 |
| BBB | 0 | 0.0006 | 0.0355 | 0.9563 | 0.007 | 0.0006 | 0 | 0 |
| BB | 0 | 0 | 0 | 0.0353 | 0.9283 | 0.0353 | 0.0011 | 0 |
| B | 0 | 0 | 0 | 0 | 0.0387 | 0.9001 | 0.0558 | 0.0023 |
| CCC | 0 | 0 | 0 | 0 | 0 | 0.18 | 0.76 | 0.03 |
Parameters
The function accepts the following parameters:
- agency (str, optional): The rating agency, e.g. “S&P”, “Moody’s”, “Fitch”, “DBRS”, “Scope” or “Kroll”, or the CEREP code of any registered agency. Defaults to “S&P”.
- rating_type (str, optional): “corporate”, “sovereign”, “structured_finance” or “covered_bonds”. Defaults to “corporate”.
- year (int | None, optional): The first year of the period. Defaults to None, which takes the latest year published.
- horizon (int, optional): The length of the period in years, from 1 January of year. Defaults to 1.
- probabilities (bool, optional): Whether to return the share of ratings per row instead of the number. Defaults to True.
- include_withdrawals (bool, optional): Whether to keep the ratings withdrawn during the period as a “Withdrawals” column. Defaults to False.
- region (str | None, optional): The area of the rated entities: “Africa”, “America”, “Asia”, “Europe”, “EU members”, “International” or “Oceania”. Defaults to None, which covers all of them.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.