Margin
The Margin system on Aftermath Perpetuals ensures the solvency of the protocol and governs the collateral requirements for opening and maintaining positions.
Last updated
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.
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).
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.
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$).
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.
The absolute margin required for a specific position is calculated as:
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