Thanh lý
Liquidation
Tổng Quan
Thanh lý là quá trình hệ thống quản lý rủi ro tự động giảm hoặc đóng vị thế khi ký quỹ của tài khoản giảm xuống dưới mức yêu cầu duy trì. Backpack sử dụng cơ chế thanh lý nhiều tầng nhằm:
Giảm thiểu tổn thất cho người dùng thông qua cơ chế giảm vị thế dần dần
Ưu tiên khớp lệnh trên orderbook khi có thể
Ngăn ngừa rủi ro hệ thống thông qua cơ chế backstop
Đảm bảo khả năng thanh toán của nền tảng trong điều kiện thị trường cực đoan
Tài sản, vị thế và ký quỹ được định giá theo mark price để tránh thao túng giá thông qua last-trade price. Thanh lý có thể được thực hiện trên orderbook hoặc thông qua các cơ chế waterfall khác.
Điều Kiện Kích Hoạt Thanh Lý
Khi Nào Thanh Lý Xảy Ra?
Thanh lý bắt đầu khi Maintenance Margin Ratio (MMR) đạt 100%.
MMR = Account MMF / Account Margin FractionTrong đó:
Account Margin Fraction = Net Equity / Total Exposure Notional
Account MMF = Σ(Notional Position Size × Position MMF) / Total Exposure Notional
Điều Gì Xảy Ra Khi Bị Kích Hoạt?
Khi MMR đạt 100%, hệ thống sẽ:
Huỷ toàn bộ lệnh đang mở — giải phóng margin bị khoá
Hoàn trả khoản vay và đóng vị thế song song
Giá Thanh Lý Ước Tính vs Thực Tế
Giá thanh lý hiển thị trên giao diện chỉ mang tính tham khảo, giả định:
Không thay đổi các vị thế khác
Không thay đổi tài sản thế chấp
Không có funding hoặc lãi phát sinh
Mark price của tài sản khác không thay đổi
Thanh lý thực tế xảy ra khi MMR ≥ 100%, dựa trên toàn bộ trạng thái sub-account.
Với tài khoản có nhiều vị thế, tài sản thế chấp không phải USD hoặc có khoản vay đang hoạt động, hệ thống có thể không hiển thị chính xác giá thanh lý ước tính.
Cơ Chế Liquidation Waterfall
Backpack sử dụng cơ chế 3 tầng. Mỗi tầng chỉ kích hoạt nếu tầng trước đó không thể khôi phục margin.
Price Display Note: Backstop and ADL transactions are executed off-book (outside the public orderbook). As a result, these execution prices are not reflected in K-line charts.
Stage 1: Orderbook Liquidation
Trigger: MMR ≥ 100%
Mechanism:
Liquidation engine places reduce-only market orders on the public orderbook
Orders execute against resting liquidity at prevailing market prices
Liquidation runs in a loop (1 second per tick, 50% probability each tick), reducing 10% of the position per iteration, capped by liquidation capacity
Process continues until MMR < 100%
Protections:
Price bands prevent execution at manipulated prices
Gradual reduction minimizes market impact
Liquidations are visible on the public orderbook and trade feed
Partial Liquidation: The system liquidates only the minimum amount necessary to restore margin health. This means:
You may retain a reduced position after liquidation
Remaining equity stays in your account
If price continues moving against you, additional liquidations may occur
Stage 2: Backstop Liquidity Providers (BLPs)
Trigger: Account Margin Fraction falls below Auto-Close Margin Fraction (ACMF)
Auto-Close Margin Fraction Calculation:
The ACMF is always less than the MMF, creating a buffer zone between maintenance margin breach and BLP handoff.
Mechanism:
Remaining position is transferred to Backstop Liquidity Providers
A portion of remaining account equity is paid to the backstop liquidity fund
BLPs assume management of the position
Account margin is zeroed (account remains active for trading) or reduced to safe margin levels
BLP Requirements:
Minimum balance requirements on platform
Commitment to absorb specified liquidation volumes
May be required to meet market making standards
Stage 3: Auto-Deleveraging (ADL)
See Auto-Deleveraging (ADL) section for complete details.
Liquidation Fees
Rate: 1% per fill
Scope:
System-triggered perpetual futures liquidations
System-triggered borrow/spot-margin liquidations
Calculation:
Fee is applied to the filled notional amount of each liquidation order
Deducted from liquidation proceeds (not charged separately)
Exclusions:
User-initiated position closes (regular trading fees apply)
Manual repayment of borrows
Liquidation Process by Product
Perpetual Futures Liquidation
Open orders cancelled
Available balance used to repay borrows
Collateral sold to cover remaining borrow liability
Position reduced via orderbook
If ACMF breached → BLP takeover
If BLP capacity exceeded → ADL
Settlement: Liquidation proceeds settle in USDC. PnL (positive or negative) is realized immediately.
Spot Margin Liquidation
Open orders cancelled
Available balance used to repay borrows
Collateral sold to cover remaining borrow liability
If collateral insufficient → additional asset liquidation
Settlement: Borrowed assets are repaid to the lending pool. Remaining collateral (if any) stays in account.
Borrow Position Liquidation
When a borrow position specifically triggers liquidation:
System sells collateral to repay borrow
Liquidation fee applied to sold amount
Remaining collateral returned to account
100% Utilization Scenario: If the lending pool is fully utilized and collateral cannot be redeemed, ADL mechanisms activate.
Auto-Deleveraging (ADL)
Overview
Auto-Deleveraging is an emergency mechanism that activates when standard liquidation processes cannot complete. ADL ensures:
Lenders receive the value of their lent assets
The platform remains solvent
Losses do not socialize beyond direct counterparties
ADL is a last resort used only when:
Prices move faster than liquidation can execute
Orderbook liquidity is insufficient
BLP capacity is exceeded
Market utilization prevents lend redemption
Price Display Note: ADL transactions are executed directly in the backend, bypassing the public orderbook. These execution prices are not reflected in K-line charts.
ADL for Futures Positions
Trigger Conditions: Account margin fraction falls below ACMF AND no BLP capacity available
This typically occurs when:
Liquidating account's position cannot be closed via orderbook
BLP capacity is insufficient
Remaining equity cannot cover losses at available prices
Counterparty Selection:
ADL does not randomly select counterparties. The system ranks traders with opposing positions by their ADL Priority Score:
Traders with the highest combination of:
Profit on the position (higher unrealized PnL = higher priority)
Leverage on the position (higher leverage = higher priority)
…are selected first for ADL.
No Account Restrictions: ADL has no account or user restrictions. After all priority scoring (first and second pass), there is a complete matching of longs and shorts regardless of account.
Lower priority: Basis trades and delta-neutral positions are deprioritized and will only be ADL'd when other positions are insufficient.
Execution Process:
System identifies the liquidating position's size and direction
Counterparties are ranked by ADL Priority
Highest-priority counterparty's position is partially closed
Close price = bankruptcy price of the liquidated account
Process repeats until liquidating position is fully absorbed
Example:
Notification:
ADL fills appear in your fill history with origin
ADL_AUTOCLOSEWebSocket order updates include
O: "ADL_AUTOCLOSE"
ADL for Borrow/Lend Positions
ADL in the borrow/lend system protects lenders when borrowers default or when market conditions prevent normal liquidation.
Scenario 1: Borrower Default
When a borrower's account goes bankrupt without holding the borrowed asset:
Example:
Key Principle: The primary mandate is ensuring the Lender receives the value of their lent assets—either in the original token or in notional USD terms at liquidation time.
Scenario 2: 100% Utilization
When lending pool utilization reaches 100%, lent assets cannot be redeemed. If a lender with lent collateral faces liquidation:
Process:
Lender has positions backed by lent collateral
Lender's positions move against them → liquidation triggers
Liquidation engine attempts to redeem lent assets
Pool at 100% utilization → redemption blocked
ADL activates
ADL Resolution:
System identifies borrowers with available collateral
Notional USDC (≤ original lend value) transfers: Borrower → Lender
Lender's loan position closes
Lender now has USDC to cover liquidation
Borrower's loan is closed; collateral may have converted
Borrower Impact:
Borrower's loan is forcibly closed
Borrower's collateral may convert to a different asset
Borrower's total account value remains unchanged
No loss to borrower—only asset composition changes
Liquidation in the API
Fill Types
The /fills endpoint returns all fills including system orders. Use the fillType parameter to filter:
User
Regular user orders only
BookLiquidation
Orderbook liquidation fills
Adl
Auto-deleveraging fills
Backstop
Backstop Liquidity Provider fills
Liquidation
All liquidation types
AllLiquidation
All liquidation types combined
CollateralConversion
Collateral conversion to settle debt
Order Update Stream Origins
WebSocket account.orderUpdate stream includes an O field indicating the origin:
USER
User-initiated order
LIQUIDATION_AUTOCLOSE
Liquidation engine closed position
ADL_AUTOCLOSE
Auto-deleveraging event
COLLATERAL_CONVERSION
Collateral conversion to settle debt
SETTLEMENT_AUTOCLOSE
Settlement of dated market position
BACKSTOP_LIQUIDITY_PROVIDER
BLP facilitated the liquidation
Querying Liquidation Price
Query estimated liquidation price via REST:
Returns estLiquidationPrice for the specified position.
Note: The l field in the position update WebSocket stream is deprecated and returns 0. Use the REST endpoint for liquidation price queries.
Settlement History
Query settlement operations including liquidations:
Filter by source:
BackstopLiquidationTradingFeesSystemRealizePnl
Viewing Liquidation History
In the UI
Futures Liquidations:
Navigate to: Portfolio → Futures → Liquidations
Borrow/Lend Liquidations:
Navigate to: Portfolio → Lending → Liquidations
Via API
Use the fill history endpoint with fillType filter:
Last updated
