#
Instant Liquidation Checks
#
Overview
Instant Liquidation Checks prevent orders that would breach maintenance margin immediately upon execution, even after passing initial margin requirements. This mechanism protects against overleveraged accounts and preventable insurance fund losses.
#
Implementation Details
#
Check Timing
Incoming Orders
- Performed immediately after initial margin validation passes
- Blocks order entry if check fails
Resting Orders
- Re-evaluated on every mark price update for the instrument
- May cancel previously valid orders if market conditions change
#
Core Logic
The check validates that an order would not breach maintenance margin at any point during execution, accounting for immediate mark-to-market revaluation.
Trigger Conditions:
- Mark price exists outside the best bid/offer (BBO)
- Orders "overshoot" the mark:
- Buy orders:
order_price > mark_price
- Sell orders:
order_price < mark_price
- Buy orders:
Execution Flow:
- Order executes at BBO price
- Position immediately revalued at mark price
- Adverse mark creates instant unrealized loss
- Maintenance margin check performed on post-execution state
#
Technical Specifications
#
Position-Closing Orders
- Subject to instant liquidation checks even when reducing risk
- May be rejected if realized losses at execution price would breach maintenance margin
- Mark level does not cause maintenance margin liquidation, but position closure at BBO may realize losses and cause liquidation
#
Fee Handling
- All fees included in instant liquidation calculations
- Fees compound the immediate loss effect from mark-to-market revaluation
#
Multi-Position Scenarios
- Orders that both close and open positions evaluated at each execution stage
- Unrealized profits from newly opened positions cannot offset losses from closed positions
- Account must maintain maintenance margin requirements throughout entire execution sequence
#
Cross-Instrument Considerations
- Unrealized positive PnL on other instruments excluded from calculations
- Each instrument evaluated independently
- Resting orders with potential losses reduce available maintenance margin
#
Error Handling
Rejection Code: CausesImmediateLiquidation
Response Requirements:
- Clear error message indicating instant liquidation risk
- No partial execution permitted
- Order fully rejected
#
Integration Considerations
#
Engine Behavior
- Check runs after initial margin validation
- Uses current mark price and order book state
- Accounts for all resting orders' impact on available margin
#
API Reference
The instant liquidation check integrates with existing margin validation systems. No additional API endpoints are required, and rejection occurs through standard order rejection flow with specific error code.