πŸ“˜Chapter 3: "How to Download Historical K-Line Data in Crypto? Freqtrade download-data Tutorial"

This article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits.

In Freqtrade, K-line data is the foundation for backtesting, optimization, and live trading. Whether you are a strategy developer or researcher, mastering the download-data command is the first step in quantitative trading.

This article explains how to use freqtrade download-data to download historical market data, including common parameters, Docker usage, download recommendations, and supported exchanges.


πŸ“₯ 1. Basic Command Format

  1. Download by specifying trading pairs:

freqtrade download-data \
  --exchange binance \
  --pairs BTC/USDT \
  --timeframes 1h \
  --timerange 20230101-20230701
  1. Download according to config.json:

freqtrade download-data \
  --config user_data/config.json \
  --timeframes 15m \
  --timerange 20200101-20250626

Common Parameter Explanation

Parameter
Description

--exchange

Choose exchange (e.g., binance, bybit, kucoin)

--pairs

Specify trading pairs, e.g., BTC/USDT, multiple separated by commas

--timeframes

Timeframe to download, e.g., 1m, 15m, 1h, 1d

--timerange

Data period, format YYYYMMDD-YYYYMMDD

--days

Download the last N days of data (mutually exclusive with timerange)

--config

(Optional) Use an existing config file to specify exchange


πŸ“Š 2. Suggestions for Downloading Multiple Coins / Timeframes

  1. Multiple pairs (e.g., BTC, ETH, BNB):

  1. Multiple timeframes (e.g., download 15m and 1h simultaneously):

  1. Best practice: download each timeframe separately for easier management:


🐳 3. Downloading Data in Docker

For Docker deployments, the command differs slightly:

Ensure you mount the user_data/ directory correctly in docker-compose.yml:


πŸ“‚ 4. Where Is the Data Stored?

Downloaded K-line data is saved at:

Example:

Freqtrade automatically recognizes and uses these files for backtesting and optimization.


πŸ” 5. Supported Exchanges in Freqtrade

You can run the following command to see supported exchanges:

Common supported exchanges (may vary by version):

  • Binance (Spot / Futures)

  • Bybit

  • KuCoin

  • Huobi

  • Kraken

  • OKX

  • Coinbase Pro

  • Gate, etc.

⚠️ Some exchanges require an API key to download historical data.


βœ… 6. Notes and Recommendations

Item
Recommendation

Download period

Usually cover at least 3–6 months of data

Time granularity

For strategy development, 1h or 15m is common; for high-frequency strategies, use 1m

Longer historical data

Too long data may mislead due to structural market changes

Local storage

1m data consumes significant disk space


πŸ“Œ Summary

freqtrade download-data is the starting point for all strategy development. This article covered:

  • Parameter usage: exchange / pairs / timeframes / timerange

  • Techniques for downloading multiple coins and multiple timeframes

  • Docker environment download method

  • Data storage path and supported exchanges

Last updated