All formulas used are shown below:
Orders/Positions
Margin/Leverage
 Where pMM = position Margin Multiplier and mAp = maximum Absolute position
 The position Margin Multiplier is 0.000001% for BTCPERP.
 The Minimal Initial Margin Percentage is 1% for BTCPERP.
 The Minimal maintenance Margin Percentage is 0.5% for BTCPERP.
You can check the initial margin percentage, maintenance margin percentage and position margin mulitplier for all instruments here.
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 for the BTCUSD pair are:
 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.