Multi-positions bankruptcy price calculation
bankruptcy Price:
The bankruptcy price of the Ithcontract(PiCā):
Picā=1ādiriāāĀ FeeRateĀ Piāā[BI+āk=1nāSkāā(PkāāPkoā)]āāk=1nādirkāāSkāMkāāPkāādiriāāMiāāPiāāā Variables:
BI: Static account equity
Piā:Current oracle price of the Ithcontract
PiCā:The bankruptcy price of the Ithcontract
Pi0ā: The opening price of the Ithcontract
Siā:The number of open positions of the Ithcontract, positive for long positions and negative for short positions.
diriā:The opening direction of the Ithcontract, +1 for long positions and -1 for short positions
Miā:Maintenance margin rate of the Ithcontract
Example:
Initial account balance BI=1000USDC, Trading Fee = 0.3%
Contract Type
Open Positions
Opening Price
Current Price
Maintenance Margin
PNL
ETH bankruptcy Price:
1ā0.0031000ā[1000+(ā400ā400+300)]ā200+400+3000.05ā1000āā=975.15 BTC bankruptcy Price:
1ā0.0032000ā[1000+(ā400ā400+300)]ā200+400+3000.1ā2000āā=1894.57 AVA bankruptcy Price:
1+0.0032000ā[1000+(ā400ā400+300)]ā200+400+300ā1ā0.05ā2000āā=2049.40 ETH PNL: (975.15ā1100)ā4ā975.15ā4ā0.003=ā511.1018
BTC PNL: (1894.57ā2200)ā2ā1894.57ā2ā0.003=ā622.23
AVA PNL: (2049.40ā2100)āā3ā2049.40ā3ā0.003=133.354