DEV Community

Cover image for Article 3: πŸ› οΈ Starting from Scratch! A Detailed Guide to the Freqtrade `download-data` Command and Docker Usage
itrade icu
itrade icu

Posted on

Article 3: πŸ› οΈ Starting from Scratch! A Detailed Guide to the Freqtrade `download-data` Command and Docker Usage

Article 3: πŸ› οΈ Starting from Scratch! A Detailed Guide to the Freqtrade download-data Command and Docker Usage

In Freqtrade, K-line data is the foundation for backtesting, optimization, and trading.

Whether you're a strategy developer or a researcher, mastering the download-data command is the first step toward quantitative trading.

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


πŸš€ Want to Learn Quantitative Trading?

πŸ‘‰ Visit: https://www.itrade.icu

Find Freqtrade tutorials, strategy guides, indicator analysis, and more to help you master quantitative trading with ease!


πŸ“₯ 1. Basic Command Format

  1. Download data for a specific trading pair:
freqtrade download-data \
  --exchange binance \
  --pairs BTC/USDT \
  --timeframes 1h \
  --timerange 20230101-20230701
Enter fullscreen mode Exit fullscreen mode
  1. Download using a config.json file:
freqtrade download-data \
  --config user_data/config.json \
  --timeframes 15m \
  --timerange 20200101-20250626
Enter fullscreen mode Exit fullscreen mode

Common Parameters Explained:

Parameter Description
--exchange Specify the exchange (e.g., binance, bybit, kucoin)
--pairs Specify trading pairs, e.g., BTC/USDT, separated by commas
--timeframes Timeframes to download, e.g., 1m, 15m, 1h, 1d
--timerange Data time range, format: YYYYMMDD-YYYYMMDD
--days Download data for the last N days (alternative to --timerange)
--config (Optional) Use an existing config file to specify the exchange

πŸ“Š 2. Downloading Multiple Pairs / Timeframes

  1. Multiple trading pairs (e.g., BTC, ETH, BNB):
--pairs BTC/USDT,ETH/USDT,BNB/USDT
Enter fullscreen mode Exit fullscreen mode
  1. Multiple timeframes (e.g., 15m and 1h):
--timeframes 15m,1h
Enter fullscreen mode Exit fullscreen mode
  1. Best Practice: Download each timeframe separately for easier management:
freqtrade download-data --timeframes 15m
freqtrade download-data --timeframes 1h
Enter fullscreen mode Exit fullscreen mode

🐳 3. Using Docker to Download Data

If you're using Docker, the command is slightly different:

docker compose run --rm freqtrade download-data \
  --config /quants/freqtrade/user_data/config.json \
  --timeframes 15m \
  --timerange 20220101-20230701
Enter fullscreen mode Exit fullscreen mode

Ensure the user_data/ directory is properly mounted in your docker-compose.yml:

volumes:
  - "./user_data:/quants/freqtrade/user_data"
Enter fullscreen mode Exit fullscreen mode

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

Downloaded K-line data is stored in:

user_data/data/<exchange>/<pair><timeframe>-<type>.feather
Enter fullscreen mode Exit fullscreen mode

For example:

user_data/data/binance/BTC_USDT_USDT-5m-futures.feather
Enter fullscreen mode Exit fullscreen mode

Freqtrade automatically detects and uses this data for backtesting and optimization.

πŸ” 5. Which Exchanges Does Freqtrade Support?

Run the following command to view currently supported exchanges:

freqtrade list-exchanges
Enter fullscreen mode Exit fullscreen mode

Commonly supported exchanges (may vary by version):

  • Binance (spot and futures)
  • Bybit
  • KuCoin
  • Huobi
  • Kraken
  • OKX
  • Coinbase Pro
  • Gate, etc. > ⚠️ Some exchanges require an API key to download historical data.

βœ… 6. Tips and Recommendations

Item Recommendation
Time Range Download at least 3–6 months of data
Timeframe Use 1h or 15m for strategy development; 1m for high-frequency strategies
Longer Data = Better? Very old data may mislead due to changing market conditions
Storage Space 1m data is large; ensure sufficient disk space

πŸ“Œ 7. Summary

The freqtrade download-data command is the starting point for all strategy development.

This article covered:

  • Parameter usage: exchange, pairs, timeframes, timerange
  • Techniques for downloading multiple pairs and timeframes
  • Downloading data in a Docker environment
  • Data storage paths and supported exchanges

Top comments (0)