---
title: Coinglass Skill for Claude Code
canonical: https://skillselion.com/skills/starchild-ai-agent/official-skills/coinglass
content_type: text/markdown
description: "Coinglass is a Python-invocable API skill providing 37 tools to query crypto derivatives positioning (funding rates, open interest, long/short ratios)."
---

# Coinglass Skill

Title: Coinglass Skill for Claude Code

> Coinglass is a Python-invocable API skill providing 37 tools to query crypto derivatives positioning (funding rates, open interest, long/short ratios).

Canonical: https://skillselion.com/skills/starchild-ai-agent/official-skills/coinglass

Coinglass is a Python-invocable API skill providing 37 tools to query crypto derivatives positioning (funding rates, open interest, long/short ratios), liquidations with price-level heatmaps, whale positions on Hyperliqu

Coinglass provides 37 tools spanning derivatives analytics, liquidation heatmaps, long/short ratios, whale tracking on Hyperliquid, volume/flow analysis, and ETF flows (BTC/ETH/SOL/XRP). Developers integrate this via Python exports (funding_rate, cg_liquidations, cg_open_interest, etc.) to monitor leveraged trader positioning across 20+ exchanges, track forced liquidations with price-level granularity, follow institutional movements via whale alerts and on-chain transfers, and measure institutional Bitcoin/Ethereum adoption through US and Hong Kong ETF flows. Common workflows combine 3-5 tools for multi-metric confirmation: funding rates + long/short ratios + liquidation heatmaps reveal positioning extremes; CVD + taker volume + whale alerts signal smart money direction; ETF flows + whale transfers + open interest track institutional conviction.

## Key facts

- Installs: 11,484
- GitHub stars: 33
- Author: Starchild-ai-agent
- Repository: Starchild-ai-agent/official-skills
- Install command: `npx skills add https://github.com/Starchild-ai-agent/official-skills --skill coinglass`
- Last updated: November 16, 2026

## What Coinglass does

Query crypto derivatives positioning, liquidations, whale tracking, and ETF flows to monitor market sentiment and institutional adoption.

Crypto traders and risk analysts lack unified access to derivatives positioning data, liquidation cascades, smart money moves, and institutional adoption signals across 20+ exchanges and DEXs; scattered API sources and p

Developers query Coinglass once to retrieve multi-exchange derivatives snapshots, historical liquidation patterns, whale position alerts, and ETF inflow/outflow trends; combine 3-5 tools for high-confidence positioning e

Best for: Crypto derivatives traders monitoring leveraged positioning and liquidation risk,Quant analysts building market sentiment and institutional flow indicators,Risk managers tracking whale positions and cascade liquidation z

Not for: Spot market trading (no spot order book or real-time tickers),Traditional stock/options markets,Non-crypto assets,Traders requiring sub-second execution data

- 37 tools across 8 categories: funding rates, open interest, 6 long/short ratio variants, liquidation heatmaps with price
- Liquidation heatmap via cg_liquidation_analysis returns aggregated price zones with USD liquidation pressure by leverage
- cg_global_account_ratio + cg_top_account_ratio separate retail vs smart money sentiment with historical time-series for 
- Hyperliquid whale tracking (cg_hyperliquid_whale_alerts, cg_hyperliquid_whale_positions) covers ~200 recent large positi
- ETF flows (cg_btc_etf_flows, cg_eth_etf_flows, cg_sol_etf_flows) track institutional adoption daily; premium/discount vs

## SKILL.md

### Liquidation Heatmap（真正的价格区间清算压力）

`cg_liquidation_analysis` 返回全0，不可用。正确做法是直接调 API：

```python
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:

```bash
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")`:
```json
{
  "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")`:
```json
[
  {"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")`:
```json
[
  {"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")`:
```json
[{
  "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

Excerpt. The rest of the file is on the canonical page and in the source repository.

## Coinglass FAQ

### How do I distinguish smart money (top traders) from retail sentiment?

Use cg_top_account_ratio(symbol, exchange, interval) for top-trader positions and cg_global_account_ratio(symbol, interval) for all accounts. Plot both on the same timeline; divergence = smart money positioning differently from retail.

### How do I predict liquidation cascades?

Call cg_liquidation_analysis(symbol) to see aggregated USD liquidation pressure at each price level (from the liquidation heatmap). Large USD clusters at narrow price zones = high cascade risk if price approaches those levels.

### What is the difference between cg_liquidations and cg_liquidation_coin_list?

cg_liquidations(symbol, time_type) returns a single coin's total liquidations for one exchange in one timeframe. cg_liquidation_coin_list(exchange) returns ALL coins' liquidations ranked, with multi-timeframe support and per-exchange breakdown - use the latter for 'today's top liqu

### Is Coinglass safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

## Machine access

- [Sitemap](https://skillselion.com/sitemap.xml)
- [llms.txt](https://skillselion.com/llms.txt)
- [llms-full.txt](https://skillselion.com/llms-full.txt)
- [Developer resources](https://skillselion.com/developers)
- [OpenAPI spec](https://skillselion.com/openapi.json)
- [MCP handshake](https://skillselion.com/.well-known/mcp)
- [API catalog](https://skillselion.com/.well-known/api-catalog)
- [AI catalog](https://skillselion.com/.well-known/ai-catalog.json)
- [Pricing](https://skillselion.com/pricing.md)
- [Auth](https://skillselion.com/auth.md)
- [AGENTS.md](https://skillselion.com/AGENTS.md)
- [Contact](https://skillselion.com/contact)
- [Home](https://skillselion.com/)
