---
title: "US Interest Rate"
description: "US Interest Rate dataset from Federal Reserve Bank of St Louis."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-reserve-bank-of-st-louis/us-interest-rate
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-reserve-bank-of-st-louis/us-interest-rate.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/14%20Datasets/19%20Federal%20Reserve%20Bank%20of%20St%20Louis/01%20US%20Interest%20Rate
modified: 2026-11-02
index: https://www.quantconnect.com/llms.txt
---

# US Interest Rate

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Datasets > [Federal Reserve Bank of St Louis](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-reserve-bank-of-st-louis.md) > US Interest Rate

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

The US Interest Rate dataset provides the primary credit rate from the Federal Open Market Committee (FOMC). The data starts in January 2003 and is updated on a daily frequency. This dataset is created using information from the FOMC meetings.

For more information about the US Interest Rate dataset, including CLI commands and pricing, see the [dataset listing](https://www.quantconnect.com/datasets/us-interest-rate).

## About the Provider

The Federal Reserve Bank of St. Louis, often referred to as the St. Louis Fed, is one of the 12 regional banks that make up the United States Federal Reserve System. It is responsible for the Eighth Federal Reserve District, which includes the states of Arkansas, Illinois, Indiana, Kentucky, Mississippi, Missouri, and Tennessee, as well as portions of eastern Kansas and southern Illinois.

The St. Louis Fed, like other regional banks, participates in the formulation and implementation of monetary policy in the United States. It contributes to the Federal Open Market Committee (FOMC) meetings, where key decisions regarding interest rates and other monetary policy tools are made.

## Getting Started

The following snippet demonstrates how to access data from the US Interest Rate dataset:

```python
interest_rate = self.risk_free_interest_rate_model.get_interest_rate(self.time)
```

To find the average interest rate between two dates, call the `get_risk_free_rate` method.

```python
avg_risk_free_rate = RiskFreeInterestRateModelExtensions.get_risk_free_rate(
    self.risk_free_interest_rate_model,
    self.time-timedelta(365), self.time
)
```

## Data Summary

The following table describes the dataset properties:

| Property | Value |
| --- | --- |
| Start Date | January 2003 |
| Data Density | Sparse |
| Resolution | Daily |
| Timezone | New York |

## Requesting Data

You don't need any special code to request US Interest Rate data. `QCAlgorithm` automatically subscribes to the data by setting its [default risk free interest rate model](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/risk-free-interest-rate/key-concepts.md#03-Default-Behavior).

## Accessing Data

To get the current US Interest Rate data, call the `get_interest_rate` method of the `RiskFreeInterestRateModel` object with the current time.

```python
interest_rate = self.risk_free_interest_rate_model.get_interest_rate(self.time)
```

## Historical Data

To get the average risk free interest rate for a window of time, call the `get_risk_free_rate` method with the start date and end date.

```python
risk_free_rate = RiskFreeInterestRateModelExtensions.get_risk_free_rate(
    self.risk_free_interest_rate_model,
    self.time-timedelta(365), self.time
)
```

To get the average risk free interest rate for a set of dates, call the `get_average_risk_free_rate` method with the list of dates.

```python
risk_free_rate = RiskFreeInterestRateModelExtensions.get_average_risk_free_rate(
    self.risk_free_interest_rate_model,
    [self.time, self.time-timedelta(180), self.time-timedelta(365)]
)
```

## Example Applications

The US Interest Rate dataset provides an important economic indicator. Examples include the following applications:

- Accurately calculating indicators that are a function of the risk-free rate, like Sharpe ratios.
- Forming a portfolio of assets that have a history of outperforming when the rate is increasing/decreasing.
- Canceling orders in a [Risk Management model](https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/risk-management/key-concepts.md) when the expected return of the asset is less than the risk-free rate.

### Classic Algorithm Example

The following example algorithm plots the current interest rate and the last year's average.

```python
from AlgorithmImports import *

class RiskFreeInterestRateModelAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.set_cash(100000)
        self.add_equity("SPY")

    def on_end_of_day(self, symbol):
        self.set_holdings(symbol, 1)
        # Get the average risk free rate of the last year at the current time
        risk_free_rate = RiskFreeInterestRateModelExtensions.get_risk_free_rate(self.risk_free_interest_rate_model, self.time - timedelta(365), self.time)
        # Plot the current interest rate and the 1-year average rate for comparison
        self.plot('Interest', 'EOD', self.risk_free_interest_rate_model.get_interest_rate(self.time))
        self.plot('Interest', '1Y-RW', risk_free_rate)
```
