All formulas used are shown below:
Orders/Positions
Balances
Margin/Leverage
 Where pMM = position Margin Multiplier and mAp = maximum Absolute position
 The position Margin Multiplier is 0.000001% for BTCPERP.
You can check the initial margin percentage, maintenance margin percentage and position margin mulitplier for all instruments here. (E.g., The minimal initial Margin Percentage for BTCPERP is 1%, the minimal maintenance margin percentage for BTCPERP is 0.5%).
Index
 Mark Price = Index Price

The index for the bitcoin perpetual is calculated as follows:

The best five ask and bid levels are taken from constituent exchanges that have had data available for the last 30 seconds.

Microprice is calculated for all bid and ask pairs across exchanges (shown below). For example if there are five exchanges, that will gives us 25 bids and 25 asks that form 625 pairs.
 The median of microprices is then used in the calculation.

 The exchanges used to calculate the index price for trading instruments are shown by the table below:
 Any exchange’s API which has not been online for more than 30 seconds is excluded from the calculations.
 The order book values are combined together into an index price using a modified Hodges–Lehmann estimator.
Fees
 Passive orders (liquidity providers) do not incur any trading fees (since maker fee is 0.00%).
 Aggressive orders (liquidity takers) are charged 0.05% of the value of the transaction.
For instance, if you open a position of 10,000 BTCPERP contracts with a fill price of $10,000, the position value would be approximately 1 BTC. Therefore, if you use a market order or a nonrested limit order, you would end up paying approximately 0.05% of 1 BTC in trading fees (= (1*0.0005) = 0.0005 BTC).