Search
K

Multi-positions bankruptcy price calculation

bankruptcy Price:

The bankruptcy price of the
Ith  I^{\text {th}}\;
contract
(PiC)(P_i^C)
:
Pic=Pi[BI+k=1nSk(PkPko)]diriMiPik=1ndirkSkMkPk1diri FeeRate P_{i}^{c}=\frac{P_{i}-\left[B I+\sum_{k=1}^{n} S_{k} *\left(P_{k}-P_{k}^{o}\right)\right] * \frac{\operatorname{dir}_{i} * M_{i} * P_{i}}{\sum_{k=1}^{n} \operatorname{dir}_{k} * S_{k^{*} M_{k} * P_{k}}}}{1-\operatorname{dir}_{i} * \text { FeeRate }}

Variables:

  • BIBI
    : Static account equity
  • Pi:P_i:
    Current oracle price of the
    Ith  I^{\text {th}}\;
    contract
  • PiC:P_i^C:
    The bankruptcy price of the
    Ith  I^{\text {th}}\;
    contract
  • Pi0P_i^0
    : The opening price of the
    Ith  I^{\text {th}}\;
    contract
  • Si:S_i:
    The number of open positions of the
    Ith  I^{\text {th}}\;
    contract, positive for long positions and negative for short positions.
  • diri:dir_i:
    The opening direction of the
    Ith  I^{\text {th}}\;
    contract, +1 for long positions and -1 for short positions
  • Mi:M_i:
    Maintenance margin rate of the
    Ith  I^{\text {th}}\;
    contract

Example:

Initial account balance
BI=1000BI = 1000
USDC, Trading Fee = 0.3%
Contract Type
Open Positions
Opening Price
Current Price
Maintenance Margin
PNL
ETH
4
1100
1000
200(5%)
-400
BTC
2
2200
2000
400(10%)
-400
AVA
-3
2100
2000
300(5%)
300
ETH bankruptcy Price:
1000[1000+(400400+300)]0.051000200+400+30010.003=975.15\frac{1000-[1000+(-400-400+300) ] * \frac{0.05 * 1000}{200+400+300 }}{1-0.003}=975.15
BTC bankruptcy Price:
2000[1000+(400400+300)]0.12000200+400+30010.003=1894.57\frac{2000-[1000+(-400-400+300) ] * \frac{0.1 * 2000}{200+400+300 }}{1-0.003}=1894.57
AVA bankruptcy Price:
2000[1000+(400400+300)]10.052000200+400+3001+0.003=2049.40\frac{2000-[1000+(-400-400+300) ] * \frac{-1*0.05 *2000}{200+400+300 }}{1+0.003}=2049.40
ETH PNL:
(975.151100)4975.1540.003=511.1018(975.15-1100)*4-975.15*4*0.003=-511.1018
BTC PNL:
(1894.572200)21894.5720.003=622.23(1894.57-2200)*2-1894.57*2*0.003=-622.23
AVA PNL:
(2049.402100)32049.4030.003=133.354(2049.40-2100)*-3-2049.40*3*0.003=133.354