TradingView
Gokubro
30 מרץ 2022 16:38

Basic Binance Premium Index 

Bitcoin / US DollarBinance

תיאור

A premium index indicator for Binance futures.

The premium index is based on the difference in price between the perpetual swap contract last price and the price of a volume weighted spot index.

Simply put: it shows you for each coin whether the spot market is trading higher than the Binance perpetual or not.

If future price is higher than spot in a rally, the rally isn't backed by real buys (spot) but by dumb perpetual longs which can indicate bearish PA. If spot price is higher than futures in a rally, the upside is backed by real money (spot) which can indicate bullish PA.

To calculate the premium, I simply took (futures_price/vwap(spot_price)-1)*100

This version includes

•BTC
•ETH
•LTC
•ICP
•BNB
•ADA
•DOGE.

You can display data as a smoothed moving average for improved readability.

This code is open source so feel free to use it in your scripts.

הערות שחרור

fixed typo on BNB, ADA, and Doge pairs so that the perp contracts were perp and not spot.

הערות שחרור

changed BTC, ETH and LTC perpetual futures pairs to their respective USDT trading pairs instead of USD trading pairs
תגובות
MrAndersonCR
great scrips!
Trader_Corleone
very useful coding tahnks a lot but ı have question, what can ı do this code dinamic so when select any graph indicator know automaticly?
RNavega
Hi @Gokubro , thanks a lot for sharing!
A question/suggestion: you're taking the BTC perp value from the symbol BINANCE:BTCPERP, this uses USD as currency. For the spot value you're taking from BINANCE:BTCUSDT, that uses USDT (the stablecoin).
So wouldn't it be better to use BINANCE:BTCUSDTPERP as the perp symbol so both are based on USDT? (Maybe it doesn't make any difference numerical in the end.)
Gokubro
@RNavega, thanks for the suggestion. I've updated the script so that all the perpetual trading pairs now use their USDT trading pairs. Also, if you liked this script, you may also like my BABI script. It also looks at the basis between spot and perpetual trading pairs on Binance, but has the added bonus of working on every USDT altcoin trading pair on Binance! tradingview.com/script/I0xAWNQa-BABI-Binance-Altcoin-Basis-Indicator/
RNavega
@Gokubro, hi, thanks for the fast response and for suggesting your BABI indicator. Going through it right now.
I was researching this yesterday, there's a built-in premium index for Binance but the raw data is very noisy: BINANCE:BTCUSDT_PREMIUM
Since the raw data is so noisy the only way I found of plotting it is with an accumulation (the formula below is the same from the built-in Volume Oscillator indicator). Do you happen to know if this Binance p.index symbol is meaningful?

premium = request.security('BINANCE:BTCUSDT_PREMIUM', timeframe.period, close)
fast = ta.cum(premium)
slow = ta.ema(fast, 14)
osc = 100.0 * (fast - slow) / slow
plot(osc, "Premium", color.yellow)
Maximalist1997
Fantastic!
עוד