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:
- Bitfinex
- Binance
- Huobi
- OKEx
- Bittrex
- HitBTC
There are additional protections to avoid poor market performance during outages of Spot Exchanges or during connectivity problems. These protections are listed below:
- Single price source deviation: When the latest price of a certain exchange deviates more than 5% from the median price of all price sources, the exchange weight will be set to zero for weighting purposes.
- Multi price source deviation: If more than 1 exchange shows greater than 5% deviation, the median price of all price sources will be used as the index value instead of the weighted average.
- Exchange Connectivity Problem: If we can’t access the data feed for exchange and this exchange has trades updated in the last 10 seconds, we can take price data from the last result and use it for index calculation.
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 = Spot Index Price + Moving Average (1-minute Basis) Moving Average (1-minute Basis) = Sum of [(bid1_i + ask1_i) / 2 - PL_i] / 60
Explanation: Calculate the average of the bid price (bid1) and the ask price (ask1), subtract the index price (PL), and then compute the average of this value over the past minute (calculated once every second starting from the 0th second of each minute, totaling 60 data points within a minute, 1 <= i <= 60).
As an example:
- Funding Rate = 0.04%
- Time until funding = 5
- Index Price = 12,000
Basis=Funding Rate×(Time Until Funding/8)=0.04%×5/8=0.025%
Mark Price=Index Price×(1+Basis)=12,000×(1+0.025%)=12003
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):
Net Negative Position: UnrealizedPnL= (Entry Price−MarkPrice)×Position
Net Positive Position: UnrealizedPnL=(MarkPrice−InitialBuyPrice)×Position
Total Collateral for Margin and Liquidation purposes: Collateral=InitialCollateral+RealizedPnL+UnrealizedPnL
The maximum amount of collateral can be withdrawn from the account so long as collateral > (initial margin + borrowed amount) .
LBank Community
For any assistance, please contact us at our official email service@lbank.com. We are dedicated to providing quality, professional and prompt support.
Disclaimer: Digital assets are subject to high market risks and price volatility. The value of your investments may fluctuate, and could even lead to a loss of principal. You are solely responsible for your investment decisions, and LBank is not liable for any losses you may incur. You should invest only in products you are familiar with and understand the risks involved. You should carefully consider your investment experience, financial status, investment objectives, and risk tolerance, and consult an independent financial advisor before any investment. Past performance is not a reliable indicator of future performance. Content on the LBank platform does not include advice or recommendations, and should not be construed as financial advice.
LBank reserves the right in its sole discretion to amend or cancel this announcement at any time and for any reasons without prior notice.
Comments
0 comments
Article is closed for comments.