What is a perpetual swap? Crypto perpetual futures, explained

The perpetual swap — the “perp” — is the most-traded instrument in all of crypto, and the one that liquidates more retail bots than any other. It behaves like a futures contract but never expires, letting you hold a leveraged long or short indefinitely. That convenience hides three mechanisms every bot must respect: the funding rate that tethers it to spot, the mark price that triggers liquidation, and leverage that amplifies both your gains and your path to a zeroed account. This guide explains exactly how a perpetual swap works and why it demands more caution than spot.

On this page
  1. What a perpetual swap is
  2. Perp vs traditional future
  3. Funding and mark price
  4. Liquidation risk
  5. Trading a perp in code
  6. What bots must respect
  7. FAQ

What a perpetual swap is

A perpetual swap is a derivative that tracks the price of an underlying asset and lets you take a leveraged long or short position — but unlike a dated future, it has no expiry. You can hold it for minutes or months. It is the dominant way leverage is traded in crypto, available on Binance, Bybit, OKX, Bitget and more.

Perpetual vs traditional future

A traditional future has a settlement date when it converges to spot. A perpetual has none, so it needs another way to stay near spot — the funding rate. That single difference is what makes a perp “perpetual” and introduces a recurring cost the dated future does not have.

spot future: expires perp: never expires, funding tethers
A dated future converges to spot at expiry; a perpetual is held open indefinitely and kept near spot by funding.

Funding and mark price

Two mechanisms keep a perp honest. Funding transfers payments between longs and shorts to pull the contract price toward spot. The mark price — an index of spot across exchanges, not the perp’s own last trade — is what the exchange uses to value your position and decide liquidation, so a brief wick on one venue cannot unfairly liquidate you.

Liquidation risk

Leverage sets your liquidation distance

Your liquidation price is how far the mark price can move against you before your margin is exhausted. At 10× leverage a roughly 10% adverse move wipes the position; at 20×, about 5%. Crypto routinely produces such moves in minutes. A bot that sizes by leverage instead of by a real risk budget is one wick away from a zeroed position.

Trading a perpetual in code

python · perp.pyimport ccxt
ex = ccxt.binanceusdm({'apiKey': KEY, 'secret': SECRET})
ex.set_leverage(3, 'BTC/USDT:USDT')   # low leverage

# open a small long; ALWAYS attach a stop
ex.create_market_buy_order('BTC/USDT:USDT', 0.001)
pos = ex.fetch_positions(['BTC/USDT:USDT'])
print(pos[0]['liquidationPrice'])

What bots must respect

Three rules: subtract funding from expected returns, size from a hard stop and risk budget rather than max leverage, and treat the liquidation price as a wall to stay far from, not a stop-loss. Most retail “bot blew up” stories are perpetuals run at high leverage with none of these respected. Learn on spot first; backtest perp logic on the backtester with funding modelled in.

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 perpetual swap?

A perpetual swap is a crypto derivative that tracks an underlying asset and lets you hold a leveraged long or short position with no expiry date. It behaves like a futures contract but can be held indefinitely. It is the dominant leveraged instrument in crypto, kept near the spot price by a funding rate and valued using a mark price.

What is the difference between a perpetual and a normal future?

A normal future has a settlement date when its price converges to spot, while a perpetual never expires. To stay near spot without settlement, a perpetual uses a funding rate — periodic payments between longs and shorts. That recurring funding cost is the key trade-off a dated future does not have, and the reason perps can be held open forever.

Why do perpetual swaps get liquidated so often?

Because of leverage. Your liquidation price is how far the mark price can move against you before margin is exhausted — roughly 10% at 10x leverage and 5% at 20x. Crypto routinely makes such moves in minutes. Bots that size positions by maximum leverage instead of by a real risk budget sit one sharp wick away from liquidation.

Are perpetual swaps good for trading bots?

They can be, but only with discipline. A bot must subtract funding from expected returns, size positions from a hard stop and risk budget rather than max leverage, and keep the liquidation price far away. Most blow-up stories are high-leverage perps with none of these respected. Beginners should master spot first and model funding in every backtest.

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.