Your First Backtest¶
Run a strategy backtest in under 2 minutes.
graph LR
CLI["tradai backtest quick"] --> Backend["Backend API"]
Backend --> SQS["SQS Queue"]
SQS --> Lambda["Lambda<br/>Consumer"]
Lambda --> ECS["ECS Task<br/>Freqtrade"]
ECS --> Results["S3 Results"]
ECS --> MLflow["MLflow<br/>Tracking"]
Results --> CLI2["CLI<br/>Show Results"]
CLI -.->|"--local"| Local["Local<br/>Freqtrade"]
Local --> Results Use
--localto skip the backend and run Freqtrade directly on your machine.
Fastest Path
Use tradai backtest quick YourStrategy --local to run a local backtest without starting any services.
Quick Local Backtest (No Setup)¶
# Run locally (no backend required)
tradai backtest quick YourStrategy --local
# Custom period and symbol
tradai backtest quick YourStrategy --local --period 7d --symbol ETH/USDT:USDT
# Strategy in a separate repo
tradai backtest quick StochRsi --strategy-dir ../tradai-strategies
Full Backtest via Services¶
# 1. Start services
just up
# 2. Run backtest with MLflow tracking
tradai backtest quick YourStrategy \
--timerange 20240101-20240131 \
--symbol BTC/USDT:USDT
Tip: Add
--localto run without the backend service.
Example output:
=== Backtest Results ===
Strategy: YourStrategy
Period: 2024-01-01 to 2024-01-31
Total Trades: 15 | Win Rate: 60.0%
Sharpe: 1.45 | Sortino: 2.10 | Max Drawdown: -3.25%
View in MLflow¶
Open http://localhost:5001 to see metrics, parameters, and trade logs.
Common Issues¶
| Problem | Fix |
|---|---|
| "No data available" | tradai data sync BTC/USDT:USDT --start 2024-01-01 --end 2024-01-31 |
| "Strategy not found" | tradai strategy list |
| "Connection refused" | just up && just ps |
Note: The
tradai datasubcommand requires the full workspace to be installed (just setuporuv sync --all-packages).
Next Steps¶
- Full Backtesting Guide — Compare runs, export trades, HTML reports, quality thresholds
- Create a New Strategy — Build your own
- Collect Market Data — Sync more trading pairs