Relative Strength Index (RSI)
Calculate the Relative Strength Index (RSI) indicator for a given price series.
The Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements. It ranges from 0 to 100 and is used to identify overbought or oversold conditions in an asset’s price.
The formula is as follows:
\[\text{RSI} = 100 - (100 / (1 + \text{RS}))\]Also known as: RSI, momentum oscillator, overbought, oversold.
Relative Strength Index (RSI) in Python
get_relative_strength_index is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_relative_strength_index as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_relative_strength_index()
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2026-06-18 | 39.0696 | 18.5547 | 44.8909 |
| 2026-06-22 | 42.1875 | 9.2816 | 42.6001 |
| 2026-06-23 | 30.4087 | 16.9139 | 37.6696 |
| 2026-06-24 | 32.6884 | 17.8779 | 39.5418 |
| 2026-06-25 | 22.9048 | 15.2531 | 38.4444 |
| 2026-06-26 | 33.4829 | 31.3248 | 44.9277 |
| 2026-06-29 | 35.3464 | 31.4673 | 50.9396 |
| 2026-06-30 | 49.0731 | 36.5041 | 54.943 |
| 2026-07-01 | 52.0534 | 44.4482 | 61.5893 |
| 2026-07-02 | 58.2929 | 50.0641 | 54.5966 |
Parameters
get_relative_strength_index accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The column name for closing prices in the historical data. Defaults to “Adj Close”.
- window (int, optional): The number of periods for RSI calculation. Defaults to 14.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the RSI. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- 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. Defaults to 1.