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