Ethereal Docs
  • Introduction
    • What is Ethereal?
  • Public Testnet
  • Trading
    • Perpetual Futures
      • Margining
      • Order Types
      • Positions
      • Funding Rates
      • Market Specifications
      • Liquidations
      • Auto Deleveraging
      • Subaccounts
      • Price Oracles
  • Points
    • Staking sENA
    • Season Zero
  • developer-guides
    • Trading API
      • Quick Start
      • Message Signing
      • Accounts & Signers
      • Order Placement
      • System Limits
      • Products
      • Token Transfers
      • Supported Tokens
      • Websocket Gateway
    • Python SDK
  • Protocol Reference
    • API Hosts
    • Contracts
    • Audits
Powered by GitBook
On this page
  • Insurance Fund & Liquidator Account
  • Margin Requirements
  • Onchain Verification
  1. Trading
  2. Perpetual Futures

Liquidations

Liquidations are automatically triggered when a trader's margin falls below the cumulative maintenance margin requirement across all open positions. This can occur due to mark price updates or funding charges that reduce the account's available margin below the cross-margin threshold.

When a liquidation is triggered, the matching engine performs a complete account takeover, transferring all positions to the liquidator at the bankruptcy price. The liquidator then unwinds these transferred positions over time. This mechanism protects both individual traders and the broader system from cascading insolvency risk.

Insurance Fund & Liquidator Account

The insurance fund is a capital reserve that absorbs any loss that remains after a liquidation. The liquidator account is the insurance-fund account itself. All liquidated positions are transferred here and unwound asynchronously. Profits stay in the fund and losses are covered by it.

Core Concepts

  • Initial margin – the minimum collateral required to open a position.

  • Maintenance margin – the minimum equity required to keep positions open.

  • Liquidation price – the mark price from Pyth Lazer that triggers liquidation.

  • Bankruptcy price cap – the mark price at which an account’s equity would be exactly zero.

Liquidation Triggers

The matching engine reevaluates every account at each MarkPriceUpdate (once per second) and at every FundingCharge event. If equity falls below maintenance margin the account is flagged.

First Bankruptcy Price

At every oracle update the engine finds the first price at which any account’s equity would hit zero. That price becomes a cap for valuation. If Pyth later prints a deeper price, the cap is used instead, preventing negative equity and limiting damage from stale or bad data.

Liquidation Process

  1. Cancel all open orders on the flagged account.

  2. Full-account takeover – Ethereal does not use partial liquidations.

  3. Transfer every position to the liquidator account at the bankruptcy price.

  4. Set the trader’s margin balance to zero and record the action onchain.

  5. The liquidator places reduce-only orders to unwind the positions.

    • Surplus PnL is added to the insurance fund.

    • Deficit PnL is covered by the fund.

Liquidations initiated by a funding charge are possible but rare because funding runs hourly and accounts must already be close to maintenance margin.

Margin Requirements

initial_margin=1max_leverage\text{initial\_margin} = \frac{1}{\text{max\_leverage}}initial_margin=max_leverage1​
maintenance_margin=12×max_leverage\text{maintenance\_margin} = \frac{1}{2 \times \text{max\_leverage}}maintenance_margin=2×max_leverage1​

With the default 50× leverage, initial margin is 2 percent and maintenance margin is 1 percent.

Liquidation-Price Calculation

Account equity equals required margin at liquidation.

Long Position

liquidation_price=entry_price×size−balance(1−maintenance_margin)×size\text{liquidation\_price} = \frac{\text{entry\_price} \times \text{size} - \text{balance}}{(1 - \text{maintenance\_margin}) \times \text{size}}liquidation_price=(1−maintenance_margin)×sizeentry_price×size−balance​

Example – balance 10k USD, long 1 BTC at entry 83k, maintenance 1% Liquidation price = (83000 - 10000) / 0.99 = 73737

Short Position

liquidation_price=entry_price×size_abs+balance(1+maintenance_margin)×size_abs\text{liquidation\_price} = \frac{\text{entry\_price} \times \text{size\_abs} + \text{balance}}{(1 + \text{maintenance\_margin}) \times \text{size\_abs}}liquidation_price=(1+maintenance_margin)×size_absentry_price×size_abs+balance​

Example – balance 10k, short 1 BTC at entry 65, maintenance 1% Liquidation price = (65000 + 10000) / 1.01 = 74257

balance is continuously adjusted for fees, funding and unrealised PnL.

Onchain Verification

A LiquidateSubaccount action is submitted to the ExchangeGateway. Smart contracts:

  1. Check that the mark price is recent (not older than the staleness tolerance).

  2. Confirm positions and sizes match the engine output.

  3. Recompute equity with the verified oracle price and ensure it is below maintenance margin.

If any check fails the transaction reverts and the liquidation is cancelled.

PreviousMarket SpecificationsNextAuto Deleveraging

Last updated 3 days ago