Treasury Department

US Treasury Yield Curve


The US Treasury Yield Curve datasets tracks the yield curve rate from the US Department of the Treasury. The data starts in January 1990 and is delivered on a daily frequency. This dataset is calculated from composites of indicative, bid-side market quotations (not actual transactions) obtained by the Federal Reserve Bank of New York at or near 3:30 PM Eastern Time (ET) each trading day.

For more information about the US Treasury Yield Curve dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation's financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

Getting Started

The following snippet demonstrates how to request data from the US Treasury Yield Curve dataset:

self.dataset_symbol = self.AddData(USTreasuryYieldCurveRate, "USTYCR").Symbol
_datasetSymbol = AddData<USTreasuryYieldCurveRate>("USTYCR").Symbol;

Data Summary

The following table describes the dataset properties:

Start DateJanuary 1990
Coverage1 Dataset
Data DensitySparse
TimezoneNew York

Data Point Attributes

The US Treasury Yield Curve dataset provides USTreasuryYieldCurveRate objects, which have the following attributes:

Requesting Data

To add US Treasury Yield Curve data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverCongressDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)

        self.dataset_symbol = self.AddData(USTreasuryYieldCurveRate, "USTYCR").Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
    public class USTreasuryYieldCurveDataAlgorithm : QCAlgorithm
        private Symbol _datasetSymbol;

        public override void Initialize()
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);

            _datasetSymbol = AddData<USTreasuryYieldCurveRate>("USTYCR").Symbol;

Accessing Data

To get the current US Treasury Yield Curve data, index the current Slice with the dataset Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} one month value at {slice.Time}: {data_point.OneMonth}")
public override void OnData(Slice slice)
    if (slice.ContainsKey(_datasetSymbol))
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} one month value at {slice.Time}: {dataPoint.OneMonth}");

Historical Data

To get historical US Treasury Yield Curve data, call the History method with the dataset Symbol. If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[USTreasuryYieldCurveRate](self.dataset_symbol, 100, Resolution.Daily)
var history = History<USTreasuryYieldCurveRate>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests.

Remove Subscriptions

To remove your subscription to US Treasury Yield Curve data, call the RemoveSecurity method.


Example Applications

The US Treasury Yield Curve dataset enables you to monitor the yields of bonds with numerous maturities in your strategies. Examples include the following strategies:

  • Short selling SPY when the yield curve inverts
  • Buying short-term Treasuries and short selling long-term Treasuries when the yield curve becomes steeper (aka curve steepener trade)

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: