Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crypto-stat-arb

⚠️ Research project — NOT financial advice. Personal research codebase exploring systematic crypto trading. Backtests carry look-ahead, survivorship, and overfit risks even when we try to avoid them. Live results may differ substantially from backtests. Do not trade real money based on this code without doing your own validation. Past performance does not predict future results. You can and will lose money.

Statistical arbitrage on Binance spot pairs using Ornstein–Uhlenbeck process modeling of mean-reverting spreads.

Approach

  1. Data — pull historical 1h klines from Binance public REST (no API key needed).
  2. Pair screen — Engle–Granger cointegration test on a candidate basket.
  3. OU fit — fit an OU SDE dXt = θ(μ − Xt)dt + σ dWt to the spread of each surviving pair via MLE.
  4. Recency-weighted variant — refit OU with exponential weights on recent observations to track regime shifts.
  5. Backtest — z-score band entries/exits with realistic fees + slippage; in-sample + out-of-sample split.

Layout

src/        strategy code
data/       cached raw + processed market data (gitignored)
results/    backtest outputs (gitignored)

Setup

pip install -r requirements.txt
cp .env.example .env   # only needed for live trading later
python -m src.download --symbols BTCUSDT ETHUSDT --interval 1h --days 365

Status

Scaffolding in progress.

About

Crypto stat arb

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages