TradingView
b4bd1002
Dec 28, 2023 12:24 PM

FundingRate (Binance USDT) 

Bitcoin / TetherUS PERPETUAL CONTRACTBinance

Description

This script emulates the funding rate for Binance USDT pairs. The funding rate is calculated based on the premium index. However, as the precise method for averaging the premium index is unclear, this calculation is based on an estimation and may contain some discrepancies.

If a non-Binance USDT pair is selected, the script automatically calculates and displays the funding rate for a corresponding Binance USDT pair.

By default, the funding rate for the chart's pair is displayed, but you can change this to a different pair if needed. To enhance the accuracy of the calculations, the script uses 1-minute interval data by default. If you wish to broaden the display range of the funding rate, either stop using lower timeframe data or select a larger interval than 1 minute.

Release Notes

- Fixed a bug that occurred when lower timeframe was not used.

Release Notes

- adjusted the calculation process to accommodate a certain level of missing data in the premium index

Release Notes

I've added the following modes in addition to the existing FR (Funding Rate) display mode.
Please note that these are only supported for USDT-based pairs on Binance:

Avg Premium: This represents the Time-Weighted Average Price (TWAP) of the premium index, showing the moving average of the divergence between perpetual futures and the index price. When this value exceeds 0.06%, the FR increases above 0.01% by the exceeded amount. Conversely, if it falls below -0.04%, the FR decreases below 0.01% by the exceeded amount. This metric can be used to predict potential deviations of the FR from 0.01%.

Premium Index: This displays the closing value of the premium index, which is used in the calculation of the FR. If this value consistently shows significant deviations, the FR tends to shift in the direction of these deviations from its standard 0.01%.

Avg Prem + PI: This mode displays both the Avg Premium and the Premium Index simultaneously, providing a comprehensive view of the market conditions that influence the FR.

Release Notes

- added FR candle mode
Comments
alexandercastm
Hello, I am really to understand what is "avg premium" actually displaying, and re-read your explanation but just don't understand. Hopefully you have the time to better explain that. thanks.
b4bd1002
@alexandercastm,

Hi, here's a explanation of "avg premium"

avg premium represents the 8-hour Time-Weighted Average Price (TWAP) of the premium index.
The premium index is an indicator that shows the price difference between the perpetual futures (perp) and the spot market, roughly representing the deviation rate between perp and spot.

avg premium can be used as an average value of this deviation rate.
For example, if avg premium is positive, it means that perp has been continuously higher than spot, and conversely, if it is negative, it suggests that perp has been continuously lower than spot.

The funding rate (FR) is expressed by the following formula:
FR = avg premium + clamp(0.01 - avg premium, 0.05, -0.05)
This formula fixes FR at 0.01% when avg premium is within the range of 0.06% to -0.04%. In other words, when the average deviation (avg premium) between perp and spot is small, FR is expressed as 0.01%.

On the other hand, when avg premium is sufficiently large, FR becomes the value obtained by subtracting 0.05% from avg premium.
Conversely, when avg premium is sufficiently small, FR becomes the value obtained by adding 0.05% to avg premium.
As a result, the graph of FR takes a shape similar to dividing the graph of y=x at x=0.01 and shifting it 0.05 to the left and right. (x is avg premium, y is FR)
In other words, avg premium is the raw FR.

Even when FR is 0.01%, the value of avg premium can be used to predict to some extent whether FR is more likely to move up or down from 0.01%.
For example, if premium index surges when avg premium is 0.05% compared to when it is -0.03%, in the case of 0.05%, avg premium is more likely to exceed 0.06%, making FR more likely to be greater than 0.01%. However, in the case of -0.03%, it is less likely to become that large, so there is a possibility that FR will not move from 0.01%.

Furthermore, the relative position of avg premium and premium index is also important in predicting future FR. Since avg premium is the moving average of premium index, if premium index is above avg premium, avg premium is expected to continue rising, and conversely, if premium index is below avg premium, avg premium is expected to continue falling.
Therefore, it can be said that premium index is an important factor that pulls avg premium and consequently changes FR.

The above is a explanation of the relationship between avg premium and FR.

If you would like to understand more accurately, please read the explanatory article on funding rate published by Binance.
alexandercastm
@b4bd1002, Hi, thanks for the detailed explanation about how your indicator works. I am currently using FR and Avg premium overlaying each other. As I understood, avg premium will help me as a leading indicator? I know everything is based on probability but, technically avg premium is showing me where is FR likely going next? And also, I was planning to use premium index but since avg premium is based on PI, I believe avg premium has less noise.
b4bd1002
@alexandercastm,
I don't think avg premium can be a leading indicator because it's almost the same as FR.
Avg premium is the moving average of the deviation, and FR is a masked version of a part of it.
The advantage of avg premium is that you can see the parts that are masked.
Some people look at FR to check sentiment, but you can't see sentiment in the range where FR is 0.01%.
However, with avg premium, you can see sentiment changes even in that range.
That's the advantage of looking at avg premium alone.
Personally, I like to look at the changes in premium index relative to avg premium.
It allows me to see short-term behaviors of perp and signs of changes in spot supply and demand. In such cases, I actually check things like delta and oi.
alexandercastm
@b4bd1002, Thanks again, would you mind giving me an example? it is difficult to interpret the signals. I know I am asking for too much, sorry in advance.
More