How to Test Freqtrade with Binance? From Backtesting to Dry-Run

 / 
 / 
1

The correct order to test Freqtrade with Binance is to backtest first, then run a dry-run, and only consider live trading at the end. Backtesting and dry-run do not require real Binance API keys. Backtesting uses historical data, while dry-run uses real-time market data without risking real money.

Binance Exchange
The world's largest cryptocurrency exchange by trading volume,leading in security and liquidity.
New user benefit: Enjoy 20% off trading fees upon registration!

Backtesting: Run Your Strategy on Historical Data First

The purpose of backtesting is to verify how your strategy logic performs under known market conditions. It does not involve any exchange connection. Freqtrade loads historical candlestick data from user_data/data/ by default.

The first step is to download data. If you do not have historical Binance data locally, Freqtrade will prompt you to download it using the freqtrade download-data command. Specify the trading pair and timeframe, for example, download 5-minute candlesticks for BTC/USDT.

The second step is to run the backtest. The basic command is freqtrade backtesting --strategy . The strategy file should be placed in the user_data/strategies/ directory. Backtesting uses 5-minute candlesticks by default, and you can override this with the --timeframe parameter.

The backtest result will output a trade statistics table, including total number of trades, average holding time, total profit percentage, and absolute profit. The profit calculation in backtesting already includes fees. Freqtrade uses the exchange's default fee rate. If you need to specify the starting capital, use --dry-run-wallet 1000 or --starting-balance 1000. The amount must be greater than the stake_amount in your configuration, otherwise you cannot run a simulated trade.

One easily overlooked point: at the end of a backtest, all open trades are force-closed. These "forced sells" are listed separately in the results. This simulates the reality that a backtest period must end, and it is not the true performance of your strategy.

Dry-Run: Validate Execution Logic with Real-Time Market Data

Dry-run is an official Freqtrade feature. It runs your strategy under real-time market conditions, but all trades are simulated locally and are not submitted to Binance.

You need to change three things in the configuration. First, set "dry_run" to true. Second, specify a separate database file, for example "db_url": "sqlite:///tradesv3.dryrun.sqlite", so that dry-run trade records are kept separate from future live trading data. Third, API keys can be left empty, because dry-run does not need to connect to an exchange account.

But there is one exception: if you want the dry-run to use real-time market data. Freqtrade's dry-run by default needs to download public market data to run, and this does not require API keys. Only when you configure "sandbox": true or need access to certain authenticated endpoints will you need the corresponding keys. For normal Binance spot dry-run, leaving the keys empty usually works fine.

The startup command is freqtrade trade --config config.json. Freqtrade will output logs showing the dry-run status. After running, you can use freqtrade trade --config config.json --db-url sqlite:///tradesv3.dryrun.sqlite to specify the database location.

Two Binance-Specific Pitfalls

BNB blacklist issue. If your Binance account uses BNB to pay for trading fees, Freqtrade officially recommends adding BNB/ to the blacklist. The reason is: if the first trade happens to be a BNB trading pair, subsequent trades will consume the BNB balance, causing the original BNB order to fail to sell because of insufficient balance.

Exchange ID must be correct. Binance has been split into multiple entities: the international site uses binance, while US users must use binanceus, otherwise the API key will not be recognized. If you plan to run live trading later, this point directly determines whether the connection succeeds.

How Long Should a Dry-Run Last?

There is no fixed number of days. The core purpose of a dry-run is to verify that your strategy can execute normally in a real-time environment: whether signals trigger as expected, whether order simulation is reasonable, and whether Telegram notifications are received. If you are just testing the framework and configuration, running for a few hours to one day is enough to see basic behavior. If you want to evaluate how the strategy performs under real market conditions, you need to cover at least one complete market volatility cycle, but this takes time and cannot be accelerated.

Dry-run results may differ significantly from backtesting because backtesting uses idealized execution assumptions, while dry-run is affected by real-time market latency and configuration.

Binance Exchange
The world's largest cryptocurrency exchange by trading volume,leading in security and liquidity.
New user benefit: Enjoy 20% off trading fees upon registration!

References

  1. GitHub·hrodrig/freqhub env.example, page published or updated: 2026-01-16; checked: 2026-10-08.
  2. Freqtrade·Configure the bot, page published or updated: 2019-07-01; checked: 2026-10-08.
  3. Freqtrade·Backtesting, page published or updated: 2025-06-01; checked: 2026-10-08.
  4. Freqtrade·Backtesting, page published or updated: 2021-07-01; checked: 2026-10-08.
  5. Freqtrade·Sandbox API testing, page published or updated: 2020-02-01; checked: 2026-10-08.
  6. Freqtrade·Start the bot, page published or updated: 2019-11-01; checked: 2026-10-08.
  7. Freqtrade·Exchange-specific Notes, page published or updated: 2019-11-01; checked: 2026-10-08.