Yield Curve Slope
Get the Yield Curve Slope for a variety of countries over time. The Yield Curve Slope is the difference between the Long Term Interest Rate (the 10-year government bond yield) and the Short Term Interest Rate (the 3-month money market rate), and summarizes the overall shape of the yield curve in a single number.
Formula:
Yield Curve Slope = Long Term Interest Rate - Short Term Interest Rate
A positive (upward-sloping) yield curve is the historical norm and reflects investors demanding a premium for locking up money for longer. A negative (inverted) yield curve, where short-term rates exceed long-term rates, has historically been one of the more reliable leading indicators of an upcoming recession, as it signals that markets expect the central bank to cut rates in response to a weakening economy.
Both legs are decimal fractions (0.05 for 5%) whichever source is used, so the result is itself a decimal fraction (-0.0122 for an inversion of 1.22 percentage points), matching the convention used by get_misery_index and get_real_interest_rate.
Changed in v2.2.0: this used to be returned in percentage points, because the GMDB legs were percentage points and the OECD legs were multiplied by 100 to match them. The GMDB series are now decimal fractions and that rescaling has been removed, so the result is 100x smaller than in v2.1.x.
Also known as: term spread, 10Y-3M spread, curve inversion.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Yield Curve Slope for you. Just ask in plain English.
Calculate the Yield Curve Slope in Python
The Yield Curve Slope is available in the Economics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_yield_curve_slope as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2021-01-01', end_date='2023-12-31')
economics.get_yield_curve_slope(
countries=['United States', 'Germany', 'Japan'],
period='yearly'
)
Which returns:
| United States | Germany | Japan | |
|---|---|---|---|
| 2021 | 0.0133 | 0.0017 | 0.0014 |
| 2022 | 0.0072 | 0.008 | 0.0026 |
| 2023 | -0.0122 | -0.01 | 0.0056 |
Parameters
get_yield_curve_slope accepts the following parameters:
- countries (list[str] | str | None, optional): A list of countries or a single country to include in the results. Defaults to None.
- period (str | None, optional): Whether to return the monthly, quarterly or the annual data.
- gmdb_source (bool | None, optional): Whether to get the data from the Global Macro Database (GMDB).
- rolling (int, optional): The rolling window size to use for smoothing the data (simple moving average). Defaults to None.
- trailing (int, optional): The trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.
- growth (bool, optional): Whether to return the growth data or the actual data. Defaults to False.
- lag (int, optional): The number of periods to lag the growth data. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Related Finance
The Economics module page introduces the module, and the sidebar lists all of its functions.