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.
Perpetual vs dated futures
| Contract | Expiry | Key quirk |
|---|---|---|
| Perpetual swap | None | Funding rate keeps price near spot |
| Dated future | Fixed date | Converges 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.
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.
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
- Low leverage — 2–5x for most strategies; high leverage is for liquidation, not profit.
- Stop on every trade — a bracket that closes before liquidation can.
- 1% rule — size so any single trade risks ≤1% of the account (use the calculator).
- Drawdown kill switch — flatten and halt if equity drops past a hard limit.
- Backtest the signal first on the backtester before adding leverage.
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.