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:
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.
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 is 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 the further calculations. This is because if you can borrow quote currency at one rate and then lend the base currency at the 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.06% 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 (lower) the premium, the bigger (smaller) the funding rate will be.
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.
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 whole 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.
The funding fee is exchanged directly between longs and shorts, and bitmex.com doesn’t charge any fees on these payments.