Pair Trade Screener is a statistical arbitrage research tool. find_pairs.py pulls company lists and two years of daily prices from the Financial Modeling Prep API, filters pairs by correlation, tests the spread for cointegration with an Augmented Dickey-Fuller test, and estimates hedge ratio, half-life and z-score. analyze_spread.py examines a single pair in depth.
The skill also describes entry and exit rules, market-neutral position sizing and report structure in its reference files. It reports statistics and does not give investment advice.
What You Get
- A JSON file from find_pairs.py with metadata and ranked pairs
- Per-pair correlation, hedge ratio, ADF result, half-life, z-score and signal
- A single-pair statistical report from analyze_spread.py printed to the terminal
- A record of whether each symbol used dividend-adjusted or raw closing prices
- Reference guidance on entry and exit rules, sizing, costs and shorting
Common Use Cases
- Screening one sector for pairs that moved together over two years
- Examining the spread behaviour of two named tickers
- Checking whether a pair’s correlation has weakened recently
- Building a watchlist of pairs sorted by cointegration strength
What Makes It Unique
It combines correlation, cointegration, half-life and structural-break checks in one workflow and states quality thresholds and red flags in advance. The scripts validate thresholds, lookback windows and duplicate symbols before they call the API, record the price basis used for each symbol, and fail with a clear message when the statistics library is missing. Reference files cover methodology, cointegration theory, trade rules and sibling skills.
Under The Hood
Claude runs the Python scripts from the shell, often through uv with a pinned statsmodels version. The scripts call the Financial Modeling Prep API for the company screener and daily history, using the API key from the FMP_API_KEY environment variable, and fall back from the dividend-adjusted endpoint to full and older endpoints. find_pairs.py creates the output folder and writes one JSON file, while analyze_spread.py prints to the terminal only. Progress and a ranked summary go to standard output. Access to the endpoints depends on your FMP plan.