OPEN-SOURCE SCRIPT

Crypto OI Agregated

200
Crypto OI Aggregated — Open Interest Aggregator for Crypto Exchanges

General Description
The indicator is designed for comprehensive analysis of Open Interest (OI) across major cryptocurrency exchanges. It consolidates data from multiple platforms, visualizes it as candlestick charts or deltas, and builds tables with breakdowns by exchange and contract type. This allows traders to quickly understand where market interest is concentrated and how the market structure is shifting.

Unlike standard tools that only show data from a single exchange, this indicator provides a full market overview and makes it easy to compare dynamics across different platforms.



Key Features
• Aggregation of OI data from exchanges: Binance, Bybit, OKX, Bitget, Kraken, HTX, Deribit (feel free to leave a comment if you’d like me to add other exchanges that provide open interest data)
• Support for contract types: USDT.P, USD.P, USDC.P, USD.PM
• Automatic normalization of various OI data formats from different providers
• Display modes:
• OI candlestick chart (total aggregated OI)
• OI Delta (change in OI per bar)
• Full table with detailed data by exchange and contract type
• Short summary table with totals in USD and base assets
• Support for USD or COIN denomination
• Convenient formatting for large numbers
• Customizable colors

snapshot



How to Use the Indicator
1. Select Exchanges
In the settings, enable or disable specific exchanges. It is recommended to activate only the ones you need for analysis — this will make the indicator faster.
2. Choose Data Type
• OI — aggregated open interest from selected exchanges.
• OI delta — delta (change in OI compared to the previous bar).
3. Denomination
• USD — values are converted into USD equivalents.
• COIN — values are shown in the base asset (BTC, ETH, etc.).
4. Reading the Chart
• OI candlesticks show the overall OI dynamics.
• Delta histogram highlights how much OI has grown or decreased per bar.
• Colors are fully customizable.
5. Tables
• Enabled via the Show table option.
• Full Table → Rows = exchanges, Columns = contract types. Cells contain OI values in either USD or the base asset, depending on settings. Quickly shows where the main interest is concentrated.
• Short Table → Displays only the total OI values in USD and the base asset.



Important Notes
• For better readability of large values, two custom formatting functions were implemented. They work similarly to format.volume, but with improved digit grouping and adjustable decimal precision. In the tables, the top row is formatted using format.volume, while the bottom row uses the improved formatting functions for clearer representation.
Pine Script®
str(d, n, s) => str.substring(d, 0, str.length(d) - n) + '.' + str.substring(d, str.length(d) - n, str.length(d) - (n - 2)) + s format(_r) => d = str.tostring(math.round(_r)) str.length(d) > 9 ? str(d, 9, " B") : str.length(d) > 6 ? str(d, 6, " M") : str.length(d) > 3 ? str(d, 3, " K") : d


snapshot



Conclusion: Crypto OI Aggregated is a convenient and powerful tool for cryptocurrency derivatives traders. It enables tracking of OI dynamics across multiple exchanges simultaneously, detecting imbalances between contracts, and identifying signals that are not visible when analyzing a single exchange.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.