Quick Start¶
Get up and running with your first backtest in under 2 minutes.
Prerequisites¶
- Python 3.12+
- uv (recommended) or pip
Installation¶
Using uv (Recommended)¶
git clone https://github.com/jordantete/grid_trading_bot.git
cd grid_trading_bot
uv sync --all-extras --dev
Using venv and pip¶
git clone https://github.com/jordantete/grid_trading_bot.git
cd grid_trading_bot
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .
Run Your First Backtest¶
The repository ships with a default configuration file at config/config.json set to backtest mode:
This will:
- Load historical OHLCV data for the configured trading pair
- Execute the grid trading strategy over the specified period
- Display an interactive Plotly chart with price action and order execution
- Print performance metrics (ROI, max drawdown, Sharpe ratio, etc.)
In the performance summary, Grid Trading Gains is the realized PnL: every sell is booked against the weighted average cost of the crypto held, fees included. Unrealized PnL is the crypto still held at the end, valued at the final price against that cost; the two add up to the change in account value. Max Drawdown Duration is the longest time the account value stayed below a previous peak.
Disable plots
Add --no-plot to skip the chart display, useful for CI or batch runs:
Next Steps¶
- Configure your own strategy — Adjust grid levels, spacing, and risk parameters
- Understand grid trading concepts — Learn about arithmetic vs. geometric grids
- CLI reference — Explore all command-line options
- Set up monitoring — Visualize live bot activity with Grafana