Backtesting helps you evaluate a strategy using historical market data before risking real funds. This page explains the recommended and simplest method to obtain OHLCV (candlestick) data from Binance using the official Binance Data Portal (data.binance.vision) and prepare it for the Prime Trading Bot backtest module.
Step 1 — Choose symbol & timeframe
- Decide which trading pair you want to test, e.g.
BTCUSDT
, ETHUSDT
, BNBUSDT
.
- Pick the candle interval that matches your bot configuration:
1m, 5m, 15m, 1h, 4h, 1d
.
Step 2 — Download data from Binance Data Portal
- Open the Binance Data Portal: https://data.binance.vision.
- Navigate: Data → Spot → Kline (Candlestick).
- Find the symbol and interval you need (the site lists files by pair and timeframe).
- Select the time range / year(s) you want and download the ZIP file(s).
- Extract the ZIP file(s) to get the CSV file(s) containing historical klines.
Step 3 — Prepare CSV for the bot
The backtest module expects CSV with these columns, in this order:
timestamp, open, high, low, close, volume
Notes:
- timestamp should be UNIX time in milliseconds (Binance files usually provide this).
- If the downloaded CSV contains extra columns, remove all columns except the six listed above.
- Concatenate multiple CSV files (if needed) into one file covering your required date range. Ensure rows are chronological.
Step 4 — Verify data quality
- Check for missing rows or time gaps — backtests require continuous candle data for accurate results.
- Ensure the file encoding is UTF-8 and that decimal separators are periods (
3.1415
), not commas.
- Confirm the timeframe matches the bot's Interval setting.
Step 5 — Run the backtest in the GUI
- Open the Prime Trading Bot Client (GUI).
- Go to the Backtest or Run Backtest section.
- Select the CSV file you prepared and upload it.
- Choose the same strategy/settings you want to test (indicators, TP/SL, Safety Orders).
- Start the backtest and wait for the results to appear in the Report Tab.
Tip: Use at least 3–6 months of data for mid-short term strategies, and 12+ months for longer-term evaluation. More data yields more reliable performance estimates.
CSV example (first row)
timestamp | open | high | low | close | volume |
1622505600000 | 35700.00 | 35850.00 | 35600.00 | 35800.00 | 123.45 |
Troubleshooting
- Backtest shows fewer trades than expected: Check that the CSV covers the exact time window and interval you selected in the GUI.
- Backtest fails to start: Verify the CSV column order and that timestamp is in milliseconds.
- Gaps in data: Re-download missing date ranges from Binance Data Portal and re-concatenate files.
Useful Links