Article 9: Freqtrade Quantitative Trading - config.json Basics and Initialization
π Complete Breakdown of Freqtrade's Most Critical File: config.json (With Practical Tips)
Before using Freqtrade for strategy backtesting, data downloading, or live trading, the most essential preparation is creating and configuring the config.json file. It serves as the "command center" of the entire trading framework, determining which exchange to connect to, how to trade, how strategies run, how much trading capital to use, and how to allocate balances.
This article will systematically guide you through the role of config.json, how to generate it, its file structure, and editing tips to help you get started quickly and avoid common pitfalls.
π Want to Learn Quantitative Trading?
π Click to visit: https://www.itrade.icu
Here you'll find Freqtrade beginner tutorials, real-world strategy examples, indicator breakdowns, and more to help you master quantitative trading techniques with ease!
π§± What is config.json?
config.json is Freqtrade's main configuration file, used to centrally manage all runtime parameters of the project. It is a standard JSON-formatted text file containing the following information:
- Exchange account details (API Key/Secret)
 - Trading pairs and amount settings
 - Strategy execution rules (e.g., maximum open positions, shorting allowed, etc.)
 - Data timeframes and backtesting settings
 - Limit/market order control logic
 - Risk management configurations (stop-loss, take-profit, slippage control, etc.)
 - Webhook/Telegram notification channels (optional) Whether you're doing data analysis, backtest optimization, or live deployment, this configuration file is an indispensable foundation. --- ## π How to Generate config.json? Freqtrade provides a command-line tool to generate a default configuration template with one clickβperfect for beginners to get started quickly.
 
freqtrade new-config --config user_data/config.json
- Specify your target path after 
--config(recommended: user_data/config.json) - The directory will be created automatically if it doesn't exist
 - After generation, edit the file using any text editor
## π Recommended File Structure
The recommended basic directory structure for a Freqtrade project is as follows:
 
freqtrade/
βββ user_data/
β βββ config.json β β
 Main configuration file
β βββ strategies/ β Strategy folder (.py files)
β βββ logs/ β Log output
β βββ ...
βββ freqtrade/ β Project source code (or virtual environment)
Placing config.json in the user_data/ folder is the officially recommended practice, which helps maintain path consistency and ease of backup management.
π³ Directory Structure When Running with Docker
If you're using the officially recommended Docker method to run Freqtrade (highly recommended!), the directory structure is controlled by Docker volume mappings and differs slightly from local execution.
ft_userdata/
βββ user_data/
β βββ config.json β β
 Main configuration file (for modifying runtime parameters)
β βββ strategies/ β Strategy folder (.py files)
β βββ hyperopt/ β Parameter optimization results
β βββ logs/ β Log output
β βββ ...
βββ docker-compose.yml β Service startup entry configuration
π Beginner Preview Example
Below is a preview of the most basic version of a config.json file (showing only the initial part):
{
  "max_open_trades": 3,
  "stake_currency": "USDT",
  "stake_amount": 100,
  "tradable_balance_ratio": 0.95,
  "dry_run": true,
  "exchange": {
    "name": "binance",
    "key": "your_api_key",
    "secret": "your_api_secret",
    "password": "your_api_password" // Required only for certain exchanges like OKX or Kraken
  }
}
Field explanations:
- max_open_trades: Maximum number of positions allowed open simultaneously (to prevent overexposure)
 - stake_currency: Base currency for trading funds, usually USDT
 - stake_amount: Amount of funds used per trade
 - dry_run: Whether to enable dry-run mode (true means no real money is used) ## π οΈ Debugging Tips When Modifying Configuration
 - β
 After modification, use the following command to check if the 
EXCHANGE API keyis valid: 
freqtrade list-markets --config user_data/config.json
| API Key Configured? | Can list-markets run? | Can trade? | Notes | 
|---|---|---|---|
| β Yes | β Yes | β Yes | Suitable for live trading with full features | 
| β No | β Depends on exchange | β No | Only some exchanges allow anonymous market listing | 
- β You can also run a strategy initialization before backtesting to check for errors:
 
freqtrade backtesting --config user_data/config.json
π§ Summary
| Key Point | Recommendation | 
|---|---|
| Configuration file name | Fixed as config.json, recommended in user_data/
 | 
| Generation command | freqtrade new-config --config <path> | 
| Error troubleshooting | Use backtesting or list-markets to verify | 
| Version control | β Strongly recommended to include config.json in Git | 
              
    
Top comments (0)