Retrieves the daily U.S. Treasury par yield curve rates as officially published by the U.S. Department of the Treasury, covering every maturity from 1 Month through 30 Year in a single dataset. This is the official, risk-free curve widely used as the discount curve for bond valuation and as the benchmark for credit spreads.

Also known as: the Treasury yield curve, the risk-free curve.

U.S. Treasury Par Yield Curve in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_treasury_rates as shown below.

from financetoolkit import FixedIncome

fixedincome = FixedIncome(
    start_date='2024-01-01',
    end_date='2024-01-15',
    api_key='FINANCIAL_MODELING_PREP_KEY',
)

fixedincome.get_treasury_rates()

Which returns:

Date 1 Month 3 Month 1 Year 2 Year 10 Year 30 Year
2024-01-02 0.0555 0.0546 0.048 0.0433 0.0395 0.0408
2024-01-03 0.0554 0.0548 0.0481 0.0433 0.0391 0.0405
2024-01-04 0.0556 0.0548 0.0485 0.0438 0.0399 0.0413
2024-01-05 0.0554 0.0547 0.0484 0.044 0.0405 0.0421

Parameters

The function accepts the following parameters:

  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
  • growth (bool, optional): Whether to return the growth data or the actual data.
  • lag (int, optional): The number of periods to lag the data by.
  • 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.
Share