πŸ”ŒConnecting to Exchanges: Detailed Freqtrade Exchange Configuration

This article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits. Freqtrade connects to exchanges through the exchange and ccxt_config settings in config.json. This step is essential for strategy execution and involves API keys, WebSocket, rate limits, and other critical parameters.

This article provides a detailed guide on configuring exchange access parameters and recommended practices for a more efficient and stable connection.


🏦 Exchange Configuration Details

"exchange": {
  "name": "binance",               // Exchange name, e.g., binance, bybit, okx
  "key": "your_api_key",           // Your API Key
  "secret": "your_api_secret",     // API Secret
  "password": "your_password",     // Required for some exchanges like OKX, optional for others
  "ccxt_config": { ... },          // CCXT additional settings (see below)
  "pair_whitelist": [ "BTC/USDT" ],// List of tradable pairs
  "pair_blacklist": [ "*/BNB" ]    // Blacklisted pairs (optional)
}

πŸ“Œ Field Descriptions

Field
Description

name

Exchange name in English (must support CCXT)

key

API key provided by the exchange for trading

secret

Corresponding secret key

password

Additional authentication, used by OKX, Bitget etc. (optional)

pair_whitelist

Only allow trading for pairs listed here

pair_blacklist

Exclude certain pairs (e.g., low liquidity or unstable coins)

🧠 Usage Tips

  • API permissions must include both read + trade to enable live trading;

  • Use separate API keys for different strategies for better isolation and risk control;

  • Do not upload your config.json to GitHub or other public platforms!


βš™οΈ ccxt_config β€” Advanced Connection Settings

ccxt_config is used when Freqtrade calls the CCXT library, allowing optimization of request frequency, real-time data, market type, etc.


  • Controls whether Freqtrade automatically respects exchange API rate limits;

  • Prevents IP bans or trade restrictions by the exchange;

  • Strongly recommended to enable.


πŸ“‘ enable_ws β€” Enable WebSocket for Real-Time Data

  • When enabled, Freqtrade receives real-time market and order updates via WebSocket;

  • Faster and lower latency than REST API, suitable for high-frequency strategies;

  • Requires exchange support and sometimes additional permissions (e.g., OKX);

  • Can be disabled if high-frequency trading is not needed.


πŸ” markets_refresh_interval β€” Market Data Refresh Interval

  • Interval in seconds;

  • Controls how often the trading pairs are updated;

  • Default 60 seconds is sufficient for stability;

  • Setting it too low may trigger API rate limits.


πŸ§ͺ Verify Exchange Connection

After configuration, test if the exchange is connected successfully:

βœ… Returns a list of trading pairs, indicating API key and market type are correctly configured ❌ If you see authentication error or 403, check:

  • API Key and Secret are correct

  • Trade permissions are granted

  • Two-factor authentication does not restrict API usage



🧠 Summary Checklist

Parameter
Description
Recommended Setting

exchange.name

Exchange name

e.g., binance, bybit

exchange.key/secret

API credentials

Required

enableRateLimit

Limit request rate to avoid risk

true

enable_ws

Enable WebSocket real-time data

true (if supported)

markets_refresh_interval

How often to refresh trading pairs

Typically 60 seconds

Last updated