Margin Model
Initial margin
Initial margin is the minimum amount required for executing a position
Buy option call/put :
Buy maintenance margin($)*(1+k) + open fees
Sell put option :
Max(a * spot price + mark price of the premium , a * Maintenance margin)
Sell call option :
a * Spot price + Mark Price of the premium
Maintenance margin
Maintenance margin is the minimum amount required to be maintained in the portfolio to keep the position opened
Buy option call/put :
Initial premium price($) + close fees (0 for liquidation calculation)
Sell put option :
Max(b * spot, b * Mark Price of the premium) + Mark Price of the premium
Sell call option:
b* Spot price + Mark Price of the premium
Where a and b are margin variables defined per asset :
$wETH
0.2
0.15
$wBTC
0.2
0.15
$wBERA
0.35
0.25
Open position margin checking
In order to open a position, we have to check and make sure that the current financial value of user portfolio is above or equal to the new position initial margin added, following the formula below:
a* token amount in portfolio * CF + max_pnl_factor* total unrealized Profit - total unrealized loss - debt - current position sell MM - current position buy MM - liquidation fee >= new position IM
Liquidation margin checking
In order to check if the user is liquidatable or not, the current account balance - losses - guaranteed maintenance margin should be always above 0 , which means he’s able to pay his full debt, so in order to define a user as not liquidatable he must maintain the formula below:
b*Token*CF + max_pnl_factor* total unrealized Profit - total unrealized loss - debt - current position sell MM - liq fees >= 0
Withdrawal margin checking
In order to allow user to get withdraw money from portfolio, we need to make sure that the new portfolio balances of his portfolio - the losses and the guaranteed margin is above 0 , or else we need to revert the transaction, so this formula must be always maintained :
c*new token dollar amount after withdraw*CF + max_pnl_factor* total unrealized Profit - total unrealized loss - debt - current position sell MM - current position buy MM - liquidation fee >= 0
a
1
b
1
c
0.85
pnl_factor
0.4
Last updated