OPEN-SOURCE SCRIPT
Crypto Exchange Premium

Description: Crypto Exchange Premium
The Crypto Exchange Premium indicator is designed to quantify and visualize price disparities between different types of crypto markets — specifically between spot and perpetual futures markets, or between any two customizable sources of price data. By consolidating live data from multiple major exchanges, it creates a unified, cross-market measure of premium (or discount), helping traders identify institutional activity (i. e. by comparing exchanges with high institutional activity against others), arbitrage opportunities, and shifts in market sentiment before they become visible in price action alone.
Concept and Purpose
In cryptocurrency markets, price divergence between spot and perpetual pairs reflects the real-time interaction of demand and liquidity across market segments.
When perpetual prices trade above spot, it implies aggressive long positioning or bullish leverage (positive funding expectations).
Conversely, when spot trades above perps, it may reflect net selling pressure in futures or strong spot accumulation.
Unlike most tools that rely on funding rates or open interest alone, this indicator measures the actual traded price spread dynamically across exchanges. This allows traders to visualize the “premium curve” of the crypto market in a clear, data-driven format.
How It Works
The indicator aggregates real-time prices from a wide selection of exchanges, normalizes them into groups, and computes the difference (“premium”) between two chosen reference markets.
1. Exchange Aggregation:
Users can toggle individual exchanges for both spot and perpetual aggregation groups.
The script automatically calculates group averages by dividing the sum of all enabled exchange prices by the number of valid feeds.
Non-USD exchanges (e.g., KRW pairs on Upbit or Bithumb) are automatically converted into USD using live FX data (USDKRW) for accurate normalization.
2. Flexible Comparison Logic:
Each leg of the comparison (First vs. Second Source) can be chosen as one of:
Local chart symbol
Custom symbol
Aggregated Spot group
Aggregated Perpetual group
This allows users to compare, for example:
Binance Spot vs. Global Perp Average
Coinbase Spot vs. Binance Perp
BTCUSD vs. BTCUSDT.P (or any cross-exchange combination)
3. Premium Calculation:
The final value is computed as:
Premium = First Source Price − Second Source Price
and is plotted as a histogram (positive = green, negative = red). This visual instantly shows whether the first source trades at a premium or discount relative to the second.
How to Use
Select Data Sources:
Configure the “First Symbol” and “Second Symbol” in the settings. For most use cases:
First Symbol → Perps (Aggregated)
Second Symbol → Spot (Aggregated)
Adjust Exchange Selection:
Enable or disable individual exchanges to fine-tune your data set. For instance, disabling Korean exchanges filters out regional FX distortions.
Originality and Value
While many exchange difference or “premium indicators” track one or two exchanges, this script introduces multi-exchange aggregation, cross-market normalization, and user-configurable pairing, resulting in a more holistic and accurate reflection of market structure.
It bridges a gap between macro market breadth and microstructural price dynamics, empowering traders to:
Detect arbitrage inefficiencies between spot and perps.
Track regional price dislocations (USD vs. KRW).
Gauge the intensity of speculative leverage over time.
Anticipate funding rate shifts and liquidation clusters before they happen.
The Crypto Exchange Premium indicator is designed to quantify and visualize price disparities between different types of crypto markets — specifically between spot and perpetual futures markets, or between any two customizable sources of price data. By consolidating live data from multiple major exchanges, it creates a unified, cross-market measure of premium (or discount), helping traders identify institutional activity (i. e. by comparing exchanges with high institutional activity against others), arbitrage opportunities, and shifts in market sentiment before they become visible in price action alone.
Concept and Purpose
In cryptocurrency markets, price divergence between spot and perpetual pairs reflects the real-time interaction of demand and liquidity across market segments.
When perpetual prices trade above spot, it implies aggressive long positioning or bullish leverage (positive funding expectations).
Conversely, when spot trades above perps, it may reflect net selling pressure in futures or strong spot accumulation.
Unlike most tools that rely on funding rates or open interest alone, this indicator measures the actual traded price spread dynamically across exchanges. This allows traders to visualize the “premium curve” of the crypto market in a clear, data-driven format.
How It Works
The indicator aggregates real-time prices from a wide selection of exchanges, normalizes them into groups, and computes the difference (“premium”) between two chosen reference markets.
1. Exchange Aggregation:
Users can toggle individual exchanges for both spot and perpetual aggregation groups.
The script automatically calculates group averages by dividing the sum of all enabled exchange prices by the number of valid feeds.
Non-USD exchanges (e.g., KRW pairs on Upbit or Bithumb) are automatically converted into USD using live FX data (USDKRW) for accurate normalization.
2. Flexible Comparison Logic:
Each leg of the comparison (First vs. Second Source) can be chosen as one of:
Local chart symbol
Custom symbol
Aggregated Spot group
Aggregated Perpetual group
This allows users to compare, for example:
Binance Spot vs. Global Perp Average
Coinbase Spot vs. Binance Perp
BTCUSD vs. BTCUSDT.P (or any cross-exchange combination)
3. Premium Calculation:
The final value is computed as:
Premium = First Source Price − Second Source Price
and is plotted as a histogram (positive = green, negative = red). This visual instantly shows whether the first source trades at a premium or discount relative to the second.
How to Use
Select Data Sources:
Configure the “First Symbol” and “Second Symbol” in the settings. For most use cases:
First Symbol → Perps (Aggregated)
Second Symbol → Spot (Aggregated)
Adjust Exchange Selection:
Enable or disable individual exchanges to fine-tune your data set. For instance, disabling Korean exchanges filters out regional FX distortions.
Originality and Value
While many exchange difference or “premium indicators” track one or two exchanges, this script introduces multi-exchange aggregation, cross-market normalization, and user-configurable pairing, resulting in a more holistic and accurate reflection of market structure.
It bridges a gap between macro market breadth and microstructural price dynamics, empowering traders to:
Detect arbitrage inefficiencies between spot and perps.
Track regional price dislocations (USD vs. KRW).
Gauge the intensity of speculative leverage over time.
Anticipate funding rate shifts and liquidation clusters before they happen.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。