OPEN-SOURCE SCRIPT
Telah dikemas kini 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.
Nota Keluaran
In the previous version, at certain times, funding rates returned = na. Now no longerSkrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.