ClearingHouse
. The ClearingHouse
is the authoritative source for all account management, position tracking, and risk calculations. Every action that affects a user’s position or risk profile must pass through it.
ClearingHouse
simulates the impact of the order on the user’s account to verify that sufficient Initial Margin is available. This proactive check is a crucial feature that ensures system solvency by preventing users from opening positions they cannot collateralize.report_trade
function within the ClearingHouse
. This function updates the core parameters for both the maker and taker positions involved in the trade, including:
ClearingHouse
constantly receives updated Mark Prices from the MarkPriceCalculator
. This ensures that all margin calculations are based on the most current and fair valuation of the contract.LiquidationEngine
takes control. Its first and most critical action is to send a CancelAllOrders
command to every matching engine where the user has open orders. This immediately neutralizes the risk of the user increasing their position size during a liquidation event. Following the cancellation, the engine submits reduce-only
market orders to the order book to systematically close the distressed position.