Futures trading bot: leverage, funding and surviving liquidation

Futures bots trade leveraged contracts — perpetuals on crypto exchanges, or dated contracts on regulated venues. Leverage is the appeal and the danger: it multiplies returns and introduces liquidation, a risk spot bots never face. Add funding rates that quietly tax perpetual positions and you have a strategy that rewards precision and punishes carelessness. This guide covers how futures bots execute, the funding and liquidation mechanics, and the risk rules that keep a leveraged bot alive.

On this page
  1. Perpetual vs dated
  2. Funding rates
  3. Liquidation math
  4. Setup with ccxt
  5. Risk rules
  6. Getting started
  7. FAQ

Perpetual vs dated futures

ContractExpiryKey quirk
Perpetual swapNoneFunding rate keeps price near spot
Dated futureFixed dateConverges to spot at expiry; basis matters

Crypto bots overwhelmingly trade perpetuals (perps) because they never expire and track spot closely. The catch is funding.

Funding rates — the silent tax

On a perpetual, longs and shorts periodically pay each other a funding rate to keep the contract pinned to spot. If you're long during positive funding, you pay every interval just to hold. A bot that ignores funding can profit on price and still lose on the carry.

Account for funding

A slow perpetual position can bleed funding even when the trade is right. Check the funding rate before holding, and factor it into your edge math alongside fees.

The liquidation math

Your liquidation price is where margin is exhausted and the exchange force-closes you. Higher leverage moves it closer to entry — at 25x a 4% adverse move can wipe the position.

5x entry liq (far) 25x entry liq (close!)
Leverage shrinks the distance to liquidation. Disciplined futures bots use low leverage and always carry a stop.

Setup with ccxt

python · futures.pyimport ccxt
ex = ccxt.bybit({'apiKey': KEY, 'secret': SECRET,
    'options': {'defaultType': 'swap'}})
ex.set_sandbox_mode(True)
ex.set_leverage(3, 'ETH/USDT:USDT')   # conservative
if signal() == 'buy':
    ex.create_market_buy_order('ETH/USDT:USDT', 0.1,
        params={'stopLoss': {'triggerPrice': stop_px}})

The risk rules that keep you alive

  1. Low leverage — 2–5x for most strategies; high leverage is for liquidation, not profit.
  2. Stop on every trade — a bracket that closes before liquidation can.
  3. 1% rule — size so any single trade risks ≤1% of the account (use the calculator).
  4. Drawdown kill switch — flatten and halt if equity drops past a hard limit.
  5. Backtest the signal first on the backtester before adding leverage.
Not financial advice. This content is educational. Automated and algorithmic trading carries a real risk of financial loss. Never trade money you cannot afford to lose. Review the SEC investor.gov and CFTC resources before trading.

Frequently asked questions

What is a futures trading bot?

A futures trading bot automates a strategy on leveraged contracts — usually crypto perpetual swaps, or dated futures on regulated venues. Leverage amplifies returns and introduces liquidation risk that spot bots don't have.

How do funding rates affect a futures bot?

On perpetuals, longs and shorts periodically pay each other a funding rate to keep the price near spot. Holding a position during adverse funding costs money every interval, so a bot must factor funding into its edge, not just price.

How do I stop a futures bot from getting liquidated?

Use low leverage (2–5x), attach a stop-loss to every position, size so each trade risks ≤1% of the account, and keep the liquidation price well outside normal volatility. Test on a testnet until the bot survives volatile sessions.

Are futures trading bots more dangerous than spot bots?

Yes. Leverage magnifies losses and adds liquidation risk, and funding rates add a carry cost. The same signal that's mildly unprofitable on spot can blow up an account on leveraged futures. Respect leverage and always use stops.

MB

Mustafa Bilgic

Algorithmic trading practitioner · Founder, AITradingBot.us

Mustafa builds and backtests automated trading systems and writes about them without the hype. Every tool on this site is free and runs entirely in your browser.