← ClaudeAtlas

pairs-scannerlisted

Screen every pair in a basket for cointegration on daily closes and rank the tradeable ones by spread z-score. Runs the Engle-Granger two-step on log prices, tests the residual with a Dickey-Fuller t-stat against MacKinnon 2010 critical values, estimates the Ornstein-Uhlenbeck half-life of mean reversion, and flags out-of-sample regime shifts via a 70/30 residual std ratio. Emits per-pair hedge ratio, ADF t-stat and p-value bucket, half-life, current z-score, and a stability label. Use when a PM or stat-arb desk has a sector basket and asks "which two names are statistically tethered right now, and how wide is the spread." Requires Stocks Starter.
rgourley/quant-garage · ★ 6 · AI & Automation · score 66
Install: claude install-skill rgourley/quant-garage
# pairs-scanner You hand over a basket of tickers. The skill tests every pair for cointegration, estimates the historical tempo of mean reversion, and flags pairs where the spread is currently wide enough to trade. This is a screen, not a strategy. It tells you which pairs are worth looking at, with the statistics that back the claim: hedge ratio, Engle-Granger t-stat, OU half-life, current z-score, and an out-of-sample stability read. The trader decides sizing, execution, and stop rules from there. ## When to invoke - A stat-arb desk with a 5-30 name sector basket asks "which pairs are cointegrated and currently wide" - A PM building a pairs book wants to see the hedge ratio and mean-reversion tempo before committing - The user says "run a pairs scan", "find cointegrated pairs", "test pair X-Y for mean reversion", "which of these are tethered" - Follow-up work after `sector-rotation-signal` narrows to a single sector and you want the within-sector pairs read Not for: universe-wide screens (this is O(n²); a 100-name basket is 4,950 pairs, too many to eyeball). Not for high-frequency pairs (this uses daily closes; intraday cointegration needs tick data). ## What you need - A basket of tickers (`--basket`, required, comma-separated) - `MASSIVE_API_KEY` exported in the environment - Stocks Starter plan minimum (unlimited REST for daily aggs) Optional: - `--lookback-days` (default 252): trading-day window for the fit - `--min-correlation` (default 0.6): |Pearson