DEV Community

Cover image for Episode 11: Futures or Spot? Master Freqtrade's Trading Modes and Leverage Settings in One Go!
itrade icu
itrade icu

Posted on • Originally published at itrade.icu

Episode 11: Futures or Spot? Master Freqtrade's Trading Modes and Leverage Settings in One Go!

Episode 11: ⚔️ Futures or Spot? Master Freqtrade's Trading Modes and Leverage Settings in One Go!

When using Freqtrade, the choice of trading mode directly impacts your strategy logic, risk management, and order execution. You can opt for spot trading or leverage-enabled futures trading. Different modes come with distinct configuration parameters, such as margin_mode, leverage, and liquidation_buffer.

This episode systematically explains the roles, use cases, and practical considerations of these settings to help you build a robust risk control framework.


🚀 Want to Learn Quantitative Trading?

👉 Click to visit: https://www.itrade.icu

Here you'll find Freqtrade beginner tutorials, real-world strategy guides, indicator breakdowns, and more — helping you master quant trading skills with ease!

💱 trading_mode — Trading Mode Setting

"trading_mode": "spot"
Enter fullscreen mode Exit fullscreen mode
  • Determines whether Freqtrade operates in the spot or futures market.
  • Available options:
    • "spot": Spot mode — only buy low, sell high; no shorting.
    • "futures": Futures mode — supports leverage, long/short positions; more flexible but higher risk.

🟢 Spot Mode Features

  • Only profits from price increases (buy low, sell high) — ideal for bull markets.
  • Simple logic, no leverage management needed.
  • Best for beginners or stable strategies.

🔴 Futures Mode Features

  • Supports long and short positions — suits volatile or bearish markets.
  • Leverage amplifies both profits and losses.
  • Requires advanced risk controls like position sizing, liquidation buffers, and isolated margin.

✅ Practical Tip:

  • Beginners should start with "spot".
  • Switch to "futures" only after gaining experience and enabling proper risk controls.

🧮 margin_mode — Futures Margin Mode

margin_mode is only effective when trading_mode: "futures" — it is ignored in spot mode. It defines the margin type for each futures trade.

"trading_mode": "futures", // Futures mode
"margin_mode": "isolated"
Enter fullscreen mode Exit fullscreen mode

Available values:

Value Meaning Explanation
"isolated" Isolated Margin (Recommended) Each position bears its own risk — liquidation of one trade won't affect others. Recommended for futures beginners.
"cross" Cross Margin All positions share account balance — high risk; poor management can lead to full account liquidation.

✅ Recommended Setting:

  • Use "isolated" — even if one position gets liquidated, it won’t drag down the entire account. Safer and more stable.

💥 leverage — Leverage Multiplier Setting

Freqtrade allows dynamic leverage setting within strategies, and you can customize it per trading pair.

📌 Example in Strategy Code:

def leverage(self, pair: str, current_time: datetime, current_rate: float,
             current_profit: float, current_cost: float, **kwargs) -> float:
    return 3.0  # Set to 3x leverage
Enter fullscreen mode Exit fullscreen mode

⚠️ Key Notes:

  • Leverage is only available in trading_mode = futures.
  • Return value must be a float.
  • If the leverage() method is not implemented, Freqtrade won’t set leverage — it defaults to the exchange’s account setting.
  • Some exchanges cap max leverage (e.g., Binance: 20–125x).

✅ Practical Advice:

  • Start with 2–5x leverage.
  • Leverage magnifies both gains and losses — always pair with stop-loss and buffer mechanisms.

🛡️ liquidation_buffer — Liquidation Buffer

"liquidation_buffer": 0.05
Enter fullscreen mode Exit fullscreen mode
  • Only applies in futures mode.
  • Reduces the usable balance to prevent full allocation, avoiding inability to add margin — indirectly lowers liquidation risk.
  • Set to 5% → reserves 5% of account balance, limiting "available funds" for trading.

📌 Example:

Total Account liquidation_buffer Max Usable Funds
1000 USDT 0.05 (5%) 950 USDT
1000 USDT 0.2 (20%) 800 USDT

✅ Recommended Values:

  • Beginners: 0.05 ~ 0.1
  • High-leverage strategies: 0.2 or higher

✅ Recommended Configuration Combo

"trading_mode": "futures",
"margin_mode": "isolated",
"liquidation_buffer": 0.05
Enter fullscreen mode Exit fullscreen mode

📌 Add to strategy:

def leverage(self, pair, current_time, current_rate, current_profit, current_cost, **kwargs):
    return 3.0  # Set 3x leverage
Enter fullscreen mode Exit fullscreen mode

📊 Mode Comparison Summary

Setting Spot Mode Futures Mode
Short Selling ❌ Not supported ✅ Supported
Leverage ❌ Not supported ✅ Supported
Risk Management Needs Low High (stop-loss, position control, etc.)
Recommended Margin Mode - "isolated"
Leverage Logic Required? ❌ No ✅ Recommended (dynamic)
liquidation_buffer Supported? ❌ Ignored ✅ Strongly recommended

🔐 Live Trading Risk Control Tips

Control Item Recommended Practice
margin_mode Set to "isolated" to prevent cascade liquidations
leverage Start with 2–3x, validate via backtest/live comparison before increasing
liquidation_buffer Set 0.05–0.2 to avoid full exposure
Stop-Loss Use stoploss or custom_stoploss for forced exits
Position Limit Combine with max_open_trades to cap open positions

🧠 Summary Checklist

Parameter Description Recommended Value
trading_mode Sets trading mode (spot/futures) "spot" or "futures"
margin_mode Sets margin type (futures only) "isolated"
liquidation_buffer Reserves % of balance in futures 0.05 ~ 0.2
leverage() Strategy function to set leverage 2.0 ~ 5.0

Top comments (0)