Margin
The Margin system on Aftermath Perpetuals ensures the solvency of the protocol and governs the collateral requirements for opening and maintaining positions.
Margin is the collateral deposited by a trader to cover their positions and potential losses. On Aftermath, margin is used to back your leverage. If the value of your account falls below the required margin level, your positions may be subject to Liquidations.
Margin Ratio Formula
The Margin Ratio is the primary metric for account health. It is calculated as the ratio of your Account Value (Equity) to your Position Exposure (adjusted by MaxNetBase).
Understanding MaxNetBase
The exposure of a position is determined by MaxNetBase.
πππ₯πππ‘π΅ππ π(π) is motivated as follows: Instead of taking |π΅ππ ππ΄πππ’ππ‘(π) + ππππππππ΅πππ (π) β ππππππππ΄π ππ (π)| , we take the max above, since otherwise a user could place equivalent bids and asks without raising its leverage, thus artificially deepening the order book.
Initial and Maintenance Margin Ratio (IMR/MMR)
The IMR (Initial Margin Ratio) and MMR (Maintenance Margin Ratio) are fundamental risk parameters set at market creation. They represent the inverse of leverage:
IMR (Initial): Determines the maximum leverage for opening a position.
Example: An IMR of 0.1 allows a maximum leverage of 10x ($1 / 0.1$).
MMR (Maintenance): Determines the liquidation threshold.
Example: An MMR of 0.05 means a position will be liquidated once its effective leverage reaches 20x ($1 / 0.05$).
Governance
The owner of the AdminCapability may change these parameters to adapt to market conditions. However, for user safety:
The smart contract stores the new values on-chain first.
The update is time-delayed; it only takes effect after a sufficient waiting period (a few days), ensuring users have time to adjust their positions.
Position Margin Requirements
The absolute margin required for a specific position is calculated as:
Solvency Check
To verify that a position is solvent (i.e., the margin ratio is healthy), the protocol checks that the Margin Ratio is greater than the IMR. This is mathematically equivalent to checking if your Equity covers the Requirement:
To get the Maintenance Margin Requirements of a position, simply replace πΌππ with πππ .
Last updated