Replies: 1 comment
-
revisiting this again, some notes: considering adding an asset group specific 'e-mode' that a user sets on their account.
during margin check add if statement checks if the user has emode activated then can override the spot market asset/liability weights. might as well have the validate for switching on/off emode in there too. this way, users explicitly set the group and the group cannot be mixed. adding validation/invariants checks ensure and overriding weights to less strict ones doesnt impact the margin system logic too much |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
rules-based
as of now, protocol-v2 operates with rules-based margining. sum of weighted asset - weighted liabilities.
∑(w_i * a_i) - ∑(w_i * l_i)
this takes no account of offset correlated or even asset/liabilities that share the same oracle price. for instance, depositing SOL and shorting SOL-PERP has same margin constraints as depositing SOL and shorting BTC-PERP, despite lower risk.
for instance in above, settling negative PnL leads to a USDC borrow. A USDC borrow has a liability of weight of 1 while the sol asset weight is .9. So every
$1
increase in the oracle price of SOL, the account would lose0.9 * $1 - 1.0 * $1 = $.10
in free collateral.risk-based
risk-based, or portfolio margining, extends more margin/capital efficiency based on the risk ever the entire portfolio. Examples of risk-based margining implementations already exist in CeFi, such as @okex [1], and even in DeFi, such as @aave "high efficiency mode" or E-mode [2][3].
proposal
i propose the margin calculation discounts liabilities when they are offset by assets with the same oracle price as a simple 'risk-based' measure.
[1] https://www.okx.com/support/hc/en-us/articles/4411686631309-V-Portfolio-Margin-mode-cross-margin-trading.
[2] https://docs.aave.com/faq/aave-v3-features#high-efficiency-mode-e-mode.
[3] https://governance.aave.com/t/gauntlet-aave-v3-e-mode-methodology/12278.
Beta Was this translation helpful? Give feedback.
All reactions