Residual Momentum
Calculate the Residual Momentum of each ticker per month: the momentum of the part of its returns that the Fama and French three factors do not explain, standardized by its volatility, the momentum signal of Blitz, Huij and Martens (2011).
Ordinary momentum buys the stocks that did well, which tilts it towards whatever factors did well, and it crashed when those factors reversed (as in 2009). Ranking on the residual returns of a factor model removes these exposures: in the paper residual momentum earned about the same return as ordinary momentum with about half the volatility, and its profits were stable over the business cycle.
The formula is as follows:
\[\text{Excess Return}_{t} = \alpha + \beta_{1} \cdot \text{MKT}_{t} + \beta_{2} \cdot \text{SMB}_{t} + \beta_{3} \cdot \text{HML}_{t} + \epsilon_{t}\] \[\text{Residual Momentum} = \frac{\sum_{s=1}^{F} \epsilon_{s}}{\operatorname{std}\left(\epsilon_{s}\right)}\]Where \(\text{MKT}_{t}\) is the market factor (Mkt-RF), the regression is ordinary least squares on the monthly excess returns of the 36 months up to and including the month shown, and the sum and the standard deviation run over the F formation months, the last 12 months without the most recent one (months t-12 to t-2 for a signal used in month t). The standard deviation has n - 1 in the denominator.
Also known as: residual momentum, idiosyncratic momentum, factor-neutral momentum.
Example · AAPL, MSFT, KO · 2020 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_residual_momentum:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "KO"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2020-01-01",
end_date="2025-06-30",
)
toolkit.performance.get_residual_momentum().loc["2025"]
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
What was the residual momentum of Apple, Microsoft and Coca-Cola, beyond the Fama-French three factors, in each month of the first half of 2025, with data from 2020?
Which returns:
| Date | AAPL | MSFT | KO |
|---|---|---|---|
| 2025-01 | 1.1490 | -6.0429 | 0.0573 |
| 2025-02 | 0.9498 | -5.9830 | -0.3925 |
| 2025-03 | 3.8062 | -7.2231 | 1.4547 |
| 2025-04 | 3.6228 | -5.3104 | 1.5697 |
| 2025-05 | 1.8042 | -4.6669 | 1.6358 |
| 2025-06 | -1.3684 | -1.2424 | 1.9364 |
6 rows
Parameters
get_residual_momentum accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
region | str | The region whose Fama and French factors to use. Options are: “United States”, “Developed”, “Developed ex US”, “Europe”, “Japan”, “Asia Pacific ex Japan”, “North America”. Defaults to “United States”. | "Europe" |
window | int | The number of months of the regression. Defaults to 36. | 20 |
formation | int | The number of months back the formation period starts. Defaults to 12. | 12 |
skip | int | The number of most recent months left out of the formation period. Defaults to 1. | 1 |
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 values. 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 |
transform | str | list[str] | None | Time series steps applied in order, such as “sma:12” (moving average), “ema:12”, “std:12”, “zscore:60”, “percentile:120”, “yoy”, “pct_change:3,annualize:3”, “log”, “diff”, “cumsum” or “hp_trend” and “hp_cycle” (Hodrick-Prescott), before growth. A window needs that many periods of history, so the first periods can be empty. Defaults to None. | None |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Blitz, D., Huij, J. and Martens, M. (2011). “Residual Momentum.” Journal of Empirical Finance, 18(3), 506-521.
- Paper Fama, E.F. and French, K.R. (1993). “Common Risk Factors in the Returns on Stocks and Bonds.” Journal of Financial Economics, 33(1), 3-56.