Portal pengembangan
Tema

Margin, Liquidation & Risk#

Position Modes (Oneway, Hedge)#

In one-way mode, the account holds a single position for each contract. An order in the opposite direction first reduces the existing position and can create a new position if the fill exceeds the amount being closed.

In hedge mode, long and short positions are maintained separately. Orders specify which side they open or close. If liquidation begins while both sides are open in the same contract, equal long and short quantities are offset at the mark price before further liquidation steps are evaluated.

Margin Modes (Cross, Isolated)#

Cross margin positions that use the same collateral currency share account equity and risk. Losses from one position can consume equity supporting other positions in the same margin scope.

Isolated margin assigns margin to a single position. Losses and liquidation are contained within that position's isolated margin balance. Some contracts may support isolated margin only.

Changing margin mode requires all relevant open orders, including take-profit and stop-loss orders, to be canceled and sufficient margin to be available. Unrealized profit cannot fund a new isolated position. In cross margin, both sides of the same contract use the same leverage; in hedge mode, both sides change margin mode together.

Leverage & Initial Margin#

Selected leverage determines position initial margin:

  • Position initial margin = Position size × Mark price ÷ Selected leverage
  • Order initial margin = Order size × Order price ÷ Selected leverage

Higher leverage reduces initial margin for the same position but also lowers the maximum position value allowed by the applicable tier rules. Leverage is selected in whole-number increments. The account must pass the latest margin and position-limit checks before leverage can be changed.

Position Tiers & Maintenance Margin#

Position tiers link position value to the initial margin ratio (IMR), maintenance margin ratio (MMR), permitted leverage, and position limit. Base ratios apply up to the base-tier limit; above it, the ratios increase continuously with position value.

  • IMR = Base IMR + max(0, (Position value − Base tier limit) ÷ 100,000 USD) × IMR change rate
  • MMR = Base MMR + max(0, (Position value − Base tier limit) ÷ 100,000 USD) × MMR change rate
  • Position value = Absolute position quantity × Mark price
  • Maintenance margin = Position value × MMR

The current MMR applies to the entire position value. Maximum position value and selected leverage are inversely related and remain capped by the contract's overall position limit. Open orders that can increase exposure are included in the limit check.

Existing positions retain their previous tier parameters until an action moves them to the latest tier. Opening or increasing a position, amending an order to increase exposure, or changing leverage applies the latest requirements. Reduce-only closes do not require migration.

Margin Checks#

For each side of a perpetual market, the initial margin requirement includes the open position and orders that can increase exposure. The required initial margin is the greater of the buy-side and sell-side totals after accounting for the existing position and open orders.

Unrealized profit contributes to account equity but is not withdrawable and cannot fund a new isolated position. Equity occupied by initial margin cannot be transferred. Cross margin aggregates maintenance requirements by margin currency, while isolated margin evaluates each position independently.

Maintenance margin ratio = (Maintenance margin required for your positions + Liquidation trading fee) ÷ Relevant equity × 100%

Liquidation#

Liquidation is triggered when the maintenance margin ratio reaches or exceeds 100%, or when the relevant equity falls below zero. The mark price is used for the risk calculation and trigger check. The displayed estimated liquidation price is a reference only and does not itself trigger liquidation.

Cross margin is assessed separately for each margin currency, so liquidation can affect multiple positions sharing that currency. Isolated margin is assessed per position using its isolated margin balance plus unrealized PnL.

If you hold both long and short positions in the same contract in hedge mode, the system first offsets equal quantities at the mark price until the smaller side is fully closed. If the maintenance margin ratio falls below 100%, liquidation stops. If liquidation is still needed, it attempts partial liquidation based on position tiers and prioritizes more liquid contracts.

If partial liquidation cannot restore the configured recovery target, all positions in the affected margin scope may be closed. On the third and subsequent position-reduction trigger within a 10-second window, all positions in that margin scope are closed; a temporary recovery within the window does not reset the count.

Taken-over positions use the mark price read at takeover. The account is charged the liquidation trading fee (calculated using the applicable taker fee rate) for the taken-over quantity and the full maintenance margin associated with it. Initial long-short netting does not incur this trading fee.

If relevant equity is insufficient, the system covers the shortfall and records the liquidation compensation in your on-chain account cash flow.

Regular open orders are not canceled automatically during liquidation. When one later fills, the system recalculates the maintenance margin ratio and may trigger liquidation again.

ADL#

Auto-deleveraging (ADL) is the final risk-control process used when normal liquidation and the applicable security fund cannot fully absorb a loss. It matches the liquidated position directly with positions on the opposite side instead of relying on the market order book.

User-level ADL can run before takeover when a liquidated position cannot be safely absorbed even after supplementary funds are considered. Security-fund-level ADL can run after takeover if a security fund's equity falls below a certain required threshold.

For cross margin with negative account equity, ADL first applies to contracts the security fund cannot take over and can then extend to remaining positions. For isolated margin, it applies to the affected position only.

All opposing positions are ranked by leveraged PnL ratio, with more profitable and more highly leveraged positions ranked first in the ADL queue.

User-level ADL uses the previous oracle mark price, security-fund-level ADL uses the current oracle mark price, and ADL position netting uses the current oracle mark price. Both sides are reduced or closed at the same execution price. Security funds are ranked in the counterparty queue.

Insurance Fund#

Onchain separates liquidation reserves into three components:

  • Security fund: The active liquidation account for one or more mapped perpetual contracts. It takes over liquidated positions, places orders to reduce them, and absorbs liquidation losses.
  • Security vault: The main reserve used for manually controlled rebalancing across security funds.
  • Supplementary fund: An automatic backstop. If a security fund's projected equity would fall below zero after takeover, it can transfer the exact shortfall required to return projected equity to zero.

Before takeover, the system checks every affected security fund. A fund with non-negative projected equity can accept the position.

If a shortfall exists and the supplementary fund can cover it, the fund is topped up before takeover. If the shortfall cannot be covered, takeover does not proceed at that stage and ADL may be used.

The security vault supports planned rebalancing and does not provide automatic per-liquidation top-ups.