Skip to content

adnanegrb/Stat_Arb_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stat Arb Bot — BTC/ETH

A self-contained algorithmic trading bot that profits from temporary price divergences between Bitcoin and Ethereum. When the two assets drift apart, the bot bets on their reunion — and pockets the spread.


Results (2021 → 2026 backtest)

Metric Value
Starting capital $100
Final capital $470,937
Total return +470,837%
Sharpe Ratio 8.40
Max Drawdown -6.35%
Win Rate 85%
Trades 966
Leverage x2

Survived the 2022 crypto crash (-70% BTC) without blowing up.


How it works

The bot watches the BTC/ETH spread in real time. When the spread stretches too far from its historical norm, it enters a market-neutral trade — long one asset, short the other — and exits once the spread snaps back.

Under the hood: a Kalman Filter tracks the dynamic hedge ratio between the two assets, a rolling Z-score triggers entries and exits, and Kelly Criterion sizes each position.


Project structure

├── agent.py          live trading bot (Binance Futures)
├── backtest.py       historical simulation engine
├── requirements.txt
└── results/
    ├── results.txt       full metrics + trade log
    └── equity_curve.png  charts

Quickstart

pip install -r requirements.txt
python backtest.py   # runs simulation, saves results/
python agent.py      # live bot — paper trading by default

Past performance does not guarantee future results. The bot runs in simulation mode by default — no real orders are sent until you explicitly enable them.

About

Built a Python stat arb bot trading BTC/ETH via Kalman Filter hedge ratio and Z-score mean reversion. Kelly Criterion sizing. 5-year backtest (2021–2026): Sharpe 8.4, max drawdown 6%, robust across bull and bear cycles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages