Skip to content

acvid3/grid_crypto_analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid Crypto Analytics

Grid trading strategy backtester using historical Binance data.

How it works

Simulates buying crypto when the price drops by a set threshold from the peak price, and selling when it rises by the same threshold.

Buy Logic

  • Tracks max_price — highest price since the last completed cycle
  • Buy triggers when price drops by threshold_percent from max_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_price updates to current price

Sell Logic

  • Each buy creates a sell order at buy_price * (1 + threshold)
  • On trigger — profit is realized

Tech Stack

  • Backend: Python, FastAPI, aiohttp (async Binance API requests)
  • Frontend: React, Vite, Recharts

Running

Backend

cd backend
source venv/bin/activate
python run.py

Server at http://localhost:8000, Swagger at http://localhost:8000/docs

Frontend

cd frontend
npm run dev

At http://localhost:3000

Parameters

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

About

Grid trading strategy backtester using historical Binance data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors