Calculates the spreads between pairs of maturities of a country’s government bond yield curve on a day, e.g. the widely followed 10-year minus 2-year and 10-year minus 3-month Treasury spreads. A positive spread indicates a “normal” upward-sloping curve, while a negative spread (“inversion”) has historically been used as a leading indicator of an economic slowdown.

The formula is as follows:

\[\text{Yield Curve Spread} = \text{Long-Term Yield} - \text{Short-Term Yield}\]

Where both yields are the par yields of get_government_bond_yield_curve, as the Treasury and FRED (T10Y2Y, T10Y3M) calculate the spreads, interpolated linearly for a maturity the curve does not quote. For the history of these spreads, take the difference of two columns of get_government_bond_yield_curve; for yields of your own, use yieldcurve_model.get_yield_curve_spread.

Also known as: term spread, yield curve slope, 10Y-2Y spread.

Yield Curve Spread in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_yield_curve_spread as shown below.

from financetoolkit import FixedIncome

fixedincome = FixedIncome()

fixedincome.get_yield_curve_spread(date="2026-11-05")

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

How wide were the spreads of the 5-, 10- and 30-year US Treasury yields over the 3-month and 2-year yields on 5 November 2026?

Which returns:

Long Maturity 3M 2Y
5Y 0.0042 0.0013
10Y 0.0067 0.0038
30Y 0.0108 0.0079

Parameters

get_yield_curve_spread accepts the following parameters.

ParameterTypeDescriptionExample
long_maturityfloat | str | list | NoneThe longer maturity (or maturities), in years or as labels such as ‘10Y’. Defaults to None, 5, 10 and 30 years.10.0
short_maturityfloat | str | list | NoneThe shorter maturity (or maturities), in years or as labels such as ‘3M’. Defaults to None, 3 months and 2 years.2.0
countrystrThe country, see get_government_bond_yield_curve. Defaults to “United States”."US"
datestr | NoneThe day of the curve (YYYY-MM-DD), or the last day before it with a curve. Defaults to None, the end date."2025-03-31"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the class.2
Share