1. Initial Margin

Written by the Phezzan team
User can open a perpetuals position if there is enough initial margin on balance.
IMp = position_size * index_price * IMr
IMp: initial margin of a position
position_size: the size of position
index_price: index price of market
IMr: initial margin ratio of market
Currently, Phezzan uses the price provided by Chainlink as index price. Initial margin ratio is 10% (i.e. 10x max leverage), for all markets. Phezzan team might adjust initial margin ratio and index price provider in the future.
For example, if a user wants to open a position with 10 Luna, and Luna's price is $90 as provided by Chainlink, then initial margin of that position is:
Initial margin of a position = (position size) * (index price of market) * (initial margin ratio of market) = 10 * $90 * 10% = $90
Phezzan Protocol uses cross margin, so all positions in the same account share a common margin.
IMa = Σ{IMp}
IMa: initial margin of an account
IMp: initial margin of all positions in that account
Σ{IMp}: means summing over initial margin of all positions in that account
For example, if a user aleady has a position of 2 ETH, with ETH index price being $2800, and another position of 10 Luna, with Luna index price being $90. Then the initial margin of that account is:
2 * $2800 * 10% + 10 * $90 * 10% = $650
A user can only open a new position if account balance is larger than the initial margin requirement of the account.
account_balance = collateral_value + Σ(value_of_position)
account_balance: account balance
collateral_value: value of all collateral
value_of_position: value of existing position
Σ(value_of_position): means summing over the value of all existing positions.
Again, when opening a new position, it is always required that: Account balance >= Initial margin of the account
If you try to enter a position not meeting that requirement, you will get an "insufficient margin ratio" error message on Phezzan website