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.

The formula is as follows:

\[\text{Yield Curve Slope} (t) = \text{Long Term Interest Rate} (t) - \text{Short Term Interest Rate} (t),\;\; \text{both from the OECD at the requested frequency (monthly by default)},\;\; \text{or both annual from the Global Macro Database}\]

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.

Also known as: term spread, 10Y-3M spread, curve inversion.

Yield Curve Slope in Python or via the MCP

Install the Finance Toolkit 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'
)

Or, after setting up the Finance Toolkit MCP, ask:

How did the gap between 10-year and 3-month interest rates in the United States, Germany and Japan develop each year from 2021 to 2023?

Which returns:

  United States Germany Japan
2021 0.0139 0.0018 -0
2022 0.0071 0.008 0.0016
2023 -0.0122 -0.01 0.0049

Parameters

get_yield_curve_slope accepts the following parameters.

ParameterTypeDescriptionExample
countrieslist[str] | str | NoneA list of countries or a single country to include in the results. Defaults to None.["United States", "Germany"]
periodstr | NoneWhether to return the monthly, quarterly or the annual data. Defaults to None, which is quarterly when the Economics class was initialized with quarterly=True and monthly otherwise."quarterly"
gmdb_sourcebool | NoneWhether to get the data from the Global Macro Database (GMDB), which is annual. Defaults to None, which uses the GMDB only for yearly data and only when the gmdb_source set on the Economics class is True (its default); monthly and quarterly data, or gmdb_source=False on the class, come from the OECD. True uses the GMDB whatever the period, False always the OECD.False
rollingintThe rolling window size to use for smoothing the data (simple moving average). Defaults to None.4
trailingintThe trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.4
growthboolWhether to return the growth data or the actual data. Defaults to False.True
lagintThe number of periods to lag the growth data. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None.2
gmdb_forecastsboolWhether to include the years the Global Macro Database projects, from the IMF’s World Economic Outlook, up to five years ahead. Only applies to data from the Global Macro Database. Defaults to False, which ends a series with its last observation.True
Share