Examining the Accuracy of Mark Price Data on BitMEX Futures
The Importance of Mark Price
For those who trade Bitcoin futures, the mark price is absolutely critical.
Mark price is what determines the risk management of your position by the exchange. Meaning that when you get liquidated due to a price going against you, it is because the Mark Price has crossed the threshold for margin call.
Defining Mark Price
But what exactly makes up the mark price? On OKCoin, this is done via “mark to market”, i.e., the last price traded is what traders’ P&L and liquidation risk are marked to.
On BitMEX, they have a reasonably complex (not mathematically, but in how many components it has) formula, which they post publicly here
It uses a combination of BTC/USD Spot Index (which they calculate as 50% BitStamp, 50% GDAX) and the depth of orderbook (i.e., liquidity on the exchange).
In technical terms, they compute this with an “Impact Mid Price” which computes the average between Impact Bid and Impact Ask prices. These are derived from computing the average fill price of 10 BTC order value in either direction. (This 10 BTC value is only for XBT series contracts, which I will be focusing on).
Then, this “Impact Mid” price premium versus the index is computed and discounted by the time out to expiry.
Script to check BitMEX mark price calculations
I have written a Python script that performs these calculations manually based on the orderbook data from BitMEX and bitstamp/gdax API’s.
Example of discrepency
Let’s look at an example of a discrepency in BitMEX’s reported data for these.
Here you can see a side by side comparison of orderbook and the script output:
The main cause of the Mark price being skewed seems to be from the Fair Basis not being computed properly.
The impact bid, ask, and mid are more or less in line (although they should be exactly equal). However, the Fair Basis Rate, which is used to compute the Fair Value (or Fairbasis as it is calledi n the API), is skewed.
The difference is not trivial either. Impact Mid computes fine, but the Fair basis Rate they report is 0.11, while the computed is 0.07. This is a significant deviation that pushes the fair basis higher and which inflates the level of the Mark Price, making shorts closer to liquidation than they would have otherwise been.
It’s worth noting that BitMEX does not publish any historical data for Mark price. They do provide Index, but this is only one variable in a multi-variate formula for reaching the Mark Price, which is most important.
Initially, I thought this discrepency would be due to Hidden Orders (h/t to Mayvune for the idea), but BitMEX has said that hidden orders are not included:
You can manually calculate from the visible orderbook screenshotted above and see that the Fair Basis was definitely not in line with the computation from the documented formula and the correct impact mid price.
Perhaps it is just a matter of timing? BitMEX says it is updated every 5 seconds, so maybe that doesn’t seem plausible either.
Has anyone else noticed discrepencies in BitMEX’s Mark Price data? Are there any other traders who have made an effort to verify the integrity of the components of the mark price?
Please, feel free to use the Python script above, do whatever you want with it, and see what data you come up with.
It is critical that we as traders have accurate transparent information. When trading high leverage derivatives, every tick counts on the mark price, and a small deviation can be the difference between catching a knife successfully and getting liquidated.
The BitMEX guys have done an excellent job developing a great platform with a risk management system that has successfully handled remarkable volatility. This post is not meant to be an attack on them, I think their exchange is one of the top in the space.