**Bitmex funding explained**

As of today, Bitmex perpetual inverse futures contract, also known as the perpetual swap, is the most liquid market for the BTC/USD pair. If you haven’t heard about it, I suggest you start here: What is bitmex.com perpetual swap contract?

If you’re new to inverse futures, you should also read these articles first:

## Funding as an incentive mechanism

Simply put, a perpetual contract is a futures contract which never expires and never settles. Naturally, those familiar with a futures trading will ask how is this possible, since the settlement is the reason futures price converges towards the spot price over time, and if there’s no settlement, there’s, technically, no reason for the futures price to move towards the spot price.

A funding mechanism is what used instead of the settlement to tether the perpetual contract price to the spot price. You can think of funding as a tool which incentivises traders to open and close positions in the direction (long or short) that will converge the futures to the index.

Every 8 hours, all traders who have open positions in the perpetual swap pair, will either receive or pay a funding fee. Whether you have to pay or receive a funding fee, depends whether you are long or short. Positive funding fee would mean that the contract is trading at a premium (or small enough discount), and those who are long will have to pay to their contract counterparties with the short positions. Negative funding fee would indicate that the contract is trading at a discount and those who are short will have to pay to those who are long at the opposite side of the futures.

Since funding is only paid if there’s an open position, a trader who doesn’t want to incur a fee, or wants to receive a payment, would have to close or open a position in the direction against the premium or discount (short the premium and long discount), pushing the contract price towards the index price. This mechanism emulates the exchange of the interest between longs and shorts in a margin spot market and was explained more in detail here.

Funding allows the perpetual contract to trade almost at the same price as the spot market, unlike the standard futures where the price may deviate significantly due to the basis.

## Calculations of the funding rate

The main component affecting the funding rate is the premium/discount index, which can be seen here: .XBTUSDPI.

Bitmex.com calculates this index every minute with the following formula:

Premium Index (P) = (Max(0, Impact Bid Price – Mark Price) – Max(0, Mark Price – Impact Ask Price)) / Spot Price + Fair Basis used in Mark Price

The formula might seem a bit daunting, but don’t let that intimidate you. The net result of these calculations is the percentage by which the futures contract deviates from the index/spot price. For example, if you see -0.09%, it means that the actual spread between bids and asks is 0.09% below the index/spot price, hence the contract is traded at a discount. If you see a positive percentage, it will mean the contract is trading at a premium (bid/ask spread above the index/spot).

Note: in the final calculations, the 8-hour average of all premium one-minute snapshots is taken as a premium index value.

Since bitmex.com perpetual contract is replicating spot margin trading, where traders borrow and lend currencies, it also has to take into account the interest rates of the quote and base currencies. Luckily, these rates set as constants, and equal to 0.03% for BTC and 0.06% for USD daily. The difference between the USD rate and the BTC rate is used in further calculations. This is because if you can borrow quote currency at one rate and then lend the base currency at a different rate, your effective borrowing rate will equal to the difference between quote and base. More on this logic is explained in this article if you want to dig deeper: How interest rates affect bitcoin futures price

So, in our case, the interest rate used in the funding formula will be 0.06% – 0.03% = 0.03% and then divided by three since 0.03% is the daily rate and there are three funding periods in the 24 hours.

Interest Rate (I) = (Interest Quote – Interest Base ) / 3

The final formula for calculation of the funding rate looks like this:

Funding Rate (F) = Premium Index (P) + clamp(Interest Rate (I) – Premium Index (P), 0.05%, -0.05%)

The premium index here is the primary variable affecting the change in the funding rate; it is then adjusted by the difference between interest and the premium itself. The clamp function keeps this difference in the -0.05%/+0.05% range.

Such formula composition puts certain boundaries on the funding rate; precisely, if the index premium is within the range of -0.04% and +0.06%, the funding rate will always equal 0.01%. That is why you can see this number of 0.01% appearing so often in the funding history tab at bitmex.com. Outside the mentioned range, the higher the premium, the bigger the funding rate will be. When the premium goes lower than -0.05%, the funding rate goes into the negative territory.

After the calculation of the final funding rate, the number is applied to a trader’s position. For example, if the funding rate is 0.01% (or 0.0001 in decimal) and you have a long position with the notional value of 50 BTC, you will pay 50*0.0001 = 0.005 BTC, and the counterparty holding a short position on the other side of the contract will receive this amount, without any extra fees applied.

## The significance of the funding rate

Such a number might not seem like a lot, but since funding happens every eight hours, it adds up to a significant amount over time. Also note, that if you have a leveraged position, the funding rate is applied to the total notional value, so if you’re using high leverage (which most of bitmex.com traders do), the funding fee will have a much more significant impact on your equity. High leverage is often used, to take advantage of the funding, as traders open leveraged positions before the funding timestamp, to receive a fee on the whole amount of their position, even if their equity is much smaller.

## Conclusion

The funding mechanism is intended to replicate the exchange of interest between longs and shorts in the spot market with margin trading. Premium, or discount, at which contract is traded compared to the index price is the main component of the funding rate calculations. The higher the premium, the more longs will have to pay shorts in the form of funding fee, and vice versa. The funding incentivises traders to open/close positions in the direction which will converge contract price towards the index: short premium and long discount. The funding fee is exchanged directly between traders, and bitmex.com doesn’t charge any fees on these payments.

Thanks, great explanation…

Excellent funding information. Very clear and concise. Keep up the great work!

Thanks for another great post. One question for clarification: If the Premium would be -0.05, shouldn’t the Funding Rate be 0 rather than 0.01 as in your table?

Hi. I’m not sure, I did these calculations almost a year ago, maybe something changed in bitmex funding calculations? i belive when I did this, funding was always 0.01 if the premium was within +/- 0.06.

I might have made small mistake somewhere, are you getting the same numbers? http://prntscr.com/o14s2l

Update: so i did some recalculations and now I get the numbers that the funding is always 0.01% if the premium index is within -0.04% and +0.06%. When the premium (discount) reaches -0.05%, the funding will be equal to zero.

Did you get the same numbers? I’ll have to update the article.

Thank you for the input, very valuable.

I updated the article with numbers which I belive are correct. thanks.