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, which shows how likely a rating is to be upgraded, downgraded or to default.
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.
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. The withdrawals can be kept as a separate “Withdrawals” column, and the counts can be returned instead of the probabilities.
The formula of the probabilities is as follows:
\[\text{Transition Probability} \;(\text{from},\; \text{to}) = \frac{\text{Count} \;(\text{from},\; \text{to})}{\sum(\text{Count} \;(\text{from},\; \text{every end category}))},\;\; \text{with the end categories the ratings and default, plus "Withdrawals" only when they are kept}\]A single year’s matrix rests on few observations in the top and bottom rows: an AAA row with few issuers is often 100% stable one year and shows a downgrade the next. Credit models therefore use the average over many years, or a longer horizon, and check how far the latest year deviates from it, which also shows where in the credit cycle the year stands.
See definition: ESMA
Also known as: rating migration matrix, credit migration matrix, transition probabilities.
Example
Install the Finance Toolkit with pip install financetoolkit -U, then call get_rating_transition_matrix:
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']]
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
How likely were S&P-rated corporates from AAA to CCC to keep, raise or lose their rating, or to default, during 2025?
Which returns:
| From Rating | AAA | AA | A | BBB | BB | B | CCC | D |
|---|---|---|---|---|---|---|---|---|
| AAA | 1 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
| AA | 0 | 0.9520 | 0.0480 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
| A | 0 | 0.0135 | 0.9646 | 0.0219 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
| BBB | 0 | 0.0006 | 0.0354 | 0.9564 | 0.0070 | 0.0006 | 0.0000 | 0.0000 |
| BB | 0 | 0.0000 | 0.0000 | 0.0353 | 0.9283 | 0.0353 | 0.0011 | 0.0000 |
| B | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0388 | 0.9000 | 0.0558 | 0.0023 |
| CCC | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.1791 | 0.7612 | 0.0299 |
7 rows
Parameters
get_rating_transition_matrix accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
agency | str | 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”. | "Moody's" |
rating_type | str | The rated instruments. Options are: “corporate” (companies), “sovereign” (governments), “structured_finance” (structured finance products), “covered_bonds” (covered bonds). Defaults to “corporate”. | "sovereign" |
year | int | None | The first year of the period. Defaults to None, which takes the latest year published. | 2020 |
horizon | int | The length of the period in years, from 1 January of year. Defaults to 1. | 5 |
probabilities | bool | Whether to return the share of ratings per row instead of the number. Defaults to True. | False |
include_withdrawals | bool | Whether to keep the ratings withdrawn during the period as a “Withdrawals” column. Defaults to False. | True |
region | str | None | The area of the rated entities. Options are: “Africa”, “America”, “Asia”, “Europe”, “EU members”, “International”, “Oceania”, None (all of them). Defaults to None. | "Europe" |
rounding | int | None | The number of decimals to round the results to. Defaults to None. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |