What Happens 5 Minutes Before and After Funding Time on Bitmex?
Some basics concepts about Bitmex’s funding
If you ever traded XBTUSD swaps (perpetual contracts) on BitMEX, you should* already be aware that every 8 hours, a funding fee is exchanged between longs and shorts. Who pays who basically depends on the market’s expectations. In few words:
- If the funding fee is >0: longs pay shorts because there is bullish sentiment
- If the funding fee is <0: shorts pay longs because there is bearish sentiment
The peculiarity of this sort of contracts is that if you are not holding the position during the precise moment the funding is being exchanged (which is every 8 hours), you don’t get paid/charged at all.
It is worth mentioning that the funding fee (both, amount and sign) is known by everyone 8 hours in advance of the moment that it is actually cleared.
All this means that, technically, if you are in a position in which the funding fee is coming against you (meaning you will be paying the fee and not receiving it) you could get out of the position one second before the funding time and re-enter the position one second after, and you won’t be charged at all.
The other face of this is: if you aren’t in any position, you could enter a position on the favored side one second before the funding, hold it during the settlement, collect the fee and get out of the position one second later. The result is that you would be technically collecting a secured fee with only two seconds of exposure.
Having in mind that Bitmex offers a 100X leverage and the maker fee is +0,075% (taker is -0,025%), several strategies look, at first glance, worthy to study.
In its simplest form, a strategy could be:
- If funding fee is greater than zero: enter a short XBTUSD position right before funding, collect the fee and get out of the position right after.
- If funding fee is less than zero: enter a long XBTUSD position right before funding, collect the fee and get out of the position right after.
And the news is…?
Alright, so… until this point, I am not bringing anything new to the table. Everything expressed above has already been said many times before by smarter people than me.
Now, the issue is in the word that precedes all those affirmations: “technically”. If you have an idea of how Bitmex works, you might already have some hesitations about how “real” this proposed strategy is.
First of all, to consider exploring a consistent funding-fee strategy you will need using algo-trading. There is no space for manual trading in this sort of strategies. It would mean too match time in front of your laptop in a 24/7 market. So, you better know how to code.
That said, it is still not easy to anticipate if it makes sense to spend time working in a strategy based on exploiting the funding fee. The reason why it is FFtough to have a gut feeling about it is that it is hard to weight all the involved factors. So… here are the main influences that affect this strategy:
- Order book and slippage. In most cases this is not an issue in Bitmex.
- Commissions. As we said before, the maker fee is +0,075% and the taker is -0,025%.
- How frequent the funding fee has a good-enough-value in order to make the strategy profitable. Not easy to see at first glance, you need to compute the stats. I will bring some help on this below.
- Withdraw time window issue. Because of safety reasons, Bitmex only allows you to withdraw your bitcoins once a day (13:00 UTC). As Bitmex does not offer USD holdings, the only way to stay USD neutral is by hedging your position. The combination of these two things means that is likely that you will be forced to hold a defensive position to wait for the withdraw time. Hence, you will be exposed to funding fees even if you don’t want to. This is a significant issue during high volatility times. When there is a clear trend, if you play it safe, the risk is limited.
- XBTUSD swap contract price fluctuation in the proximities of the funding time. It is reasonable to expect that many traders are trying to profit from the funding fee. So, as we all know, if that is the case, the potential profit will be eroded by affecting the price in the opposite direction of the one we desire. This is the trickiest point to analyze and where I’ll try to bring some light. I won’t solve all your problems related to this issue, but at least I will try to relieve some pain.
Here we go
Using the data provided by the Bitmex’s API, I computed some charts that will help us understand better what is going on. Let’s start by seeing how frequent Bitmex offers an attractive-enough funding fee.
The chart below shows what percentage of times a fee bigger than a certain value was offered during each year.
For example, of the total 1095 times that a funding fee is exchanged on average during a year, a value bigger than 0.3% (equivalent to 328.5% per annum) was offered about 10% of the times during 2017, almost 0% during 2018 and 0% during 2019.
Also, a value between 0.1% (equivalent to 109.5% per annum) and 0.3% was offered about 15% of the times during 2017, 5% during 2018 and 0% during 2019. You can do the math for all the other values and ranges of fees using this chart.
Let’s continue by analyzing how the price fluctuates in the proximities of the moment when the funding fee is exchanged. In order to do so we will start with the following boxplot chart, where we have aggregated the analysis for price values corresponding to 2017, 2018 and 2019.
The Y-axis represents the percentage difference between the XBTUSD price at minute ’n’ and the price at the funding moment. This is:
The X-axis represents the time in minutes counting from the moment of funding. Then 1 means one minute after funding, -3 is three minutes before funding and 0 is the moment of funding.
Each value of the chart is a measure of the % difference of XBTUSD prices for a given minute during 2017, 2018 or 2019. Every funding fee exchanged during that period is plotted in the chart.
The red boxplot shows for each minute the median and where the 50% of the values fall. Assuming a normal distribution, the whiskers show where 99,3% of the total values fall. Finally, each black spot represents an outlier value.
In the chart, we can see that the dispersion is pretty low. We can also appreciate that as the distance from the funding moment increases, the dispersion also increases.
We can try a little variation of this chart, using different colors for each data point depending of the funding fee value that was operating at each moment.
Instead of using boxplot we can use error bars to represent one standard deviation (68% of the data falls within) and whiskers for two SD (95%).
The black dots represent the mean and not the median as in the previous chart. The conclusion is similar to the one we got before, but we could also add that as the funding fee increases, the variation of the price after the funding becomes more positive. Also, as the funding fee becomes negative, the variation of the price also becomes more negative.
We can better see this if we create a histogram showing the distribution of the price variation for the first minute after funding.
We now clearly see how the funding fee affects the price variation. For example, for a funding fee bigger than 0.3%, the price variation would have a mean of 0.2%. So, if you placed a short position to collect a 0.3% funding fee and you closed that position one minute after the funding moment, you would be making a net 0.1%, instead of the total 0.3%. And this not taking fees into account.
If we wanted to see the whole movie, we could plot smooth lines with the mean of the price variation for each funding fee range.
Although the chart is not perfect (all the lines should cross 0 in minute 0), it provides a very practical understanding of the importance of timing the exit of this strategy. The conclusion is that after the first minute, the price variation would basically liquidate any income made from the funding fee collection.
Finally, another important point to consider is how the gap between XBTUSD price and XBT-index (basically the price of Bitcoin) behaves during the funding moment. This will impact the profitability of arbitrage strategies to cover XBTUSD swaps with the underlaying asset (BTC).
In the following chart, the Y-axis is presenting:
Again, I am plotting smooth lines with the mean for each funding fee range. This help us see how the funding fee affects the behavior of the XBTUSD price in the surroundings of the funding instant.
Then now you know… if you are going to mess with the funding fee, take a close look to all these charts and try to anticipate if it make sense at all spending the time.
I don't say there is no opportunity to profit, but let's recognize that it doesn't happen every day and not everybody can take advantage of it.
Well…my friend I hope that I have been of some help. Let me know your thoughts and questions!!!