Class CrossSectionalMomentum

java.lang.Object
com.quantfinlib.backtest.portfolio.CrossSectionalMomentum
All Implemented Interfaces:
PortfolioStrategy

public final class CrossSectionalMomentum extends Object implements PortfolioStrategy
Point-in-time cross-sectional momentum — the classic equity factor, built to demonstrate (and test) universe-aware backtesting: at every rebalance the strategy ranks only the stocks that are index members at that bar's timestamp, goes long the best trailing performers and short the worst.

Momentum definition is the academic standard "12-1": close(i − skip) / close(i − lookback) − 1 — trailing lookback bars with the most recent skip bars excluded (short-term reversal contaminates raw 12-month momentum; Jegadeesh-Titman 1993). Each side is equal-weighted at grossPerSide total, so the default book is dollar-neutral with 2× gross-per-side exposure.

Why point-in-time matters here specifically: momentum is the factor survivorship bias flatters most. The stocks that delisted are disproportionately the past losers a short book would have held — remove them from the universe and the short side looks artificially safe, while the long side never picks a name that was about to be acquired away. Ranking over universe.isMember(symbol, now) and running on the survivorship-aware overload closes both gaps (a null universe reproduces the naive everything-always- tradeable behavior — useful for measuring the bias).

Candidates also need lookback bars of history at the rebalance bar; earlier bars produce an empty book (the engine holds cash).