Skip to content

Quick Start

Get up and running with your first backtest in under 2 minutes.

Prerequisites

  • Python 3.12+
  • uv (recommended) or pip

Installation

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:

uv run grid_trading_bot run --config config/config.json

This will:

  1. Load historical OHLCV data for the configured trading pair
  2. Execute the grid trading strategy over the specified period
  3. Display an interactive Plotly chart with price action and order execution
  4. 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:

uv run grid_trading_bot run --config config/config.json --no-plot

Next Steps