Perpetual swaps basis

What
This is a perpetual swaps basis that works for both BTC and ETH (check settings).
A perpetual swaps basis, or 'perps basis' for short, looks at the price of a perpetual swap contract and compares it to a spot index. The point of the indicator is to see whether the perps market or spot market is trading higher/lower.
Indicator values will be positive when perps are trading higher than spot.
Indicator values will be negative when perps are trading lower than spot.
Analysis
Generally speaking a spot bid is considered bullish because it's a more accurate representation of real demand. When perps are trading higher it's usually because directional traders are aggressively going long which is dangerous/bearish because this is leveraged money that can easily get shaken out. It could also be that perps are trading higher because spot is selling off hard, but this is also bearish so the result the same.
Summary: most of the time a perps premium is bearish, and a spot premium is bullish.
I would never trade based on 'signals' of this indicator alone, but it does offer valuable confluence in your market analysis.
Data
In the settings you can either select the individual basis for each perp contract of the three biggest derivatives venues (Binance, Bybit, OKX) or you can select my custom global basis.
For the individual basis I've recreated to the best of my ability the official spot indices that these exchanges use and compared those to the perp contracts.
For the custom global basis I've made my own weighted perps price index and spot price index and then compared these indices to each other to get a more global overview of how perps are trading versus spot.
The perps index includes the following contracts: Binance linear USDT, Binance inverse USD, Bybit linear USDT, Bybit inverse USD, OKX linear USDT, OKX inverse USD.
The spot index includes the following markets: Binance USDT, OKX USDT, Bybit USDT, Coinbase USD, Kraken USD, Bitfinex USD, Bitstamp USD.
Extra notes
I will update all of the indices when necessary.
Some of the basis' will look weird on certain timeframes if you go far back enough in the past. This is because the OKX USDT spot market data used to be bugged in a weird way on TradingView and this is an important market that I just had to include. So past data that includes this market will look very erratic. This is only a problem for past data, it currently works fine, so current data is correct.
Invite-only script
Only users authorized by the author have access to this script, and this usually requires payment. You can add the script to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author — learn more here. For more details, follow the author's instructions below or contact ByzantiumScripts directly.
Note that this private, invite-only script has not been reviewed by script moderators, and its compliance with House Rules is undetermined. TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.
Disclaimer
Invite-only script
Only users authorized by the author have access to this script, and this usually requires payment. You can add the script to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author — learn more here. For more details, follow the author's instructions below or contact ByzantiumScripts directly.
Note that this private, invite-only script has not been reviewed by script moderators, and its compliance with House Rules is undetermined. TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.