To ensure the stability of the perpetual contract market and reduce unnecessarily forced liquidations during market abnormal fluctuations, Coincall uses a Mark price to calculate users' Unrealized PnL as well as Maintenance Margin.
What is Mark Price
In traditional markets, a position is usually marked to the last trading price (i.e., mark to market), on which Unrealized PnL and liquidation triggering depend. However, unnecessary liquidation may occur if the market is being manipulated, is illiquid or the Mark Price swings significantly relative to its Index Price
Fair Price Marking only affects the liquidation price and unrealized PnL. Realized PnL is not affected.
When the index price behaves abnormally, the marking method will be changed temporarily which is similar to simple last trading price marking.
Mark Price Calculation for Perpetual Contracts
- Mark Price = Median (Fair Price, Moving Average Price, Latest Price)
- Fair Price = Spot Index Price × (1 + Current Funding Rate × (Time until Next Funding Rate Collection/8) ) Where time until next funding rate collection is in hours and minutes, for example, if there are 2 hours and 30 minutes remaining until the deadline, the value here is 2.5.
- Moving Average Price = Spot Index Price + EMA Spread EMA Spread = EMA (Latest Price - Spot Index Price)
- Latest Price = Median (Bid Price, Ask Price, Last Traded Price)
- Median refers to taking all values and sorting them in ascending order, then taking the middle value. For odd numbers of values, the median is the middle value; for even numbers of values, the median is the average of the two middle values (e.g., for 1, 2, 3, the median is 2; for 1, 2, 3, 4, the median is (2+3)/2).
- Spot Index Price is the average of the spot index prices of multiple mainstream exchanges. In addition, some additional protective measures will be taken to avoid data anomalies caused by interruptions in the spot market prices of a particular exchange or connection issues. These protective measures are as follows:
• Expiration time
a: The index prices from the source exchange may be lost or delayed due to various reasons. The expiration time is set to filter out expired index prices.
• Deviation ratio
b: The prices from the source exchange may deviate significantly from the actual market prices. The deviation ratio is set to filter out prices that are too far from the market prices.