quantlab.factor.predefined.residual_momentum#

Residual momentum from a rolling Fama-French three-factor regression.

Plain momentum ranks stocks by their past return. Residual momentum first removes the part of each stock’s return that common risk factors explain, and ranks stocks by what is left (the residual). The factors used are the three Fama-French factors: the market’s excess return over the risk-free rate (mkt_rf), small-minus-big size (smb) and high-minus-low value (hml). For each stock and bar the factor regresses the stock’s excess return on these three series over a rolling window, then sums the residuals over a recent formation period and divides by their volatility.

The computation runs in KunQuant, a library that compiles a formula, written as a graph of operators, to native code over a whole (timestamp, symbol) panel. Every window is counted in bars of that panel: on daily bars the defaults (756 / 252 / 21) are the three-year regression and twelve-minus-one-month formation of Blitz, Huij and Martens (2011); on a monthly panel the same design is 36 / 12 / 1.

mkt_rf, smb, hml and risk_free are the same for every stock. They come either from a CSV of daily Fama-French returns, named through fama_french_csv and compounded onto the panel’s bars by compound_onto_bars() (scripts/fama_french.py downloads one), or from panel variables already broadcast across symbols. Returns are arithmetic decimal returns (0.01 means 1%), not percentages.

Classes

ResidualMomentumFF3

Residual momentum estimated from a Fama-French three-factor regression.

ResidualMomentumParameters

Formula parameters for ResidualMomentumFF3, read from config.kwargs.

Functions

compound_onto_bars

Compound per-row returns onto a panel's bars.

read_fama_french

Read a Fama-French CSV into a frame of decimal returns indexed by date.