Grid trading strategy backtester using historical Binance data.
Simulates buying crypto when the price drops by a set threshold from the peak price, and selling when it rises by the same threshold.
- Tracks
max_price— highest price since the last completed cycle - Buy triggers when price drops by
threshold_percentfrommax_price:level = int((max_price - price) / (max_price * threshold)) - Each level is bought only once
- At
threshold = 5%, max 19 purchases (levels 5%–95% from peak) - Grid resets when all positions are closed —
max_priceupdates to current price
- Each buy creates a sell order at
buy_price * (1 + threshold) - On trigger — profit is realized
- Backend: Python, FastAPI, aiohttp (async Binance API requests)
- Frontend: React, Vite, Recharts
cd backend
source venv/bin/activate
python run.pyServer at http://localhost:8000, Swagger at http://localhost:8000/docs
cd frontend
npm run dev| Parameter | Description | Default |
|---|---|---|
| Initial Balance | Starting capital in USDT | 10000 |
| Trade Amount | Amount per trade | 1000 |
| Price Change Threshold | Price change trigger | 5% |
| Commission Rate | Exchange fee | 0.1% |
| Trading Pair | Trading pair | ETHUSDT |
| Time Interval | Candle timeframe | 1h |