Clearinghouse
Avitus Clearinghouse: The Backbone of the Protocol
Last updated
Avitus Clearinghouse: The Backbone of the Protocol
Last updated
The Avitus Clearinghouse is the central component of the AvitusV1 protocol, orchestrating the management of user balances, positions, and risk across the entire ecosystem. As the foundation of the perpetual trading platform, it ensures robust position tracking, accurate profit and loss (PnL) calculations, and seamless integration with other key modules.
What is the Clearinghouse?
A Clearinghouse acts as the operational heart of a perpetual trading system. It performs critical functions such as:
Margin Management:
Tracks and enforces margin requirements to ensure the security of positions and the overall system.
Supports both Cross-Margin and Isolated Margin modes to accommodate different trading strategies.
Position and Balance Tracking:
Manages user positions, ensuring real-time updates to balances and PnL as market conditions evolve.
Handles the lifecycle of trades from opening to closing and liquidation.
PnL and Liquidation Monitoring:
Continuously calculates profit and loss using mark-to-market settlement, where positions are valued based on real-time market prices.
Automates liquidation processes for positions that fall below the required Minimum Margin Ratio (MMR).
Flexibility in Trading Modes:
Supports One-Way positions, where a trader holds a single net position in a market.
Enables Hedged positions, allowing simultaneous long and short positions in the same market.
By combining precision, transparency, and scalability, the Clearinghouse ensures the smooth functioning of the AvitusV1 ecosystem.
The Clearinghouse offers two distinct modes for margin allocation, catering to diverse trading preferences:
Cross-Margin Mode:
All deposited collateral is pooled into a unified margin balance.
This balance supports multiple open positions, enabling traders to efficiently use their capital.
A loss in one position can be offset by the margin available from other positions, reducing liquidation risks.
Ideal for traders managing multiple positions and wanting to maximize their available capital.
Isolated Margin Mode:
Allocates a specific amount of margin to an individual position.
Margin for each position is independent, meaning losses in one position do not affect the margin of other positions.
While this mode limits risk to a specific position, it requires careful margin allocation by the trader.
Best suited for traders looking to manage individual positions with precision or hedge specific trades.
The Clearinghouse supports both One-Way and Hedged modes, giving traders flexibility in how they manage their market exposure:
One-Way Mode:
A single net position is maintained per market, simplifying trading and position tracking.
For example, if a trader opens a long position in BTC/USD and later adds a short position in the same pair, the two are netted into one position (either long or short, depending on the size of each).
Best for traders who prefer straightforward directional trading.
Hedged Mode:
Allows traders to open and manage both long and short positions in the same market simultaneously.
Each position is tracked independently, enabling strategies like arbitrage or market-neutral trading.
Useful for advanced traders who need fine-grained control over their positions.
At the core of the Clearinghouse is the Active Contract Array (ACA), a sophisticated system that acts as the Position Manager for all trades. The ACA ensures dynamic, real-time management of positions, collateral, and leverage, providing traders with the tools to operate effectively in any market condition.
Key Functions of the ACA:
Position Tracking and Management:
The ACA maintains a structured record of all active contracts for each trader.
Associates each position with its collateral, leverage, and market data, ensuring every trade is accurately monitored.
Mark-to-Market Settlement:
Implements a mark-to-market approach for PnL calculations:
Unrealized PnL: Continuously updated based on live market prices.
Realized PnL: Calculated when positions are closed.
Ensures traders always have up-to-date information about their financial standing.
Margin and Risk Management:
Enforces a Minimum Margin Ratio (MMR) of 2.5%, striking a balance between high leverage (up to 100x) and system safety.
Monitors margin health for all positions and triggers liquidation and auto deleveraging processes when required.
Leverage Handling and Collateral Management:
Dynamically adjusts positions based on user-selected leverage levels and collateral provided.
The ACA is deeply integrated with other components of the AvitusV1 protocol to provide a seamless trading experience:
Subaccount Manager:
Manages deposits and withdrawals, passing user balances to the Clearinghouse for margin allocation.
Ensures gasless transactions for traders.
Execute Engine:
Executes trades and updates the ACA with real-time position changes.
Manages closing trades and transfers PnL outcomes back to the user account.