Margin
Margin Ratio Formula
where
Initial and Maintenance Margin Ratio (IMR/MMR)
The IMR and MMR are set at market creation. These are the inverse of leverage, e.g., an IMR of 0.1 equals a maximum leverage of 10x and an MMR of 0.05 means a position can get liquidated once its leverage reaches 20x.
The owner of the AdminCapability
may change these parameters, but the smart contract first stores the new values, so they are visible on-chain, and only updates the actual market parameters after sufficient time has passed (a few days).
Position Margin Requirements
To check that the position's margin ratio is above the market's IMR:
{\small
\begin{align}
MarginRatio(p) &> IMR
\\
&\equiv
\\
\frac{
Coll(p) \cdot CollPrice + UF(p) + Pnl(p)\
}{
MaxNetBase(p) \cdot BasePrice
} &>
\frac{
MaxNetBase(p) \cdot BasePrice \cdot IMR\
}{
MaxNetBase(p) \cdot BasePrice
}
\\
&\equiv
\\
\underbrace{
Coll(p) \cdot CollPrice + UF(p) + Pnl(p)
}_{\text{margin}(p)}
&>
\underbrace{
MaxNetBase(p) \cdot BasePrice \cdot IMR
}_{\text{margin_requirements}(p)}
\end{align}
}%
To get the Maintenance Margin Requirements of a position, simply replace 𝐼𝑀𝑅 with 𝑀𝑀𝑅 .
Last updated