Liquidation Heatmap(真正的价格区间清算压力)
cg_liquidation_analysis 返回全0,不可用。正确做法是直接调 API:
from tools._api import cg_request
# 全市场聚合热力图(推荐,无需指定交易所)
# range 支持: 12h, 24h, 3d, 7d, 30d, 90d, 180d, 1y
data = cg_request("api/futures/liquidation/aggregated-heatmap/model1",
params={"symbol": "BTC", "range": "24h"})
# 返回结构:
# data["y_axis"] → 价格档位列表(从低到高)
# data["liquidation_leverage_data"] → [[y_idx, leverage, usd_value], ...]
# data["price_candlesticks"] → OHLCV K线,最后一根收盘价 = 当前价
# data["update_time"] → 更新时间戳
# 解析方法:
from collections import defaultdict
y_axis = data["y_axis"]
current_price = float(data["price_candlesticks"][-1][4])
price_liq = defaultdict(float)
for y_idx, leverage, usd_val in data["liquidation_leverage_data"]:
if 0 <= y_idx < len(y_axis):
price_liq[y_axis[y_idx]] += usd_val
longs = {p: v for p, v in price_liq.items() if p < current_price} # 多头清算(↓触发)
shorts = {p: v for p, v in price_liq.items() if p > current_price} # 空头清算(↑触发)
注意:单交易所版本(heatmap/model1 带 exchange 参数)当前会报 400 错误,改用 aggregated 版本。
Script Usage
Script-mode skill — read this file, then invoke from a bash block:
python3 - <<'EOF'
import sys, json
sys.path.insert(0, "/data/workspace/skills/coinglass")
from exports import funding_rate, cg_open_interest, cg_liquidations
print(funding_rate(symbol="BTC"))
print(cg_open_interest(symbol="BTC"))
EOF
Read exports.py for the full list of available functions and exact
signatures. Common ones: funding_rate, long_short_ratio,
cg_open_interest, cg_liquidations, cg_liquidation_analysis,
cg_global_account_ratio, cg_top_account_ratio, cg_top_position_ratio,
cg_taker_exchanges, cg_net_position, cg_supported_coins,
cg_supported_exchanges, cg_coins_market_data, cg_pair_market_data,
cg_ohlc_history, cg_hyperliquid_whale_alerts,
cg_hyperliquid_whale_positions, cg_taker_volume_history,
cg_aggregated_taker_volume, cg_cumulative_volume_delta,
cg_coin_netflow, cg_whale_transfers, cg_btc_etf_flows,
cg_eth_etf_flows, cg_sol_etf_flows.
Coinglass
Coinglass provides the most comprehensive crypto derivatives and institutional data available. 37 tools covering futures positioning, whale tracking, volume analysis, liquidations, and ETF flows.
API Plan: Professional ($699/month)
Rate Limit: 6000 requests/minute
API Version: V4 (with V2 backward compatibility)
Total Tools: 37 across 8 categories
Function Reference (full signatures + return shapes)
All functions live in exports.py. Most return Optional[List[Dict]] or
Optional[Dict]. None means the upstream call failed or returned empty —
always check before indexing.
⚠️ Field naming convention (READ THIS FIRST)
CoinGlass v4 API uses camelCase for almost all data fields, with a few
legacy snake_case exceptions in liquidation endpoints. Don't assume
snake_case — inspect the dict before scripting.
- camelCase:
openInterest, volUsd, longRate, shortVolUsd,
exchangeName, nextFundingTime, fundingIntervalHours,
oichangePercent, h4OIChangePercent, avgFundingRateBySymbol,
tokenAmount, liquidationUsd (in some endpoints)
- snake_case (legacy, only in
cg_liquidations): liquidation_usd,
longLiquidation_usd, shortLiquidation_usd
rate fields (funding) are STRINGS with "+" / "-" / "%" — parse with
float(r.rstrip('%').lstrip('+')) to compare numerically
- timestamps are millisecond unix epoch (e.g.
1777881600000)
Funding & Open Interest
| Function |
Signature |
funding_rate(symbol, exchange=None) |
dict — keys: symbol, exchange, rate (str), num_exchanges, exchanges_data (list of {exchangeName, rate, nextFundingTime, fundingIntervalHours, status}) |
cg_open_interest(symbol='BTC', interval='0') |
LIST of dicts (one per exchange) — keys: symbol, openInterest, volUsd, oichangePercent, h4OIChangePercent, h24VolChangePercent, volChangePercent7d, avgFundingRateBySymbol, exchangeName, exchangeLogo |
Long/Short Ratios
| Function |
Signature |
long_short_ratio(symbol='BTC', interval='h4') |
LIST — top item is aggregated; list field inside has per-exchange breakdown. Keys: longRate, shortRate, longVolUsd, shortVolUsd, totalVolUsd, list |
cg_global_account_ratio(symbol='BTC', exchange='Binance', interval='1h') |
list of historical bars |
cg_top_account_ratio(symbol='BTC', exchange='Binance', interval='1h') |
list — top trader account-count ratio |
cg_top_position_ratio(symbol='BTC', exchange='Binance', interval='1h') |
list — top trader position-size ratio |
cg_taker_exchanges(symbol='BTC', range_type='4h') |
list — taker buy/sell across exchanges |
cg_net_position(symbol='BTC', exchange='Binance', interval='1h') |
list — net long-short USD over time |
Liquidations
| Function |
Signature |
cg_liquidations(symbol='BTC', time_type='h24') |
LIST of dicts (one per exchange + an 'All' row first). Keys: exchange, liquidation_usd, longLiquidation_usd, shortLiquidation_usd (NOTE: snake_case legacy fields) |
cg_liquidation_analysis(symbol='BTC', time_type='h24') |
dict — aggregated network-wide stats |
cg_coin_liquidation_history(symbol='BTC', interval='h4') |
list — historical liq bars |
cg_pair_liquidation_history(symbol='BTC', exchange='Binance', interval='h4') |
list — historical liq for one pair on one exchange |
cg_liquidation_coin_list(symbol=None) |
list of all coins with liq summary |
cg_liquidation_orders(symbol='BTC', exchange=None) |
list — recent individual liq orders |
Futures Market Data
| Function |
Signature |
cg_supported_coins() |
List[str] — symbols supported by CoinGlass |
cg_supported_exchanges() |
list of exchange info dicts |
cg_coins_market_data(symbol=None) |
list — current snapshot for all coins (or one if symbol given) |
cg_pair_market_data(symbol='BTC', exchange=None) |
list — pair-level snapshot |
cg_ohlc_history(symbol='BTC', interval='h4', exchange=None) |
list of OHLCV bars |
Hyperliquid Whale Tracking
| Function |
Signature |
cg_hyperliquid_whale_alerts() |
list — recent large-position alerts |
cg_hyperliquid_whale_positions() |
list — current open whale positions |
cg_hyperliquid_positions_by_coin(symbol='BTC') |
list — whales holding a specific coin |
cg_hyperliquid_position_distribution(symbol='BTC') |
dict — long/short position-size distribution |
Volume / Flow
| Function |
Signature |
cg_taker_volume_history(symbol='BTC', exchange='Binance', interval='1h', limit=1000, start_time=None, end_time=None) |
list — taker buy/sell volume bars |
cg_aggregated_taker_volume(symbol='BTC', interval='h4') |
list — aggregated across all exchanges |
cg_cumulative_volume_delta(symbol='BTC', exchange='Binance', interval='1h', limit=1000, start_time=None, end_time=None) |
list — CVD bars |
cg_coin_netflow(symbol=None) |
list — net inflow/outflow per coin |
cg_whale_transfers() |
dict — recent on-chain large transfers |
ETF Flows
| Function |
Signature |
cg_btc_etf_flows() |
list — daily flows per US BTC ETF |
cg_btc_etf_history(etf_ticker=None) |
list — historical AUM/flows |
cg_btc_etf_list() |
list of BTC ETF tickers + AUM |
cg_btc_etf_premium_discount() |
list — premium/discount % vs NAV |
cg_hk_btc_etf_flows() |
list — Hong Kong BTC ETF flows |
cg_eth_etf_flows() / cg_eth_etf_list() / cg_eth_etf_premium_discount() / cg_hk_eth_etf_flows() |
ETH ETF equivalents |
cg_sol_etf_flows() / cg_sol_etf_list() |
SOL ETF data |
cg_xrp_etf_flows() / cg_xrp_etf_list() |
XRP ETF data |
Sample responses (most-used functions)
funding_rate(symbol="BTC"):
{
"symbol": "BTC",
"exchange": "average",
"rate": "-0.0016%",
"num_exchanges": 21,
"exchanges_data": [
{"exchangeName": "Binance", "rate": "+0.0050%",
"nextFundingTime": 1777881600000, "fundingIntervalHours": 8, "status": 1}
]
}
cg_liquidations(symbol="BTC", time_type="h24"):
[
{"exchange": "All", "liquidation_usd": 170497688.16,
"longLiquidation_usd": 8179073.80, "shortLiquidation_usd": 162318614.36},
{"exchange": "Bybit", "liquidation_usd": 40454694.98, ...}
]
cg_open_interest(symbol="BTC"):
[
{"symbol": "BTC", "openInterest": 61395303653.62, "volUsd": 56349328748.42,
"oichangePercent": 7.17, "h4OIChangePercent": 5.33,
"avgFundingRateBySymbol": -0.001874, "exchangeName": "Binance"}
]
long_short_ratio(symbol="BTC", interval="h4"):
[{
"symbol": "BTC", "longRate": 53.65, "shortRate": 46.35,
"longVolUsd": 12558668895.91, "shortVolUsd": 10848776476.99,
"totalVolUsd": 23407445372.91,
"list": [
{"exchangeName": "Binance", "longRate": 55.75, "shortRate": 44.25, ...}
]
}]
Tool Selection Guide
Decision Tree
Step 1: Is this about LIQUIDATIONS?
Liquidation query?
├─ YES → How many coins?
│ ├─ ALL coins / ranking / 排行 / 汇总
│ │ └─ → cg_liquidation_coin_list ✅ (most liquidation queries land here)
│ ├─ ONE coin, need history over time
│ │ └─ → cg_coin_liquidation_history
│ ├─ ONE coin, specific orders (price/side/USD)
│ │ └─ → cg_liquidation_orders
│ └─ ONE coin, just a quick total + sentiment label
│ └─ → cg_liquidation_analysis (rarely needed; only if explicitly "simple summary")
Step 2: Is this about LONG/SHORT RATIO?
Long/short query?
├─ Historical time-series, trend over time, 多空比变化
│ └─ → cg_global_account_ratio (ALL accounts)
│ or cg_top_account_ratio (top traders only)
│ or cg_top_position_ratio (by position size)
└─ Current snapshot only (no history needed)
└─ → long_short_ratio
Step 3: Is this about OPEN INTEREST?
OI query?
└─ → cg_open_interest (always — do NOT use cg_coins_market_data for OI)
Step 4: Is this a MARKET OVERVIEW / SENTIMENT query?
Sentiment / 市场情绪 / pre-trade check?
└─ Use: funding_rate + long_short_ratio + cg_open_interest
DO NOT use cg_coins_market_data as a substitute for any of the above
Keyword → Tool Lookup
| Keyword / Pattern |
Correct Tool |
❌ Do NOT use |
| 爆仓排行 / 今日爆仓 / all coins liquidation |
cg_liquidation_coin_list |
cg_liquidations |
| 24h爆仓汇总 / liquidation summary |
cg_liquidation_coin_list |
cg_liquidation_analysis |
| 全网账户多空比 / account L/S ratio |
cg_global_account_ratio |
long_short_ratio |
| 头部交易者多空 / top trader ratio |
cg_top_account_ratio |
long_short_ratio |
| 未平仓合约 / open interest |
cg_open_interest |
cg_coins_market_data |
| 市场情绪多空分析 |
funding_rate + long_short_ratio + cg_open_interest |
cg_coins_market_data |
| BTC做多检查 / pre-trade checklist |
funding_rate + cg_global_account_ratio + cg_liquidation_coin_list |
— |
Common Mistakes
Mistake 1 (most common — 8x failure): Using cg_liquidations when you need cg_liquidation_coin_list
cg_liquidations → one coin, one timeframe, basic total only
cg_liquidation_coin_list(exchange) → ALL coins, multi-timeframe (1h/4h/12h/24h), per-exchange breakdown
- Rule: If the question asks for a ranking, overview, or doesn't specify a single coin → use
cg_liquidation_coin_list
Mistake 2 (5x failure): Using cg_liquidation_analysis for liquidation rankings
cg_liquidation_analysis adds a sentiment label to a single-coin total — it is NOT a ranking tool
- Rule: "今日爆仓排行" / "各币种爆仓" → always
cg_liquidation_coin_list
Mistake 3 (3x failure): Using long_short_ratio for historical L/S analysis
long_short_ratio is a current snapshot (no time-series)
cg_global_account_ratio returns history — use it when the user wants trends or comparison over time
- Rule: If the question compares 全网 (global) vs 头部 (top traders) → call BOTH
cg_global_account_ratio AND cg_top_account_ratio
Mistake 4 (2x failure): Using cg_coins_market_data for open interest
cg_coins_market_data is a bulk snapshot of many coins — not a replacement for dedicated OI or L/S tools
- Rule: OI question →
cg_open_interest. L/S question → long_short_ratio or cg_global_account_ratio. Never route either to cg_coins_market_data.
Rules
Tool Call Guidance
❌ FORBIDDEN TOOLS — NEVER USE:
bash — Do NOT write scripts to process/format data. Use natural language.
write_file / read_file / edit_file — Do NOT save intermediate data. Answer directly.
learning_log — ONLY for genuine skill bugs or persistent API errors. NOT for empty responses.
echo — Do NOT use for debugging or output.
✅ CORRECT PATTERN:
- Tool returns data → Summarize in natural language → Done
- Tool returns empty/null → Report "no data available" → Done
- Need calculation (%, change, ratio) → Do mental math in reply
Match tool count to question scope:
- 单一指标问题("BTC 资金费率"、"ETH 多空比")→ 1 个工具,直接返回
- 多维度分析("做多是否合适"、"衍生品体检")→ 3-5 个工具,综合分析
- 对比问题("ETH vs SOL")→ 每个币种调相同工具,并列对比
- 避免重复调用同一工具。 除非用户明确要求不同币种/交易所的对比。
Learning Log Usage (CRITICAL)
learning_log is FORBIDDEN for:
- ❌ Empty API responses — just report "no data available"
- ❌ Tool returning None/null — handle gracefully
- ❌ Uncertainty about tool selection — check decision tree first
- ❌ Normal tool errors — retry once, then report failure
learning_log is ONLY for:
- ✅ Genuine bugs in skill code (wrong data format returned)
- ✅ Persistent API rate limit errors after 2+ retries
- ✅ Missing tools that should exist per skill definition
ETF Tool Selection
| Query |
Primary Tool |
Secondary Tool |
| BTC ETF 资金流入/流出 |
cg_btc_etf_flows() |
cg_btc_etf_history() for detailed history |
| ETH ETF 资金流入/流出 |
cg_eth_etf_flows() |
— |
| SOL/XRP ETF flows |
cg_sol_etf_flows() / cg_xrp_etf_flows() |
— |
| HK ETF flows |
cg_hk_btc_etf_flows() / cg_hk_eth_etf_flows() |
— |
| ETF 列表/代码 |
cg_btc_etf_list() / cg_eth_etf_list() |
— |
| ETF 溢价/折价 |
cg_btc_etf_premium_discount() |
— |
ETF 对比问题 workflow:
# BTC vs ETH ETF 对比
btc = cg_btc_etf_flows()
eth = cg_eth_etf_flows()
# Compare the latest day's net flows, summarize in 2-3 sentences
Quick Routing (use this first)
| Query type |
Tool |
| 爆仓/liquidation summary (24h, by coin) |
cg_liquidation_coin_list |
| Individual liquidation orders |
cg_liquidation_orders |
| Liquidation history for a coin |
cg_coin_liquidation_history |
| Funding rate |
funding_rate |
| Long/short ratio (global) |
cg_global_account_ratio |
| Open interest |
cg_open_interest |
| Whale activity on Hyperliquid |
cg_hyperliquid_whale_alerts |
| ETF flows (BTC) |
cg_btc_etf_flows |
When to Use Coinglass
Use Coinglass for:
- Derivatives positioning - What are leveraged traders doing?
- Whale tracking - Track large positions on Hyperliquid DEX
- Funding rates - Cost of holding perpetual futures
- Open interest - Total notional value of open positions
- Long/Short ratios - Sentiment among leveraged traders (global, top accounts, top positions)
- Liquidations - Forced position closures with heatmaps and individual orders
- Volume analysis - Taker volume, CVD, netflow patterns
- ETF flows - Institutional adoption (Bitcoin, Ethereum, Solana, XRP, Hong Kong)
- Whale transfers - Large on-chain movements (>$10M)
- Futures market data - Supported coins, exchanges, pairs, and OHLC price history
Tool Categories
1. Basic Derivatives Analytics (7 tools)
Core derivatives data for market analysis:
funding_rate(symbol, exchange?) - Current funding rates
long_short_ratio(symbol, exchange?, interval?) - Basic L/S ratios
cg_open_interest(symbol) - Current OI across exchanges
cg_liquidations(symbol, time?) - Recent liquidations
cg_liquidation_analysis(symbol) - Liquidation heatmap analysis
cg_supported_coins() - All supported coins
cg_supported_exchanges() - All exchanges with pairs
2. Advanced Long/Short Ratios (6 tools)
Deep positioning analysis with multiple metrics:
cg_global_account_ratio(symbol, interval?) - Global account-based L/S ratio
cg_top_account_ratio(symbol, exchange, interval?) - Top trader accounts ratio
cg_top_position_ratio(symbol, exchange, interval?) - Top positions by size
cg_taker_exchanges(symbol) - Taker buy/sell by exchange
cg_net_position(symbol, exchange) - Net long/short positions
cg_net_position_v2(symbol) - Enhanced net position data
Use cases:
- Smart money tracking (top accounts vs retail)
- Exchange-specific sentiment
- Position size distribution analysis
3. Advanced Liquidations (4 tools)
Granular liquidation tracking for cascade prediction:
cg_coin_liquidation_history(symbol, interval?, limit?, start_time?, end_time?) - Aggregated across all exchanges
cg_pair_liquidation_history(symbol, exchange, interval?, limit?, start_time?, end_time?) - Exchange-specific pair
cg_liquidation_coin_list(exchange) - All coins on an exchange
cg_liquidation_orders(symbol, exchange, min_liquidation_amount, start_time?, end_time?) - Individual orders (past 7 days, max 200)
Use cases:
- Identifying liquidation clusters
- Tracking liquidation patterns over time
- Finding large liquidation events
4. Hyperliquid Whale Tracking (4 tools)
Track large traders on Hyperliquid DEX (~200 recent alerts):
cg_hyperliquid_whale_alerts() - Recent large position opens/closes (>$1M)
cg_hyperliquid_whale_positions() - Current whale positions with PnL
cg_hyperliquid_positions_by_coin() - All positions grouped by coin
cg_hyperliquid_position_distribution() - Distribution by size with sentiment
Use cases:
- Following smart money on Hyperliquid
- Detecting large position changes
- Tracking whale PnL and sentiment
5. Futures Market Data (5 tools)
Market overview and price data:
cg_coins_market_data() - ALL coins data in one call (100+ coins)
cg_pair_market_data(symbol, exchange) - Specific pair metrics
cg_ohlc_history(symbol, exchange, interval, limit?) - OHLC candlesticks
cg_taker_volume_history(symbol, exchange, interval, limit?, start_time?, end_time?) - Pair-specific taker volume
cg_aggregated_taker_volume(symbol, interval, limit?, start_time?, end_time?) - Aggregated across exchanges
Use cases:
- Market screening (scan all coins at once)
- Price action analysis
- Volume pattern recognition
6. Volume & Flow Analysis (4 tools)
Order flow and capital movement tracking:
cg_cumulative_volume_delta(symbol, exchange, interval, limit?, start_time?, end_time?) - CVD = Running total of (buy - sell)
cg_coin_netflow() - Capital flowing into/out of coins
cg_whale_transfers() - Large on-chain transfers (>$10M, past 6 months)
Use cases:
- Order flow divergence detection
- Smart money tracking
- Institutional movement monitoring
7. Bitcoin ETF Data (5 tools)
Track institutional Bitcoin adoption:
cg_btc_etf_flows() - Daily net inflows/outflows
cg_btc_etf_premium_discount() - ETF price vs NAV
cg_btc_etf_history() - Comprehensive history (price, NAV, premium%, shares, assets)
cg_btc_etf_list() - List of Bitcoin ETFs
cg_hk_btc_etf_flows() - Hong Kong Bitcoin ETF flows
Use cases:
- Institutional demand tracking
- Premium/discount arbitrage
- Regional flow comparison (US vs Hong Kong)
8. Other ETF Data (8 tools)
Ethereum, Solana, XRP, and Hong Kong ETFs:
cg_eth_etf_flows() - Ethereum ETF flows
cg_eth_etf_list() - Ethereum ETF list
cg_eth_etf_premium_discount() - ETH ETF premium/discount
cg_sol_etf_flows() - Solana ETF flows
cg_sol_etf_list() - Solana ETF list
cg_xrp_etf_flows() - XRP ETF flows
cg_xrp_etf_list() - XRP ETF list
cg_hk_eth_etf_flows() - Hong Kong Ethereum ETF flows
Use cases:
- Multi-asset institutional tracking
- Comparative flow analysis
- Regional preference analysis
Common Workflows
Quick Market Scan
# Get everything in 3 calls
all_coins = cg_coins_market_data() # 100+ coins with full metrics
btc_liquidations = cg_liquidations("BTC")
whale_alerts = cg_hyperliquid_whale_alerts()
Deep Position Analysis
# BTC positioning across metrics
cg_global_account_ratio("BTC") # Retail sentiment
cg_top_account_ratio("BTC", "Binance") # Smart money
cg_net_position_v2("BTC") # Net positioning
cg_liquidation_heatmap("BTC", "Binance") # Cascade levels
ETF Flow Monitoring
# Institutional demand
btc_flows = cg_btc_etf_flows()
eth_flows = cg_eth_etf_flows()
sol_flows = cg_sol_etf_flows()
Whale Tracking
# Follow the whales
hyperliquid_whales = cg_hyperliquid_whale_alerts()
whale_positions = cg_hyperliquid_whale_positions() # >$10M on-chain
Volume Analysis
# Order flow
cvd = cg_cumulative_volume_delta("BTC", "Binance", "1h", 100)
netflow = cg_coin_netflow() # All coins
taker_vol = cg_aggregated_taker_volume("BTC", "1h", 100)
Interpretation Guides
Funding Rates
| Rate (8h) |
Read |
| > +0.05% |
Extreme greed — crowded long, squeeze risk |
| +0.01% to +0.05% |
Bullish bias, normal |
| -0.005% to +0.01% |
Neutral |
| -0.05% to -0.005% |
Bearish bias, normal |
| < -0.05% |
Extreme fear — crowded short, bounce risk |
Extreme funding often precedes reversals. The crowd is usually wrong at extremes.
Open Interest + Price Matrix
| OI |
Price |
Read |
| Up |
Up |
New longs entering — bullish conviction |
| Up |
Down |
New shorts entering — bearish conviction |
| Down |
Up |
Short covering — weaker rally, less conviction |
| Down |
Down |
Long liquidation — weaker selloff, capitulation |
Long/Short Ratio
| Ratio |
Read |
| > 1.5 |
Crowded long — contrarian bearish |
| 1.1–1.5 |
Moderately bullish |
| 0.9–1.1 |
Balanced |
| 0.7–0.9 |
Moderately bearish |
| < 0.7 |
Crowded short — contrarian bullish |
CVD (Cumulative Volume Delta)
| Pattern |
Read |
| CVD rising, price rising |
Strong buy pressure, healthy uptrend |
| CVD falling, price rising |
Weak rally, distribution |
| CVD rising, price falling |
Accumulation, potential bottom |
| CVD falling, price falling |
Strong sell pressure, healthy downtrend |
ETF Flows
| Flow |
Read |
| Large inflows |
Institutional buying, bullish |
| Consistent inflows |
Sustained demand |
| Large outflows |
Institutional selling, bearish |
| Premium to NAV |
High demand, bullish sentiment |
| Discount to NAV |
Weak demand, bearish sentiment |
Analysis Patterns
Multi-metric confirmation: Combine tools across categories for high-confidence signals:
- Funding + L/S ratio + liquidations = positioning extremes
- CVD + taker volume + whale alerts = smart money direction
- ETF flows + whale transfers + open interest = institutional conviction
Smart money vs retail: Compare metrics to identify divergence:
cg_top_account_ratio (smart money) vs cg_global_account_ratio (retail)
- Hyperliquid whale positions vs overall long/short ratios
Cascade prediction: Use liquidation tools to predict volatility:
cg_coin_liquidation_history shows liquidation patterns over time
cg_liquidation_orders reveals recent forced closures
- Large liquidation events = cascade risk zones
Flow divergence: Track capital movements:
cg_coin_netflow shows where money is flowing
cg_whale_transfers reveals large movements
- ETF flows show institutional demand
Performance Optimization
Batch vs Individual Calls
✅ OPTIMAL: Use batch endpoints
# One call gets 100+ coins
all_coins = cg_coins_market_data()
# One call gets all whale alerts
whales = cg_hyperliquid_whale_alerts()
# One call gets all ETF flows
btc_etf = cg_btc_etf_flows()
❌ INEFFICIENT: Multiple individual calls
# Don't do this - wastes API quota
btc = cg_pair_market_data("BTC", "Binance")
eth = cg_pair_market_data("ETH", "Binance")
sol = cg_pair_market_data("SOL", "Binance")
Query Parameters
Most history endpoints support:
interval: Time granularity (1h, 4h, 12h, 24h, etc.)
limit: Number of records (default varies, max 1000)
start_time: Unix timestamp (milliseconds)
end_time: Unix timestamp (milliseconds)
Example:
cg_coin_liquidation_history(
symbol="BTC",
interval="1h",
limit=100,
start_time=1704067200000, # 2024-01-01
end_time=1704153600000 # 2024-01-02
)
Supported Exchanges
Major exchanges with futures data:
- Tier 1: Binance, OKX, Bybit, Gate, KuCoin, MEXC
- Traditional: CME (Bitcoin and Ethereum futures), Coinbase
- DEX: Hyperliquid, dYdX, ApeX
- Others: Bitfinex, Kraken, HTX, BingX, Crypto.com, CoinEx, Bitget
Use cg_supported_exchanges() for complete list with pair details.
Important Notes
- API Key: Requires COINGLASS_API_KEY environment variable
- Symbols: Use standard symbols (BTC, ETH, SOL, etc.) - check with
cg_supported_coins()
- Exchanges: Check
cg_supported_exchanges() for full list with pairs
- Update Frequency:
- Market data: ≤ 1 minute
- Funding rates: Every 8 hours (or 1 hour for some exchanges)
- OHLC: Real-time to 1 minute depending on interval
- ETF data: Daily (after market close)
- Whale transfers: Real-time (within minutes)
- API Versions:
- V4 endpoints use
CG-API-KEY header (most tools)
- V2 endpoints use
coinglassSecret header (some legacy tools)
- Both work with the same COINGLASS_API_KEY environment variable
- Rate Limits: Professional plan allows 6000 requests/minute
- Historical Data Limits:
- Liquidation orders: Past 7 days, max 200 records
- Whale transfers: Past 6 months, minimum $10M
- Hyperliquid alerts: ~200 most recent large positions
- Other endpoints: Typically months to years of history
Data Quality Notes
- Hyperliquid: Data is exchange-specific, doesn't include other DEXs
- Whale Transfers: Covers Bitcoin, Ethereum, Tron, Ripple, Dogecoin, Litecoin, Polygon, Algorand, Bitcoin Cash, Solana
- ETF Data: US ETFs updated after market close (4 PM ET), Hong Kong ETFs updated after Hong Kong market close
- Liquidation Orders: Limited to 200 most recent, use heatmap for broader view
- CVD: Cumulative metric - resets are not automatic, track changes not absolute values
Version History
- v3.0.0 (2025-03): Added 36 new tools
- Advanced liquidations (5 tools)
- Hyperliquid whale tracking (5 tools)
- Volume & flow analysis (5 tools)
- Whale transfers (1 tool)
- Bitcoin ETF (6 tools)
- Other ETFs (8 tools)
- Advanced L/S ratios (6 tools)
- v2.2.0 (2024): V4 API migration with futures market data
- v1.0.0 (2024): Initial release with basic derivatives data
1---2name: coinglass3description: Crypto derivatives data: funding rates, open interest, liquidations, long/short ratios. Use when researching perp markets, tracking Hyperliquid whale positions, or comparing ETF flows (e.g. BTC funding, ETH OI, liquidation heatmap).4---56## Liquidation Heatmap(真正的价格区间清算压力)78`cg_liquidation_analysis` 返回全0,不可用。正确做法是直接调 API:910```python11from tools._api import cg_request1213# 全市场聚合热力图(推荐,无需指定交易所)14# range 支持: 12h, 24h, 3d, 7d, 30d, 90d, 180d, 1y15data = cg_request("api/futures/liquidation/aggregated-heatmap/model1",16 params={"symbol": "BTC", "range": "24h"})1718# 返回结构:19# data["y_axis"] → 价格档位列表(从低到高)20# data["liquidation_leverage_data"] → [[y_idx, leverage, usd_value], ...]21# data["price_candlesticks"] → OHLCV K线,最后一根收盘价 = 当前价22# data["update_time"] → 更新时间戳2324# 解析方法:25from collections import defaultdict26y_axis = data["y_axis"]27current_price = float(data["price_candlesticks"][-1][4])28price_liq = defaultdict(float)29for y_idx, leverage, usd_val in data["liquidation_leverage_data"]:30 if 0 <= y_idx < len(y_axis):31 price_liq[y_axis[y_idx]] += usd_val3233longs = {p: v for p, v in price_liq.items() if p < current_price} # 多头清算(↓触发)34shorts = {p: v for p, v in price_liq.items() if p > current_price} # 空头清算(↑触发)35```3637注意:单交易所版本(`heatmap/model1` 带 exchange 参数)当前会报 400 错误,改用 aggregated 版本。3839## Script Usage4041Script-mode skill — read this file, then invoke from a `bash` block:4243```bash44python3 - <<'EOF'45import sys, json46sys.path.insert(0, "/data/workspace/skills/coinglass")47from exports import funding_rate, cg_open_interest, cg_liquidations4849print(funding_rate(symbol="BTC"))50print(cg_open_interest(symbol="BTC"))51EOF52```5354Read `exports.py` for the full list of available functions and exact55signatures. Common ones: `funding_rate`, `long_short_ratio`,56`cg_open_interest`, `cg_liquidations`, `cg_liquidation_analysis`,57`cg_global_account_ratio`, `cg_top_account_ratio`, `cg_top_position_ratio`,58`cg_taker_exchanges`, `cg_net_position`, `cg_supported_coins`,59`cg_supported_exchanges`, `cg_coins_market_data`, `cg_pair_market_data`,60`cg_ohlc_history`, `cg_hyperliquid_whale_alerts`,61`cg_hyperliquid_whale_positions`, `cg_taker_volume_history`,62`cg_aggregated_taker_volume`, `cg_cumulative_volume_delta`,63`cg_coin_netflow`, `cg_whale_transfers`, `cg_btc_etf_flows`,64`cg_eth_etf_flows`, `cg_sol_etf_flows`.656667# Coinglass6869Coinglass provides the most comprehensive crypto derivatives and institutional data available. 37 tools covering futures positioning, whale tracking, volume analysis, liquidations, and ETF flows.7071**API Plan**: Professional ($699/month)72**Rate Limit**: 6000 requests/minute73**API Version**: V4 (with V2 backward compatibility)74**Total Tools**: 37 across 8 categories757677## Function Reference (full signatures + return shapes)7879All functions live in `exports.py`. Most return `Optional[List[Dict]]` or80`Optional[Dict]`. None means the upstream call failed or returned empty —81always check before indexing.8283### ⚠️ Field naming convention (READ THIS FIRST)8485CoinGlass v4 API uses **camelCase** for almost all data fields, with a few86legacy snake_case exceptions in liquidation endpoints. Don't assume87snake_case — `inspect` the dict before scripting.8889- camelCase: `openInterest`, `volUsd`, `longRate`, `shortVolUsd`,90 `exchangeName`, `nextFundingTime`, `fundingIntervalHours`,91 `oichangePercent`, `h4OIChangePercent`, `avgFundingRateBySymbol`,92 `tokenAmount`, `liquidationUsd` (in some endpoints)93- snake_case (legacy, only in `cg_liquidations`): `liquidation_usd`,94 `longLiquidation_usd`, `shortLiquidation_usd`95- `rate` fields (funding) are STRINGS with "+" / "-" / "%" — parse with96 `float(r.rstrip('%').lstrip('+'))` to compare numerically97- timestamps are millisecond unix epoch (e.g. `1777881600000`)9899### Funding & Open Interest100101| Function | Signature |102|---|---|103| `funding_rate(symbol, exchange=None)` | dict — keys: `symbol`, `exchange`, `rate` (str), `num_exchanges`, `exchanges_data` (list of {`exchangeName`, `rate`, `nextFundingTime`, `fundingIntervalHours`, `status`}) |104| `cg_open_interest(symbol='BTC', interval='0')` | LIST of dicts (one per exchange) — keys: `symbol`, `openInterest`, `volUsd`, `oichangePercent`, `h4OIChangePercent`, `h24VolChangePercent`, `volChangePercent7d`, `avgFundingRateBySymbol`, `exchangeName`, `exchangeLogo` |105106### Long/Short Ratios107108| Function | Signature |109|---|---|110| `long_short_ratio(symbol='BTC', interval='h4')` | LIST — top item is aggregated; `list` field inside has per-exchange breakdown. Keys: `longRate`, `shortRate`, `longVolUsd`, `shortVolUsd`, `totalVolUsd`, `list` |111| `cg_global_account_ratio(symbol='BTC', exchange='Binance', interval='1h')` | list of historical bars |112| `cg_top_account_ratio(symbol='BTC', exchange='Binance', interval='1h')` | list — top trader account-count ratio |113| `cg_top_position_ratio(symbol='BTC', exchange='Binance', interval='1h')` | list — top trader position-size ratio |114| `cg_taker_exchanges(symbol='BTC', range_type='4h')` | list — taker buy/sell across exchanges |115| `cg_net_position(symbol='BTC', exchange='Binance', interval='1h')` | list — net long-short USD over time |116117### Liquidations118119| Function | Signature |120|---|---|121| `cg_liquidations(symbol='BTC', time_type='h24')` | LIST of dicts (one per exchange + an `'All'` row first). Keys: `exchange`, `liquidation_usd`, `longLiquidation_usd`, `shortLiquidation_usd` (NOTE: snake_case legacy fields) |122| `cg_liquidation_analysis(symbol='BTC', time_type='h24')` | dict — aggregated network-wide stats |123| `cg_coin_liquidation_history(symbol='BTC', interval='h4')` | list — historical liq bars |124| `cg_pair_liquidation_history(symbol='BTC', exchange='Binance', interval='h4')` | list — historical liq for one pair on one exchange |125| `cg_liquidation_coin_list(symbol=None)` | list of all coins with liq summary |126| `cg_liquidation_orders(symbol='BTC', exchange=None)` | list — recent individual liq orders |127128### Futures Market Data129130| Function | Signature |131|---|---|132| `cg_supported_coins()` | List[str] — symbols supported by CoinGlass |133| `cg_supported_exchanges()` | list of exchange info dicts |134| `cg_coins_market_data(symbol=None)` | list — current snapshot for all coins (or one if symbol given) |135| `cg_pair_market_data(symbol='BTC', exchange=None)` | list — pair-level snapshot |136| `cg_ohlc_history(symbol='BTC', interval='h4', exchange=None)` | list of OHLCV bars |137138### Hyperliquid Whale Tracking139140| Function | Signature |141|---|---|142| `cg_hyperliquid_whale_alerts()` | list — recent large-position alerts |143| `cg_hyperliquid_whale_positions()` | list — current open whale positions |144| `cg_hyperliquid_positions_by_coin(symbol='BTC')` | list — whales holding a specific coin |145| `cg_hyperliquid_position_distribution(symbol='BTC')` | dict — long/short position-size distribution |146147### Volume / Flow148149| Function | Signature |150|---|---|151| `cg_taker_volume_history(symbol='BTC', exchange='Binance', interval='1h', limit=1000, start_time=None, end_time=None)` | list — taker buy/sell volume bars |152| `cg_aggregated_taker_volume(symbol='BTC', interval='h4')` | list — aggregated across all exchanges |153| `cg_cumulative_volume_delta(symbol='BTC', exchange='Binance', interval='1h', limit=1000, start_time=None, end_time=None)` | list — CVD bars |154| `cg_coin_netflow(symbol=None)` | list — net inflow/outflow per coin |155| `cg_whale_transfers()` | dict — recent on-chain large transfers |156157### ETF Flows158159| Function | Signature |160|---|---|161| `cg_btc_etf_flows()` | list — daily flows per US BTC ETF |162| `cg_btc_etf_history(etf_ticker=None)` | list — historical AUM/flows |163| `cg_btc_etf_list()` | list of BTC ETF tickers + AUM |164| `cg_btc_etf_premium_discount()` | list — premium/discount % vs NAV |165| `cg_hk_btc_etf_flows()` | list — Hong Kong BTC ETF flows |166| `cg_eth_etf_flows()` / `cg_eth_etf_list()` / `cg_eth_etf_premium_discount()` / `cg_hk_eth_etf_flows()` | ETH ETF equivalents |167| `cg_sol_etf_flows()` / `cg_sol_etf_list()` | SOL ETF data |168| `cg_xrp_etf_flows()` / `cg_xrp_etf_list()` | XRP ETF data |169170### Sample responses (most-used functions)171172`funding_rate(symbol="BTC")`:173```json174{175 "symbol": "BTC",176 "exchange": "average",177 "rate": "-0.0016%",178 "num_exchanges": 21,179 "exchanges_data": [180 {"exchangeName": "Binance", "rate": "+0.0050%",181 "nextFundingTime": 1777881600000, "fundingIntervalHours": 8, "status": 1}182 ]183}184```185186`cg_liquidations(symbol="BTC", time_type="h24")`:187```json188[189 {"exchange": "All", "liquidation_usd": 170497688.16,190 "longLiquidation_usd": 8179073.80, "shortLiquidation_usd": 162318614.36},191 {"exchange": "Bybit", "liquidation_usd": 40454694.98, ...}192]193```194195`cg_open_interest(symbol="BTC")`:196```json197[198 {"symbol": "BTC", "openInterest": 61395303653.62, "volUsd": 56349328748.42,199 "oichangePercent": 7.17, "h4OIChangePercent": 5.33,200 "avgFundingRateBySymbol": -0.001874, "exchangeName": "Binance"}201]202```203204`long_short_ratio(symbol="BTC", interval="h4")`:205```json206[{207 "symbol": "BTC", "longRate": 53.65, "shortRate": 46.35,208 "longVolUsd": 12558668895.91, "shortVolUsd": 10848776476.99,209 "totalVolUsd": 23407445372.91,210 "list": [211 {"exchangeName": "Binance", "longRate": 55.75, "shortRate": 44.25, ...}212 ]213}]214```215216217## Tool Selection Guide218219### Decision Tree220221**Step 1: Is this about LIQUIDATIONS?**222223```224Liquidation query?225├─ YES → How many coins?226│ ├─ ALL coins / ranking / 排行 / 汇总227│ │ └─ → cg_liquidation_coin_list ✅ (most liquidation queries land here)228│ ├─ ONE coin, need history over time229│ │ └─ → cg_coin_liquidation_history230│ ├─ ONE coin, specific orders (price/side/USD)231│ │ └─ → cg_liquidation_orders232│ └─ ONE coin, just a quick total + sentiment label233│ └─ → cg_liquidation_analysis (rarely needed; only if explicitly "simple summary")234```235236**Step 2: Is this about LONG/SHORT RATIO?**237238```239Long/short query?240├─ Historical time-series, trend over time, 多空比变化241│ └─ → cg_global_account_ratio (ALL accounts)242│ or cg_top_account_ratio (top traders only)243│ or cg_top_position_ratio (by position size)244└─ Current snapshot only (no history needed)245 └─ → long_short_ratio246```247248**Step 3: Is this about OPEN INTEREST?**249250```251OI query?252└─ → cg_open_interest (always — do NOT use cg_coins_market_data for OI)253```254255**Step 4: Is this a MARKET OVERVIEW / SENTIMENT query?**256257```258Sentiment / 市场情绪 / pre-trade check?259└─ Use: funding_rate + long_short_ratio + cg_open_interest260 DO NOT use cg_coins_market_data as a substitute for any of the above261```262263---264265### Keyword → Tool Lookup266267| Keyword / Pattern | Correct Tool | ❌ Do NOT use |268|---|---|---|269| 爆仓排行 / 今日爆仓 / all coins liquidation | `cg_liquidation_coin_list` | `cg_liquidations` |270| 24h爆仓汇总 / liquidation summary | `cg_liquidation_coin_list` | `cg_liquidation_analysis` |271| 全网账户多空比 / account L/S ratio | `cg_global_account_ratio` | `long_short_ratio` |272| 头部交易者多空 / top trader ratio | `cg_top_account_ratio` | `long_short_ratio` |273| 未平仓合约 / open interest | `cg_open_interest` | `cg_coins_market_data` |274| 市场情绪多空分析 | `funding_rate` + `long_short_ratio` + `cg_open_interest` | `cg_coins_market_data` |275| BTC做多检查 / pre-trade checklist | `funding_rate` + `cg_global_account_ratio` + `cg_liquidation_coin_list` | — |276277---278279### Common Mistakes280281**Mistake 1 (most common — 8x failure): Using `cg_liquidations` when you need `cg_liquidation_coin_list`**282- `cg_liquidations` → one coin, one timeframe, basic total only283- `cg_liquidation_coin_list(exchange)` → ALL coins, multi-timeframe (1h/4h/12h/24h), per-exchange breakdown284- **Rule:** If the question asks for a ranking, overview, or doesn't specify a single coin → use `cg_liquidation_coin_list`285286**Mistake 2 (5x failure): Using `cg_liquidation_analysis` for liquidation rankings**287- `cg_liquidation_analysis` adds a sentiment label to a single-coin total — it is NOT a ranking tool288- **Rule:** "今日爆仓排行" / "各币种爆仓" → always `cg_liquidation_coin_list`289290**Mistake 3 (3x failure): Using `long_short_ratio` for historical L/S analysis**291- `long_short_ratio` is a current snapshot (no time-series)292- `cg_global_account_ratio` returns history — use it when the user wants trends or comparison over time293- **Rule:** If the question compares 全网 (global) vs 头部 (top traders) → call BOTH `cg_global_account_ratio` AND `cg_top_account_ratio`294295**Mistake 4 (2x failure): Using `cg_coins_market_data` for open interest**296- `cg_coins_market_data` is a bulk snapshot of many coins — not a replacement for dedicated OI or L/S tools297- **Rule:** OI question → `cg_open_interest`. L/S question → `long_short_ratio` or `cg_global_account_ratio`. Never route either to `cg_coins_market_data`.298299## Rules300301### Tool Call Guidance302303**❌ FORBIDDEN TOOLS — NEVER USE:**304- `bash` — Do NOT write scripts to process/format data. Use natural language.305- `write_file` / `read_file` / `edit_file` — Do NOT save intermediate data. Answer directly.306- `learning_log` — ONLY for genuine skill bugs or persistent API errors. NOT for empty responses.307- `echo` — Do NOT use for debugging or output.308309**✅ CORRECT PATTERN:**310- Tool returns data → Summarize in natural language → Done311- Tool returns empty/null → Report "no data available" → Done312- Need calculation (%, change, ratio) → Do mental math in reply313314**Match tool count to question scope:**315 - 单一指标问题("BTC 资金费率"、"ETH 多空比")→ 1 个工具,直接返回316 - 多维度分析("做多是否合适"、"衍生品体检")→ 3-5 个工具,综合分析317 - 对比问题("ETH vs SOL")→ 每个币种调相同工具,并列对比318- **避免重复调用同一工具。** 除非用户明确要求不同币种/交易所的对比。319320### Learning Log Usage (CRITICAL)321322**`learning_log` is FORBIDDEN for:**323- ❌ Empty API responses — just report "no data available"324- ❌ Tool returning None/null — handle gracefully325- ❌ Uncertainty about tool selection — check decision tree first326- ❌ Normal tool errors — retry once, then report failure327328**`learning_log` is ONLY for:**329- ✅ Genuine bugs in skill code (wrong data format returned)330- ✅ Persistent API rate limit errors after 2+ retries331- ✅ Missing tools that should exist per skill definition332333### ETF Tool Selection334| Query | Primary Tool | Secondary Tool |335|-------|--------------|----------------|336| BTC ETF 资金流入/流出 | `cg_btc_etf_flows()` | `cg_btc_etf_history()` for detailed history |337| ETH ETF 资金流入/流出 | `cg_eth_etf_flows()` | — |338| SOL/XRP ETF flows | `cg_sol_etf_flows()` / `cg_xrp_etf_flows()` | — |339| HK ETF flows | `cg_hk_btc_etf_flows()` / `cg_hk_eth_etf_flows()` | — |340| ETF 列表/代码 | `cg_btc_etf_list()` / `cg_eth_etf_list()` | — |341| ETF 溢价/折价 | `cg_btc_etf_premium_discount()` | — |342343**ETF 对比问题 workflow:**344```345# BTC vs ETH ETF 对比346btc = cg_btc_etf_flows()347eth = cg_eth_etf_flows()348# Compare the latest day's net flows, summarize in 2-3 sentences349```350351## Quick Routing (use this first)352353| Query type | Tool |354|---|---|355| 爆仓/liquidation summary (24h, by coin) | `cg_liquidation_coin_list` |356| Individual liquidation orders | `cg_liquidation_orders` |357| Liquidation history for a coin | `cg_coin_liquidation_history` |358| Funding rate | `funding_rate` |359| Long/short ratio (global) | `cg_global_account_ratio` |360| Open interest | `cg_open_interest` |361| Whale activity on Hyperliquid | `cg_hyperliquid_whale_alerts` |362| ETF flows (BTC) | `cg_btc_etf_flows` |363364## When to Use Coinglass365366Use Coinglass for:367- **Derivatives positioning** - What are leveraged traders doing?368- **Whale tracking** - Track large positions on Hyperliquid DEX369- **Funding rates** - Cost of holding perpetual futures370- **Open interest** - Total notional value of open positions371- **Long/Short ratios** - Sentiment among leveraged traders (global, top accounts, top positions)372- **Liquidations** - Forced position closures with heatmaps and individual orders373- **Volume analysis** - Taker volume, CVD, netflow patterns374- **ETF flows** - Institutional adoption (Bitcoin, Ethereum, Solana, XRP, Hong Kong)375- **Whale transfers** - Large on-chain movements (>$10M)376- **Futures market data** - Supported coins, exchanges, pairs, and OHLC price history377378## Tool Categories379380### 1. Basic Derivatives Analytics (7 tools)381382Core derivatives data for market analysis:383384- `funding_rate(symbol, exchange?)` - Current funding rates385- `long_short_ratio(symbol, exchange?, interval?)` - Basic L/S ratios386- `cg_open_interest(symbol)` - Current OI across exchanges387- `cg_liquidations(symbol, time?)` - Recent liquidations388- `cg_liquidation_analysis(symbol)` - Liquidation heatmap analysis389- `cg_supported_coins()` - All supported coins390- `cg_supported_exchanges()` - All exchanges with pairs391392### 2. Advanced Long/Short Ratios (6 tools)393394Deep positioning analysis with multiple metrics:395396- `cg_global_account_ratio(symbol, interval?)` - Global account-based L/S ratio397- `cg_top_account_ratio(symbol, exchange, interval?)` - Top trader accounts ratio398- `cg_top_position_ratio(symbol, exchange, interval?)` - Top positions by size399- `cg_taker_exchanges(symbol)` - Taker buy/sell by exchange400- `cg_net_position(symbol, exchange)` - Net long/short positions401- `cg_net_position_v2(symbol)` - Enhanced net position data402403**Use cases**:404- Smart money tracking (top accounts vs retail)405- Exchange-specific sentiment406- Position size distribution analysis407408### 3. Advanced Liquidations (4 tools)409410Granular liquidation tracking for cascade prediction:411412- `cg_coin_liquidation_history(symbol, interval?, limit?, start_time?, end_time?)` - Aggregated across all exchanges413- `cg_pair_liquidation_history(symbol, exchange, interval?, limit?, start_time?, end_time?)` - Exchange-specific pair414- `cg_liquidation_coin_list(exchange)` - All coins on an exchange415- `cg_liquidation_orders(symbol, exchange, min_liquidation_amount, start_time?, end_time?)` - Individual orders (past 7 days, max 200)416417**Use cases**:418- Identifying liquidation clusters419- Tracking liquidation patterns over time420- Finding large liquidation events421422### 4. Hyperliquid Whale Tracking (4 tools)423424Track large traders on Hyperliquid DEX (~200 recent alerts):425426- `cg_hyperliquid_whale_alerts()` - Recent large position opens/closes (>$1M)427- `cg_hyperliquid_whale_positions()` - Current whale positions with PnL428- `cg_hyperliquid_positions_by_coin()` - All positions grouped by coin429- `cg_hyperliquid_position_distribution()` - Distribution by size with sentiment430431**Use cases**:432- Following smart money on Hyperliquid433- Detecting large position changes434- Tracking whale PnL and sentiment435436### 5. Futures Market Data (5 tools)437438Market overview and price data:439440- `cg_coins_market_data()` - ALL coins data in one call (100+ coins)441- `cg_pair_market_data(symbol, exchange)` - Specific pair metrics442- `cg_ohlc_history(symbol, exchange, interval, limit?)` - OHLC candlesticks443- `cg_taker_volume_history(symbol, exchange, interval, limit?, start_time?, end_time?)` - Pair-specific taker volume444- `cg_aggregated_taker_volume(symbol, interval, limit?, start_time?, end_time?)` - Aggregated across exchanges445446**Use cases**:447- Market screening (scan all coins at once)448- Price action analysis449- Volume pattern recognition450451### 6. Volume & Flow Analysis (4 tools)452453Order flow and capital movement tracking:454455- `cg_cumulative_volume_delta(symbol, exchange, interval, limit?, start_time?, end_time?)` - CVD = Running total of (buy - sell)456- `cg_coin_netflow()` - Capital flowing into/out of coins457- `cg_whale_transfers()` - Large on-chain transfers (>$10M, past 6 months)458459**Use cases**:460- Order flow divergence detection461- Smart money tracking462- Institutional movement monitoring463464### 7. Bitcoin ETF Data (5 tools)465466Track institutional Bitcoin adoption:467468- `cg_btc_etf_flows()` - Daily net inflows/outflows469- `cg_btc_etf_premium_discount()` - ETF price vs NAV470- `cg_btc_etf_history()` - Comprehensive history (price, NAV, premium%, shares, assets)471- `cg_btc_etf_list()` - List of Bitcoin ETFs472- `cg_hk_btc_etf_flows()` - Hong Kong Bitcoin ETF flows473474**Use cases**:475- Institutional demand tracking476- Premium/discount arbitrage477- Regional flow comparison (US vs Hong Kong)478479### 8. Other ETF Data (8 tools)480481Ethereum, Solana, XRP, and Hong Kong ETFs:482483- `cg_eth_etf_flows()` - Ethereum ETF flows484- `cg_eth_etf_list()` - Ethereum ETF list485- `cg_eth_etf_premium_discount()` - ETH ETF premium/discount486- `cg_sol_etf_flows()` - Solana ETF flows487- `cg_sol_etf_list()` - Solana ETF list488- `cg_xrp_etf_flows()` - XRP ETF flows489- `cg_xrp_etf_list()` - XRP ETF list490- `cg_hk_eth_etf_flows()` - Hong Kong Ethereum ETF flows491492**Use cases**:493- Multi-asset institutional tracking494- Comparative flow analysis495- Regional preference analysis496497## Common Workflows498499### Quick Market Scan500```501# Get everything in 3 calls502all_coins = cg_coins_market_data() # 100+ coins with full metrics503btc_liquidations = cg_liquidations("BTC")504whale_alerts = cg_hyperliquid_whale_alerts()505```506507### Deep Position Analysis508```509# BTC positioning across metrics510cg_global_account_ratio("BTC") # Retail sentiment511cg_top_account_ratio("BTC", "Binance") # Smart money512cg_net_position_v2("BTC") # Net positioning513cg_liquidation_heatmap("BTC", "Binance") # Cascade levels514```515516### ETF Flow Monitoring517```518# Institutional demand519btc_flows = cg_btc_etf_flows()520eth_flows = cg_eth_etf_flows()521sol_flows = cg_sol_etf_flows()522```523524### Whale Tracking525```526# Follow the whales527hyperliquid_whales = cg_hyperliquid_whale_alerts()528whale_positions = cg_hyperliquid_whale_positions()529onchain_whales = cg_whale_transfers() # >$10M on-chain530```531532### Volume Analysis533```534# Order flow535cvd = cg_cumulative_volume_delta("BTC", "Binance", "1h", 100)536netflow = cg_coin_netflow() # All coins537taker_vol = cg_aggregated_taker_volume("BTC", "1h", 100)538```539540## Interpretation Guides541542### Funding Rates543544| Rate (8h) | Read |545|------------|------|546| > +0.05% | Extreme greed — crowded long, squeeze risk |547| +0.01% to +0.05% | Bullish bias, normal |548| -0.005% to +0.01% | Neutral |549| -0.05% to -0.005% | Bearish bias, normal |550| < -0.05% | Extreme fear — crowded short, bounce risk |551552Extreme funding often precedes reversals. The crowd is usually wrong at extremes.553554### Open Interest + Price Matrix555556| OI | Price | Read |557|----|-------|------|558| Up | Up | New longs entering — bullish conviction |559| Up | Down | New shorts entering — bearish conviction |560| Down | Up | Short covering — weaker rally, less conviction |561| Down | Down | Long liquidation — weaker selloff, capitulation |562563### Long/Short Ratio564565| Ratio | Read |566|-------|------|567| > 1.5 | Crowded long — contrarian bearish |568| 1.1–1.5 | Moderately bullish |569| 0.9–1.1 | Balanced |570| 0.7–0.9 | Moderately bearish |571| < 0.7 | Crowded short — contrarian bullish |572573### CVD (Cumulative Volume Delta)574575| Pattern | Read |576|---------|------|577| CVD rising, price rising | Strong buy pressure, healthy uptrend |578| CVD falling, price rising | Weak rally, distribution |579| CVD rising, price falling | Accumulation, potential bottom |580| CVD falling, price falling | Strong sell pressure, healthy downtrend |581582### ETF Flows583584| Flow | Read |585|------|------|586| Large inflows | Institutional buying, bullish |587| Consistent inflows | Sustained demand |588| Large outflows | Institutional selling, bearish |589| Premium to NAV | High demand, bullish sentiment |590| Discount to NAV | Weak demand, bearish sentiment |591592## Analysis Patterns593594**Multi-metric confirmation**: Combine tools across categories for high-confidence signals:595- Funding + L/S ratio + liquidations = positioning extremes596- CVD + taker volume + whale alerts = smart money direction597- ETF flows + whale transfers + open interest = institutional conviction598599**Smart money vs retail**: Compare metrics to identify divergence:600- `cg_top_account_ratio` (smart money) vs `cg_global_account_ratio` (retail)601- Hyperliquid whale positions vs overall long/short ratios602603**Cascade prediction**: Use liquidation tools to predict volatility:604- `cg_coin_liquidation_history` shows liquidation patterns over time605- `cg_liquidation_orders` reveals recent forced closures606- Large liquidation events = cascade risk zones607608**Flow divergence**: Track capital movements:609- `cg_coin_netflow` shows where money is flowing610- `cg_whale_transfers` reveals large movements611- ETF flows show institutional demand612613## Performance Optimization614615### Batch vs Individual Calls616617**✅ OPTIMAL**: Use batch endpoints618```619# One call gets 100+ coins620all_coins = cg_coins_market_data()621622# One call gets all whale alerts623whales = cg_hyperliquid_whale_alerts()624625# One call gets all ETF flows626btc_etf = cg_btc_etf_flows()627```628629**❌ INEFFICIENT**: Multiple individual calls630```631# Don't do this - wastes API quota632btc = cg_pair_market_data("BTC", "Binance")633eth = cg_pair_market_data("ETH", "Binance")634sol = cg_pair_market_data("SOL", "Binance")635```636637### Query Parameters638639Most history endpoints support:640- `interval`: Time granularity (1h, 4h, 12h, 24h, etc.)641- `limit`: Number of records (default varies, max 1000)642- `start_time`: Unix timestamp (milliseconds)643- `end_time`: Unix timestamp (milliseconds)644645Example:646```647cg_coin_liquidation_history(648 symbol="BTC",649 interval="1h",650 limit=100,651 start_time=1704067200000, # 2024-01-01652 end_time=1704153600000 # 2024-01-02653)654```655656## Supported Exchanges657658Major exchanges with futures data:659- **Tier 1**: Binance, OKX, Bybit, Gate, KuCoin, MEXC660- **Traditional**: CME (Bitcoin and Ethereum futures), Coinbase661- **DEX**: Hyperliquid, dYdX, ApeX662- **Others**: Bitfinex, Kraken, HTX, BingX, Crypto.com, CoinEx, Bitget663664Use `cg_supported_exchanges()` for complete list with pair details.665666## Important Notes667668- **API Key**: Requires COINGLASS_API_KEY environment variable669- **Symbols**: Use standard symbols (BTC, ETH, SOL, etc.) - check with `cg_supported_coins()`670- **Exchanges**: Check `cg_supported_exchanges()` for full list with pairs671- **Update Frequency**:672 - Market data: ≤ 1 minute673 - Funding rates: Every 8 hours (or 1 hour for some exchanges)674 - OHLC: Real-time to 1 minute depending on interval675 - ETF data: Daily (after market close)676 - Whale transfers: Real-time (within minutes)677- **API Versions**:678 - V4 endpoints use `CG-API-KEY` header (most tools)679 - V2 endpoints use `coinglassSecret` header (some legacy tools)680 - Both work with the same COINGLASS_API_KEY environment variable681- **Rate Limits**: Professional plan allows 6000 requests/minute682- **Historical Data Limits**:683 - Liquidation orders: Past 7 days, max 200 records684 - Whale transfers: Past 6 months, minimum $10M685 - Hyperliquid alerts: ~200 most recent large positions686 - Other endpoints: Typically months to years of history687688## Data Quality Notes689690- **Hyperliquid**: Data is exchange-specific, doesn't include other DEXs691- **Whale Transfers**: Covers Bitcoin, Ethereum, Tron, Ripple, Dogecoin, Litecoin, Polygon, Algorand, Bitcoin Cash, Solana692- **ETF Data**: US ETFs updated after market close (4 PM ET), Hong Kong ETFs updated after Hong Kong market close693- **Liquidation Orders**: Limited to 200 most recent, use heatmap for broader view694- **CVD**: Cumulative metric - resets are not automatic, track changes not absolute values695696## Version History697698- **v3.0.0** (2025-03): Added 36 new tools699 - Advanced liquidations (5 tools)700 - Hyperliquid whale tracking (5 tools)701 - Volume & flow analysis (5 tools)702 - Whale transfers (1 tool)703 - Bitcoin ETF (6 tools)704 - Other ETFs (8 tools)705 - Advanced L/S ratios (6 tools)706- **v2.2.0** (2024): V4 API migration with futures market data707- **v1.0.0** (2024): Initial release with basic derivatives data