Rate of Change (ROC)
Calculate the Rate of Change (ROC) for a given price series.
The Rate of Change is a pure momentum oscillator that measures the percentage change in price between the current period and the price a fixed number of periods ago. It oscillates around zero: positive values indicate price is higher than window periods ago (upward momentum), while negative values indicate price is lower (downward momentum).
The formula is as follows:
\[\text{ROC} = \operatorname{Close}(t) / \operatorname{Close}(t - \text{window}) - 1\]Also known as: ROC, Price Rate of Change, momentum.
Rate of Change (ROC) in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_rate_of_change as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
tickers=["GCUSD", "SIUSD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.technicals.get_rate_of_change().tail(5)
Or, after setting up the Finance Toolkit MCP, ask:
How did the rate of change of gold and silver compare from 26 to 31 December 2025?
Which returns:
| Date | GCUSD | SIUSD | Benchmark |
|---|---|---|---|
| 2025-12-26 | 0.0518 | 0.245 | 0.0155 |
| 2025-12-28 | 0.0411 | 0.263 | 0.0145 |
| 2025-12-29 | 0.0019 | 0.108 | 0.0134 |
| 2025-12-30 | 0.0125 | 0.2306 | 0.015 |
| 2025-12-31 | -0.0075 | 0.0553 | 0.0187 |
Parameters
get_rate_of_change accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”. | "weekly" |
close_column | str | The column name for closing prices in the historical data. Defaults to “Adj Close”. | "Close" |
window | int | Number of periods to look back for the rate of change calculation. Defaults to 12. | 20 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the Rate of Change. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |