OPEN-SOURCE SCRIPT
已更新 Binance Funding Rates [vichtoreb]

Source: binance.com/en/support/faq/detail/360033525031
The funding rate has two components: the interest rate and the average Premium Index.
Binance furnishes the Premium Index data for crypto assets on the TradingView platform. This script uses that data to calculate the funding rate.
Binance updates the Premium Index every 5 seconds.
The average Premium Index (denoted **P\_avg**) is the time-weighted average of all Premium Index data points:
P_avg = wma(Premium Index, n)
where **n** is the averaging length.
At each change time—8:00 PM, 4:00 AM, and 12:00 PM (UTC-4)—Binance sets
P_avg = wma(Premium Index, 5 760)
This is the weighted moving average of the last 8 hours because 5 760 × 5 s = 8 h. Binance then calculates the new funding rate:
Funding Rate = P_avg + clamp(interest rate − P_avg, −0.05 %, 0.05 %)
This value updates only at those change times (8:00 PM, 4:00 AM, and 12:00 PM, UTC-4).
**Indicator precision**
TradingView limits historical requests to 5 000 candles. To match Binance exactly, 5 760 candles are required. As a workaround, the script samples the Premium Index every *resolution* seconds (or minutes), where *resolution* is the indicator’s timeframe input.
If it weren't for this limitation, setting resolution = 5 sec, we would get EXACTLY the same result as the official one
**Interest rate**
On Binance Futures, the interest rate is 0.03 % per day by default (0.01 % per funding interval, as funding occurs every 8 hours). This does not apply to certain contracts, such as ETH/BTC, for which the interest rate is 0 %.
**Estimate line**
If the “show estimate” input is enabled, the indicator plots
wma(Premium Index, n) + clamp(interest rate − P_avg, −0.05 %, 0.05 %)
with **n** equal to the number of bars that have elapsed since the last funding-rate change.
The funding rate has two components: the interest rate and the average Premium Index.
Binance furnishes the Premium Index data for crypto assets on the TradingView platform. This script uses that data to calculate the funding rate.
Binance updates the Premium Index every 5 seconds.
The average Premium Index (denoted **P\_avg**) is the time-weighted average of all Premium Index data points:
P_avg = wma(Premium Index, n)
where **n** is the averaging length.
At each change time—8:00 PM, 4:00 AM, and 12:00 PM (UTC-4)—Binance sets
P_avg = wma(Premium Index, 5 760)
This is the weighted moving average of the last 8 hours because 5 760 × 5 s = 8 h. Binance then calculates the new funding rate:
Funding Rate = P_avg + clamp(interest rate − P_avg, −0.05 %, 0.05 %)
This value updates only at those change times (8:00 PM, 4:00 AM, and 12:00 PM, UTC-4).
**Indicator precision**
TradingView limits historical requests to 5 000 candles. To match Binance exactly, 5 760 candles are required. As a workaround, the script samples the Premium Index every *resolution* seconds (or minutes), where *resolution* is the indicator’s timeframe input.
If it weren't for this limitation, setting resolution = 5 sec, we would get EXACTLY the same result as the official one
**Interest rate**
On Binance Futures, the interest rate is 0.03 % per day by default (0.01 % per funding interval, as funding occurs every 8 hours). This does not apply to certain contracts, such as ETH/BTC, for which the interest rate is 0 %.
**Estimate line**
If the “show estimate” input is enabled, the indicator plots
wma(Premium Index, n) + clamp(interest rate − P_avg, −0.05 %, 0.05 %)
with **n** equal to the number of bars that have elapsed since the last funding-rate change.
發行說明
In the previous version, at certain times, funding rates returned = na. Now no longer開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。