The calculation of Mark Price is intricately linked to the Funding Rate and vice versa. It is highly recommended to read both sections to get a full picture of how the system works.
As Unrealized PnL is the primary driver of liquidations, and as the Perpetual Contract allows for highly leveraged (up to 125x) positions, it is important to ensure that the Unrealized PnL calculation is accurate to avoid unnecessary liquidations. The underlying contract for the Perpetual Contract is the ‘true’ value of the Contract, and an average of the prices on the major markets constitutes the “Index Price” which is the primary component of Mark Price.
The Index Price is a bucket of prices from the major Spot Market Exchanges, weighted by their relative volume. The Exchanges used are:
There are additional protections to avoid poor market performance during outages of Spot Exchanges or during connectivity problems. These protections are listed below:
If one exchange has no updates for 10 seconds, the weight of this exchange will be zero when calculating the weighted average.
Now that we’ve computed the Index Price, which can be considered as the “Spot Price”, we can move forward in calculating the Mark Price which is used for all Unrealized PnL calculations. Note that Realized PnL is still based on the actual executed market prices.
As introduced in the last section, Funding occurs every 8 hours. Funding Rate is calculated at that time, and the Funding Rate in the formula is the most recent prior Funding Rate.
Basis=FundingRate×(Time Until Funding /8)
Mark Price=Index Price∗(1+Basis)
As an example:
- Funding Rate = 0.03%
- Time until funding = 4
- Index Price = 10,000
Basis=Funding Rate×(Time Until Funding/8)=0.03%×4/8=0.015%
Mark Price=Index Price×(1+Basis)=10,000×(1+0.015%)=10001.5
Please be noted that the formula above is only applicable to BTC/USDT and ETH/USDT perpetual futures contracts.
The mark price calculation for other perpetual futures contracts is as follows:
Mark price = Median (Price 1, Price 2, Contract Price)
Price 1 = Index Price * (1 + Last Funding Rate * (Time Until Funding / 8))
Price 2 = Index Price + Moving Average (30-minute Basis)*
*Moving Average (30-minute Basis) = Moving Average ((Bid1+Ask1)/2- Index Price), which measures every minute in 30-minute interval
Mark Price is a better estimate of the ‘true’ value of the contract, compared to Perpetual Futures prices which can be more volatile in the short term. We use this price to prevent unnecessary liquidations for traders and to discourage any market manipulations by poor actors.
Unrealized PnL is thus calculated as (all values in USDT):
The maximum amount of collateral can be withdrawn from the account so long as collateral > (initial margin + borrowed amount) .