Skip to main content
Paper perpetuals trade with leverage and can be liquidated, so a forward test shows what leverage does to a strategy, not only how its orders fill. You choose leverage per market, margin is held and locked at it, and an account that falls to maintenance margin has its positions closed through the live book. These rules apply on every paper host, and each host takes its values from its model host: which assets count as collateral, their weights and the leverage each market allows. A live host has its own rules; see From paper to live.

Collateral

Collateral is a single cross pool shared by every perpetual on the account, modelled on the model host’s account. The whole pool backs every position.
  • The model host decides what counts. The pool uses the model host’s main collateral assets and their weights, so both differ between paper hosts. A weight of 1 counts an asset at full value, and a lower weight discounts it. Any other asset adds nothing, so deposit one the model host accepts to trade its perpetuals. totalCollateralValue in List margin states shows what a deposit added.
  • One valuation asset. The pool is one margin group, valued in the valueAsset that List margin states reports. Each collateral asset is converted at a live reference price.
  • Equity is your free collateral at its weights, plus locked margin, plus all unrealised profit and loss at the mark price, gains included. It is reported as totalCollateralValue, and as collateral.total in Get market state.

Leverage

Leverage is a setting on a market for your account. Read it with Get leverage and change it with Set leverage:
The paper market’s settings.leverage gives the values it accepts, which are the model host’s. See Order rules.
  • Default. A market you have not set uses its min, normally 1×.
  • Changing it. The market must be flat: with a position or an open order there, Set leverage returns 422 Rejected. Setting the value already in force always succeeds. A change reaches that market only.
  • Trigger orders. A waiting trigger order does not block a change, and uses the leverage in force when it fires.
  • Position mode. Your leverage carries across a position mode change, and hedging legs both use it.
  • No leverage setting. A market whose settings.leverage is null trades at 1×, owes no maintenance margin and is never liquidated. Spot markets have no leverage.

Margin

A closing order needs no margin and is never refused for lack of funds. An order that reverses a netting position needs margin for its new side; if that cannot be covered, the whole order is rejected with 422 InsufficientFunds. Available collateral, which is what you can open with, is the weighted collateral not held or locked, less any negative balances at full value and the pool’s net unrealised loss. Gains offset losses across your positions but never add to what is available, so profit funds new positions only once it is realised. A position opened with everything available leaves nothing as soon as it starts to lose.

When liquidation starts

Maintenance margin is what an open position must keep: half the initial margin at the market’s maximum leverage. maintenance=value at mark×12×max leverage\text{maintenance} = \text{value at mark} \times \frac{1}{2 \times \text{max leverage}} Use settings.leverage.max from the market. On a market with a maximum of 100, maintenance is 0.5% of the position’s value. If the market’s maximum changes, so does the maintenance on your open positions. Liquidation starts when the pool’s equity falls to its total maintenance margin. That is when List margin states reports a maintenanceMarginUsage of 1.

Your leverage does not move the liquidation price

Maintenance does not depend on the leverage you chose, and the whole pool backs each position, so leverage changes what stays available for new orders, not where the position is closed. Take 1,000 USDT counted at full value and a long of 0.08 BTC at 50,000, worth 4,000, on a market with a maximum of 100, ignoring fees: Equity reaches maintenance when 1,000 + 0.08 × (mark − 50,000) = 0.08 × mark × 0.005. What moves the price is more collateral, a different position size, or profit and loss on your other positions. With collateral at a weight below 1, leverage can move it slightly, because locked margin counts in full and free collateral at its weight.
1× is not exempt. A short at 1× can be liquidated, because its loss has no limit.
Spot orders do not check your margin, so spending collateral on an asset the pool does not count lowers your equity and can bring on a liquidation.

What happens in a liquidation

1

Open orders are cancelled

Paper cancels your open perpetual orders, waiting trigger orders included. Spot orders stay. These read like any other cancelled order: the order has no field for why it was cancelled.
2

The largest position closes

Paper submits a reduce-only market order for the largest position by value, at up to the size the book is showing. It fills through the live book like any market order, one fill per price level at your taker rate, and posts the usual Settlement and TradingFee transactions. Any size left over waits for a later order.
3

Paper checks again

One liquidation order runs at a time. When it ends, paper values the account again, and stops once equity is back above maintenance. In a hedged market the larger leg closes first and the other can survive.
A liquidation order is an order you did not place. It appears in the order stream, order history and fills, with origin set to Liquidation and clientOrderId set to null, so check origin before treating an unknown order as a fault. You cannot cancel it: Cancel all skips it and a cancel has no effect. Re-placing your own closing orders does not hold it off. Paper does not liquidate on doubtful data. If a price the account depends on is out of date or cannot be read, it leaves the account alone and looks again, so a position can stay open past its liquidation price for a while. A market with nothing on the side of the book it would close against is skipped until it has.

Losses beyond the account

A liquidation closes at real book prices, so in a fast market a position can lose more than the account holds.
  • Written off. Once the pool has no open positions and is worth less than nothing with its collateral at full value, paper writes it off to zero with a positive Adjustment transaction, which has no instrument. This applies however the position closed, including by your own order. The account’s transactions still sum to its wallets.
  • Still owed. A negative balance your collateral can cover at full value stays owed, for example USDT owed with BTC still in the account. Deposit to clear it. Until then it counts against your available collateral at full value, though it never stops you closing a position.

Read it back

liquidationPrice is an estimate that holds everything else still. Paper reports null for a position that shares its base asset with another open position, hedged legs included, because their marks move together and no single price answers it. It also reports null when no price would liquidate the position. On an account already past maintenance, the price can sit on the profitable side of the mark until the position closes.

Next steps

Balances, positions and settings

Read margin groups and positions on any host.

Fees and funding

Follow what fees and funding do to your equity.

From paper to live

Where live margin and liquidation differ.