Essential Exchange-Specific Notes for Freqtrade Users

·

This page details common considerations and exchange-specific information that may not apply to other trading platforms.

Configuring Your Exchange

Freqtrade relies on the CCXT library, which supports over 100 cryptocurrency exchange markets and trading APIs. The latest list is available on the CCXT repo homepage. However, the development team tests the bot on only a few exchanges. You can find the current list of these exchanges in the "Home" section of this documentation.

You are welcome to test other exchanges and submit feedback or pull requests to help improve the bot or verify its performance on additional platforms.

Some exchanges require special configuration, detailed below.

Sample Exchange Configuration

Here is an example configuration for the "binance" exchange:

"exchange": {
    "name": "binance",
    "key": "your_exchange_key",
    "secret": "your_exchange_secret",
    "ccxt_config": {},
    "ccxt_async_config": {},
    // ...
}

Setting Rate Limits

CCXT's default rate limits are generally reliable. If you encounter rate-limiting issues (often visible as DDOS exceptions in logs), you can adjust the rateLimit value.

"exchange": {
    "name": "kraken",
    "key": "your_exchange_key",
    "secret": "your_exchange_secret",
    "ccxt_config": {"enableRateLimit": true},
    "ccxt_async_config": {
        "enableRateLimit": true,
        "rateLimit": 3100
    },
}

This configuration enables Kraken and avoids exchange bans by limiting request rates. "rateLimit": 3100 sets a 3.1-second wait between calls. You can also disable rate limiting entirely by setting "enableRateLimit" to false.

Note: The optimal rate limit setting depends on the exchange and your whitelist size. We provide reasonable defaults for each exchange. If you face bans, ensure "enableRateLimit" is enabled and gradually increase the "rateLimit" parameter.

Binance

Binance supports time_in_force settings.

Stop-Loss on Exchange

Binance supports stoploss_on_exchange using stop-loss-limit orders. This feature offers significant advantages, so we recommend enabling it. For futures trading, Binance supports both stop-limit and stop-market orders. You can choose between them using the "limit" or "market" setting in order_types.stoploss.

Recommended Binance Blacklist

For Binance, we recommend adding "BNB/" to your blacklist to avoid issues, unless you maintain sufficient extra BNB in your account or disable using BNB for fee payments. Binance accounts can use BNB for fees. If a trade uses BNB, subsequent trades might deplete this position, preventing the sale of the initial BNB trade due to insufficient quantity.

Binance Websites

Binance has split into two platforms. Users must use the correct CCXT exchange ID; otherwise, API keys won't be recognized.

Binance RSA Keys

Freqtrade supports Binance RSA API keys. We recommend setting them as environment variables.

export FREQTRADE__EXCHANGE__SECRET="$(cat ./rsa_binance.private)"

You can also configure them via the config file. Since JSON doesn't support multiline strings, replace all line breaks with \n for valid JSON.

// ...
"key": " ",
"secret": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBABACAFQA<...>s8KX8=\n-----END PRIVATE KEY-----"
// ...

Binance Futures

Binance has specific futures trading量化 rules that prohibit excessively low stakes and too many orders. Violations may lead to trading restrictions.

When trading Binance futures, you must use the order book because futures lack ticker data.

"entry_pricing": {
    "use_order_book": true,
    "order_book_top": 1,
    "check_depth_of_market": {
        "enabled": false,
        "bids_to_ask_delta": 1
    }
},
"exit_pricing": {
    "use_order_book": true,
    "order_book_top": 1
},

Binance Futures Settings

Users must set "Position Mode" to "One-Way Mode" and "Asset Mode" to "Single-Asset Mode" in futures settings. Freqtrade checks these at startup and displays errors if they're misconfigured. Freqtrade does not change these settings.

Kraken

Kraken supports "time_in_force" with settings like "GTC" (Good-Til-Canceled), "IOC" (Immediate-Or-Cancel), and "PO" (Post-Only market orders).

Stop-Loss on Exchange

Kraken supports stoploss_on_exchange with both stop-market and stop-limit orders. This offers significant benefits, and we recommend using it. Choose between "limit" or "market" in order_types.stoploss.

Kraken Historical Data

Kraken's API provides only 720 historical candles, sufficient for dry-run and live trading but problematic for backtesting. To download Kraken data, use --dl-trades; otherwise, the bot repeatedly downloads the same 720 candles, resulting in insufficient backtest data.

To speed up downloads, use Kraken's trading data archives, updated quarterly. Place these files in user_data/data/kraken/trades_csv. You can structure directories for incremental updates, assuming filenames remain unchanged. Duplicate content is ignored based on timestamps, but gaps may cause incomplete data.

└── trades_csv
    ├── Kraken_full_history
    │   ├── BCHEUR.csv
    │   └── XBTEUR.csv
    ├── Kraken_Trading_History_Q1_2023
    │   ├── BCHEUR.csv
    │   └── XBTEUR.csv
    └── Kraken_Trading_History_Q2_2023
        ├── BCHEUR.csv
        └── XBTEUR.csv

Convert these files for Freqtrade:

freqtrade convert-trade-data --exchange kraken --format-from kraken_csv --format-to feather
# Convert trade data to different OHLCV timeframes
freqtrade trades-to-ohlcv -p BTC/EUR BCH/EUR --exchange kraken -t 1m 5m 15m 1h

Converted data allows downloading and starting from the latest trades.

freqtrade download-data --exchange kraken --dl-trades -p BTC/EUR BCH/EUR

Note: Downloading Kraken data requires more RAM and time than other exchanges because trade data converts to candles locally. Freqtrade downloads every trade for the pair/timeframe combination.

Adjusting Rate Limits

The rateLimit parameter specifies the delay between requests in milliseconds, not requests per second. To avoid Kraken's "Exceeded request limit" errors, increase this value.

Kucoin

Kucoin requires a passphrase for each API key. Add it to your configuration:

"exchange": {
    "name": "kucoin",
    "key": "your_exchange_key",
    "secret": "your_exchange_secret",
    "password": "your_exchange_api_key_password",
    // ...
}

Kucoin supports time_in_force.

Stop-Loss on Exchange

Kucoin supports stoploss_on_exchange with stop-market and stop-limit orders. We recommend using this feature. Choose between "limit" or "market" in order_types.stoploss.

Kucoin Blacklist

For Kucoin, add "KCS/" to your blacklist unless you maintain extra KCS or disable KCS for fees. Kucoin accounts may use KCS for fees. Trades involving KCS could deplete your position, preventing sales due to insufficient quantity.

HTX (formerly Huobi)

HTX supports stoploss_on_exchange with stop-limit orders. This offers significant advantages, so we recommend enabling it.

OKX (formerly OKEX)

OKX requires a password for each API key. Add it to your configuration:

"exchange": {
    "name": "okx",
    "key": "your_exchange_key",
    "secret": "your_exchange_secret",
    "password": "your_exchange_api_key_password",
    // ...
}

Warning: OKX provides only 100 candles per API call. Thus, strategies have limited data in backtesting mode.

Futures Trading

OKX futures have "Position Mode," either "buy/sell" or long/short (hedge mode). Freqtrade supports both (we recommend "buy/sell"), but changing modes during trading causes exceptions and failures. OKX also provides only about three months of MARK candles for futures. Backtesting before this period may have slight inaccuracies due to missing funding fee data.

Gate.io

Stop-Loss on Exchange

Gate.io supports stoploss_on_exchange with stop-loss-limit orders. We recommend enabling this feature.

Gate.io allows fee payments with POINT. Since this isn't a tradable currency, automatic fee calculation fails (defaulting to 0). Use exchange.unknown_fee_rate to specify the exchange rate between Point and your collateral currency. Changing the collateral currency requires updating this value.

Bybit

On Bybit, futures trading currently supports only USDT markets with isolated futures mode. Users with unified accounts can create a sub-account initially set to "non-unified" for isolated futures. At startup, Freqtrade sets the position mode to "One-Way Mode" for the entire (sub-)account to avoid repeated calls, but changing this mode may cause errors.

Since Bybit doesn't provide funding rate history, dry-run calculations apply to live trading.

API keys for live futures trading (non-unified sub-accounts) require:

We strongly recommend restricting API keys to specific IP addresses.

Stop-Loss on Exchange

Bybit (futures only) supports stoploss_on_exchange with stop-loss-limit orders. This offers great advantages, so we recommend enabling it. For futures, Bybit supports both stop-limit and stop-market orders. Choose between them using "limit" or "market" in order_types.stoploss.

Bitmart

On Bitmart, API keys include a memo (the name you gave the key) along with the key and secret. Thus, passing the UID is required.

"exchange": {
    "name": "bitmart",
    "uid": "your_bitmart_api_key_memo",
    "secret": "your_exchange_secret",
    "password": "your_exchange_api_key_password",
    // ...
}

Necessary Verification

Bitmart requires secondary verification for successful spot market trading via API—even though UI trading works with only primary verification.

All Exchanges

If you encounter persistent Nonce errors (e.g., InvalidNonce), regenerate your API keys. Resetting the Nonce is difficult; regenerating keys is easier.

Random Notes for Other Exchanges

Latest Price / Incomplete Candles

Most exchanges return the current incomplete candle via their OHLCV/klines API. By default, Freqtrade assumes incomplete candles are fetched and removes the last candle. Due to repainting risks, Freqtrade doesn't allow using this incomplete candle.

If your strategy needs the latest price, use the data provider within the strategy.

Advanced Freqtrade Exchange Configuration

Advanced options use the _ft_has_params setting, overriding defaults and exchange-specific behaviors. Available options are listed as _ft_has_default in the exchange class.

For example, to test Kraken's "FOK" order type and modify the candle limit to 200 (so each API call fetches only 200 candles):

"exchange": {
    "name": "kraken",
    "_ft_has_params": {
        "order_time_in_force": ["GTC", "FOK"],
        "ohlcv_candle_limit": 200
    }
    //...
}

👉 Explore advanced exchange configuration strategies

Frequently Asked Questions

What should I do if I get rate-limited by an exchange?
Enable "enableRateLimit" in your exchange configuration and gradually increase the "rateLimit" value. Start with the exchange's recommended API call limits and adjust based on your whitelist size and trading frequency.

Why should I enable stop-loss on exchange?
Exchange-based stop-loss orders provide greater reliability than bot-managed stops since they remain active even if your trading bot goes offline. This prevents unexpected losses during connectivity issues.

How do I handle exchanges with incomplete historical data?
For exchanges with limited historical data (like Kraken's 720-candle limit), use the --dl-trades parameter when downloading data. Consider using exchange-provided trade archives when available for more comprehensive backtesting.

What are the security best practices for exchange API keys?
Always restrict API keys to necessary permissions (usually read and trade permissions only). Enable IP whitelisting when supported, and never share your API secret or private keys. Regularly rotate your API keys for enhanced security.

Why do some exchanges require additional parameters like passwords or UIDs?
Certain exchanges have enhanced security measures or account structures that require additional authentication parameters. Always check the specific exchange's API documentation for required fields beyond the standard key and secret.

How can I verify my exchange configuration is working correctly?
Use Freqtrade's dry-run mode to test your configuration without risking real funds. Monitor the logs for any authentication errors or rate-limiting messages, and verify that price data loads correctly for your selected trading pairs.