Statistical arbitrage on the S&P 500: what survives costs
A point-in-time research platform for pairs trading, momentum and fundamental signals in S&P 500 stocks, with fourteen research notes, most of them pre-registered.
- Research notes
- 14, twelve pre-registered
- Cointegration pairs, 2016–26
- −1.4% a year net
- Capped quality book
- Alpha +4.3% a year (t 2.4)
- Same book without six mega-caps
- Alpha t 1.1, like equal weights
- Python
- pandas
- NumPy
- cvxpy
- JavaScript

statarb is a research library for market-neutral US equity strategies, built in layers so that every strategy family shares the same point-in-time data, cost model and evaluation code. The universe is the S&P 500 as it stood on each date since 1996, rebuilt from free data. Fourteen research notes so far ask which classic ideas survive realistic costs. Twelve are pre-registered: the hypothesis, data and test are fixed in writing before the test is run.
How it works #
- Point-in-time data. Historical index membership, Yahoo prices, fundamentals parsed from SEC XBRL filings as of their filing dates, and factor returns from Ken French’s library. A security master resolves renamed and recycled tickers, and each manual fix is backed by evidence.
- Costs. Fees, a half-spread estimated from daily prices, square-root market impact and borrow, with trades executed on the next trading day.
- Engines. A pairs backtester (correlation, distance and cointegration selection; static and Kalman-filter hedges), cross-sectional signal books, and a cost-aware portfolio optimiser with exposure, factor, sector, turnover and liquidity constraints.
- Statistics. Newey–West t-statistics, factor regressions and bootstrap Sharpe tests, with results reported net of costs.
- A local dashboard re-prices 49 books from the saved runs, so its numbers match the notes’.
What I found #
| Idea | Result |
|---|---|
| Pairs: cointegration vs correlation, 2016–26 | Cointegration pairs lose 1.4% a year net; naive correlation pairs make 0.5% (Sharpe gap 0.85, p = 0.02). The cointegration screen passes pairs at the rate chance would |
| Dynamic hedge ratios | Slow Kalman hedges beat a frozen regression hedge, but never a simple 1:1 dollar-neutral one |
| Residual momentum | Halves momentum’s crashes (2009: −44% against −80%) but adds no alpha; neither version survives costs |
| Cost-aware optimisation of momentum | Cuts turnover from 17× to 5.7×; net Sharpe rises from −0.19 to +0.06, short of significance (p = 0.063) |
| Combining weak signals | Net Sharpe −0.23, against +0.06 for momentum alone |
| Quality with capped value weights | Five-factor alpha +4.3% a year (t = 2.4); +5.4% a year net |
Quality is where the return is, and it is mostly a factor and mega-cap story. A quality (profitability) book held neutral to style factors and sectors lost 0.5% a year net: the quality books’ returns were factor tilts, not stock selection. The book that passed its pre-registered test is a long-short quality book with value weights, capped at 5% of a leg per company. Its alpha is measured after market, size, value, investment and momentum factors, and it earns a Sharpe ratio of 0.59 after costs. But alpha rises with concentration, from +1.7% a year with equal weights to +5.7% uncapped. Most of it came in 2021–2026 (+9.4% a year), and without Apple, Microsoft, Nvidia, Alphabet, Amazon and Meta the capped book does no better than equal weights (an exploratory check). Fifteen years of data cannot separate a lasting premium from the 2020s’ mega-cap run.

A data error, caught. Share counts in some SEC filings are 1,000 to 1,000,000 times too large (77 stock-months), which made single stocks whole legs of a value-weighted book in a first run. Market caps are now screened before any value weighting, and the first run’s tables are kept for the record.
Limits #
- Free data has a survivorship hole: delisted companies have no Yahoo prices. Coverage of index members runs from 38% in 1996 to 99% in 2026, and measured pair stability is biased upwards.
- SEC XBRL filings start in 2009–2011, so the fundamental tests cover only about fifteen years, too few to resolve small Sharpe differences.
- Industry codes are today’s, a slight look-ahead.
- A CRSP adapter writes the same files, but it is untested until a WRDS connection is available.
How it’s built #
A Python package built on pandas, NumPy and cvxpy, with every raw download cached so that reruns are offline, and long runs checkpointed so they can resume. The dashboard is a standard-library server with plain HTML, CSS and its own SVG charts.