Funding Calculation
 Hướng dẫn CoinM Vĩnh cửu
Perpetual swaps have no expiry or delivery, and require a "Funding Mechanism" to anchor the contract price to the spot price.
Perpetual Swap is a period every 8 hours and is settled at the end of each period. That is, 00: 008: 00 is a period and the settlement time is 800; 8: 0016: 00 is a period and the settlement time is 16:00; 16: 0000:00 (+1 day) is a period. The settlement time is 00:00. The above time is GMT + 8 time.
Only users who hold positions at the funding timestamps will receive or pay funding; if the position has been closed before settlement, users won’t receive or pay funding.
At the funding timestamps, whether a user should receive or pay funding is determined by the funding rate of current period and the position situation of the user. If the funding rate is positive, then long positions will pay and short positions will receive the funding, and vice versa if the rate is negative.
Funding is payment exchanged between users. HTX perpetual swaps do not charge any funding.
Funding Calculation
The funding that the user will receive or pay is calculated as follows:
Funding = Net Position * Contract Face Value / Settlement Price * Funding Rate；
Among them, the net position = the quantity of long positions (conts) – the quantity of short positions (conts).
When the funding rate is greater than 0, users with a net position greater than 0 need to pay funds, and users with a net position less than 0 will receive funds; when the funding rate is less than 0, users with a net position greater than 0 will receive funds, and users with a net position less than 0 have to pay funds.
Funding Rate Calculation
Funding rate aims to ensure that the transaction price of Perpetual Swap closely follows the underlying reference price.The funding cost is based on the realtime funding rate for the current settlement period. For example, every day at 16:00 (UTC+8), we calculate the realtime funding rate for funding costs using the average premium index from 8:00 AM to 4:00 PM (UTC+8) on the same day. Please note that the funding rate may fluctuate until the funding cost payment time, and you can flexibly manage your positions based on the actual situation.
Funding rate is composed of two parts: comprehensive interest rate and premium.
 comprehensive interest rate component：
Each contract traded on HTX is comprised of two currencies: the underlying currency and the denominated currency. For example: for BTC (perpetual) contract, the underlying currency is BTC, and the denominated currency is USD.
Underlying currency interest rate: The daily lending rate of the underlying currency on the market. Just like the underlying currency of the BTC perpetual contract is BTC, the lending rate of the underlying currency is the daily lending rate of BTC.
Denominated currency interest rate: The daily lending rate of denomination currency in the market. For example, the denomination currency of the BTC perpetual contract is USD, and the denomination currency interest rate is the daily lending rate of USD.
Comprehensive interest rate = (denominated currency interest rate – underlying currency interest rate) / (24 hours / settlement cycle)
Currently, the denominated currency interest rate of all perpetual contracts is 0.06% and underlying currency interest rate is 0.03%, and the settlement cycle is 8 hours (3 times per day). Therefore, the current comprehensive interest rate of all perpetual swap is 0.01%.
 Premium component：
Perpetual Swap may have a premium or discount relative to its fair price. We use the premium index to measure the premium level of the contract and add it to the calculation of the funding rate. The higher the level of premium, the greater the funding rate, and the more motivation the shorts have to go short; the lower the level of the premium, the smaller the funding rate, and the more motivation the longs have to go long. By raising or lowering the funding rate, the contract price will be returned to a relatively reasonable level.
a. Funding rate basis rate
Funding rate basis rate reflects the basis difference generated by the capital expense in the current period.
Funding rate basis rate = current funding rate * (current time interval from the current settlement period / settlement cycle)
If the current BTC perpetual swap funding rate is 0.01%, the current time is 12:00, and the current settlement time is 16:00, that is, 4 hours before the settlement, and the settlement cycle is 8 hours (settle every 8 hours), then the current funding rate basis rate = 0.01% * ( 4 / 8 ) = 0.005%.
b. Fair price
The fair price is a relatively reasonable reference price for the perpetual swap calculated based on the current spot index price and the current funding rate basis rate.
Fair price = index price * (1 + funding rate basis rate)
For example, if the current BTC index price is 10,000 USD and the BTC perpetual swap funding rate basis rate is 0.005%, then the current BTC perpetual swap fair price = 10000 * ( 1 + 0.005% ) = 10000.5 USD.
c. Depthweighted bid / ask prices
The depthweighted bid price refers to the average bid pending order price of N contracts from the first bid of the current order, based on the current pending order situation.
The depthweighted ask price refers to the average ask pending order price of N contracts from the first ask of the current order, based on the current pending order situation.
Among them, the value range of N is 80 for BTC perpetual swap and 800 for contracts of other currencies.
d. Premium index
The premium index reflects the current premium situation caused by the combination of funding rate basis rate and the deviation of the depth buy/sell price from the fair price.
Premium Index = [Max(0, Weighted Buy Price  Index Price)  Max(0, Index Price  Weighted Sell Price)] / Index Price；
The premium index is calculated every 5 seconds, resulting in 12 premium indices per minute. With a settlement occurring every 8 hours, there will be a total of 5760 premium indices.
e. Average premium index
The average premium index (P) is calculated as (1 * Premium Index_1 + 2 * Premium Index_2 + 3 * Premium Index_3 +···+ n * Premium Index_n) / (1 + 2 + 3 +···+ n)
where Premium Index 1: The first premium index
n = 60/5 * 60 * 8 = 5,760 (assuming the funding rate interval is 8 hours).
Funding Rate Of Next Period, which is determined by the comprehensive interest rate and average premium index, is as follows:
Funding Rate Of Next Period = clamp (average premium index + clamp (comprehensive interest rate – average premium index, premium deviating from upper limit, premium deviating from lower limit), upper limit of funding rate, lower limit of funding rate)
Among them, clamp is an intervallimited function. When the target value exceeds the upper and lower limits, only the boundary value is taken. For example, clamp (a, max, min), the result is max when a > max; the result is a when a < min.
The comprehensive interest rate – average premium index is limited by the premium deviation from the upper limit and the premium deviation from the lower limit, which is in between; the final forecasting the funding rate of next period is limited by the upper limit of the capital rate and the lower limit of the fund rate, which is in between. The corresponding upper and lower limits of each contract are as follows：
 As a example for BTC：
Swaps 
Strict price limit 
No basis price limit 
Basis price limit 

The highest bid quotation 
The lowest asked quotation 
The highest bid quotation 
The lowest asked quotation 
The highest bid quotation 
The lowest asked quotation 

BTC 
6.0% 
6.0% 
4.0% 
4.0% 
2.0% 
2.0% 
[searching Limit of more trading pairs]
[The above data and indicator contents may be adjusted in real time according to market conditions, and the adjustments will be made without further notice.]
Other Circumstances of Funding
Funding are charged at settlement. For users with low margin rates, they will be charged less (or not). Only the maximum payable funding of the user will be charged, and the excess will not be charged. The maximum payable funding is calculated as follows:
Maximum payable funding = max (0, static equity  adjustment factor * abs (net position) * contract face value / settlement price/leverage multiple)