/coingecko-api
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats, historical price data going back years, exchange volumes, trending tokens, and category filters. Best for macro analysis and long-term historical data.
$ npx -y skills add agiprolabs/claude-trading-skills --skill coingecko-api --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/coingecko-api
Context preview
The summary Claude sees to decide when to auto-load this skill.
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats, historical price data going back years, exchange volumes, trending tokens, and category filters. Best for macro analysis and long-term historical data.
SKILL.md
coingecko-api.SKILL.mdname: coingecko-api
description: >
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market
stats, historical price data going back years, exchange volumes, trending tokens,
and category filters. Best for macro analysis and long-term historical data.
dependencies:
- httpx
- pandas
- numpy
tags:
- api
- market-data
- crypto
- historical
- macro
CoinGecko API Skill
Query the CoinGecko API for comprehensive crypto market data — prices, historical charts, exchange volumes, trending tokens, global stats, and category breakdowns. The free tier requires no API key and supports 30 calls/min.
When to Use This Skill
- **Macro analysis**: Global market cap, BTC dominance, total volume trends
- **Historical data**: Daily/hourly OHLCV going back years (not minutes-level)
- **Cross-exchange comparisons**: Exchange volume rankings and trust scores
- **Trending/discovery**: What tokens are trending on CoinGecko in the last 24h
- **Category analysis**: Compare DeFi vs L1 vs meme coin market caps
- **Token research**: Full metadata including links, description, community stats
Use **Birdeye** or **DexScreener** instead for real-time Solana DEX data, new token launches, or sub-daily granularity on Solana tokens.
Quick Start
Get Current Prices
import httpx
# No API key needed for free tier
resp = httpx.get(
"https://api.coingecko.com/api/v3/simple/price",
params={"ids": "solana,bitcoin,ethereum", "vs_currencies": "usd",
"include_24hr_change": "true"},
)
data = resp.json()
for coin, info in data.items():
print(f"{coin}: ${info['usd']:.2f} ({info['usd_24h_change']:+.1f}%)")Get Top Coins by Market Cap
import httpx
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/markets",
params={"vs_currency": "usd", "order": "market_cap_desc",
"per_page": 10, "page": 1, "sparkline": "false"},
)
for coin in resp.json():
print(f"{coin['symbol'].upper():>6} ${coin['current_price']:>10,.2f} "
f"MCap: ${coin['market_cap']/1e9:.1f}B "
f"24h: {coin['price_change_percentage_24h']:+.1f}%")Get Historical Price Data
import httpx
import pandas as pd
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/market_chart",
params={"vs_currency": "usd", "days": "90", "interval": "daily"},
)
data = resp.json()
df = pd.DataFrame(data["prices"], columns=["timestamp", "price"])
df["date"] = pd.to_datetime(df["timestamp"], unit="ms")
df = df.set_index("date").drop(columns=["timestamp"])
print(df.describe())Get OHLC Candle Data
import httpx
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/ohlc",
params={"vs_currency": "usd", "days": "30"},
)
# Returns [[timestamp, open, high, low, close], ...]
candles = resp.json()
for c in candles[-5:]:
print(f" O={c[1]:.2f} H={c[2]:.2f} L={c[3]:.2f} C={c[4]:.2f}")Global Market Stats
import httpx
resp = httpx.get("https://api.coingecko.com/api/v3/global")
g = resp.json()["data"]
print(f"Total Market Cap: ${g['total_market_cap']['usd']/1e12:.2f}T")
print(f"24h Volume: ${g['total_volume']['usd']/1e9:.0f}B")
print(f"BTC Dominance: {g['market_cap_percentage']['btc']:.1f}%")
print(f"Active Coins: {g['active_cryptocurrencies']:,}")Trending Coins
import httpx
resp = httpx.get("https://api.coingecko.com/api/v3/search/trending")
for item in resp.json()["coins"]:
coin = item["item"]
print(f"#{coin['market_cap_rank'] or '?':>4} {coin['name']} ({coin['symbol']})")Authentication
The free tier requires no API key (30 calls/min). For higher limits, get a Pro key from https://www.coingecko.com/en/api/pricing and set:
export COINGECKO_API_KEY="CG-xxxxxxxxxxxxxxxxxxxx"
Pro requests use a different base URL and header:
import os, httpx
API_KEY = os.getenv("COINGECKO_API_KEY", "")
if API_KEY:
BASE_URL = "https://pro-api.coingecko.com/api/v3"
HEADERS = {"x-cg-pro-api-key": API_KEY}
else:
BASE_URL = "https://api.coingecko.com/api/v3"
HEADERS = {}Rate Limiting
Free tier: 30 requests/min. Implement backoff on 429 responses:
import time, httpx
def cg_get(url: str, params: dict, max_retries: int = 3) -> dict:
"""GET with retry on rate limit."""
for attempt in range(max_retries):
resp = httpx.get(url, params=params, headers=HEADERS, timeout=15.0)
if resp.status_code == 429:
wait = 2 ** attempt * 10
print(f"Rate limited, waiting {wait}s...")
time.sleep(wait)
continue
resp.raise_for_status()
return resp.json()
raise RuntimeError("Max retries exceeded")Finding CoinGecko Token IDs
CoinGecko uses slug-style IDs (e.g., `solana`, `bitcoin`, `usd-coin`). To find an ID from a contract address or name, see `references/id_mapping.md`.
Quick lookup by contract address (useful for Solana tokens):
import httpx
# Look up by Solana contract address
contract = "So11111111111111111111111111111111111111112"
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/contract/"
+ contract
)
coin = resp.json()
print(f"ID: {coin['id']}, Name: {coin['name']}")Key Limitations
- **No real-time data**: Prices update every 1-2 minutes on free tier
- **Limited Solana coverage**: Many newer Solana tokens are not listed
- **OHLC granularity**: Only 1/7/14/30/90/180/365 day windows, candle size
depends on the window (see `references/endpoints.md`)
- **Historical gaps**: Some tokens have missing data for early periods
- **Free tier throttling**: 30 req/min means batch operations need careful pacing
See `references/data_quality.md` for detailed notes on data gaps and tier differences.
Files
References
- `references/endpoints.md` — Complete endpoint reference with parameters, response schemas, and rate limits
-
Read more
name: coingecko-api description: > Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats, historical price data going back years, exchange volumes, trending tokens, and category filters. Best for macro analysis and long-term historical data. dependencies: - httpx - pandas - numpy tags: - api - market-data - crypto - historical - macro
CoinGecko API Skill
Query the CoinGecko API for comprehensive crypto market data — prices, historical charts, exchange volumes, trending tokens, global stats, and category breakdowns. The free tier requires no API key and supports 30 calls/min.
When to Use This Skill
- **Macro analysis**: Global market cap, BTC dominance, total volume trends
- **Historical data**: Daily/hourly OHLCV going back years (not minutes-level)
- **Cross-exchange comparisons**: Exchange volume rankings and trust scores
- **Trending/discovery**: What tokens are trending on CoinGecko in the last 24h
- **Category analysis**: Compare DeFi vs L1 vs meme coin market caps
- **Token research**: Full metadata including links, description, community stats
Use **Birdeye** or **DexScreener** instead for real-time Solana DEX data, new token launches, or sub-daily granularity on Solana tokens.
Quick Start
Get Current Prices
import httpx
# No API key needed for free tier
resp = httpx.get(
"https://api.coingecko.com/api/v3/simple/price",
params={"ids": "solana,bitcoin,ethereum", "vs_currencies": "usd",
"include_24hr_change": "true"},
)
data = resp.json()
for coin, info in data.items():
print(f"{coin}: ${info['usd']:.2f} ({info['usd_24h_change']:+.1f}%)")Get Top Coins by Market Cap
import httpx
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/markets",
params={"vs_currency": "usd", "order": "market_cap_desc",
"per_page": 10, "page": 1, "sparkline": "false"},
)
for coin in resp.json():
print(f"{coin['symbol'].upper():>6} ${coin['current_price']:>10,.2f} "
f"MCap: ${coin['market_cap']/1e9:.1f}B "
f"24h: {coin['price_change_percentage_24h']:+.1f}%")Get Historical Price Data
import httpx
import pandas as pd
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/market_chart",
params={"vs_currency": "usd", "days": "90", "interval": "daily"},
)
data = resp.json()
df = pd.DataFrame(data["prices"], columns=["timestamp", "price"])
df["date"] = pd.to_datetime(df["timestamp"], unit="ms")
df = df.set_index("date").drop(columns=["timestamp"])
print(df.describe())Get OHLC Candle Data
import httpx
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/ohlc",
params={"vs_currency": "usd", "days": "30"},
)
# Returns [[timestamp, open, high, low, close], ...]
candles = resp.json()
for c in candles[-5:]:
print(f" O={c[1]:.2f} H={c[2]:.2f} L={c[3]:.2f} C={c[4]:.2f}")Global Market Stats
import httpx
resp = httpx.get("https://api.coingecko.com/api/v3/global")
g = resp.json()["data"]
print(f"Total Market Cap: ${g['total_market_cap']['usd']/1e12:.2f}T")
print(f"24h Volume: ${g['total_volume']['usd']/1e9:.0f}B")
print(f"BTC Dominance: {g['market_cap_percentage']['btc']:.1f}%")
print(f"Active Coins: {g['active_cryptocurrencies']:,}")Trending Coins
import httpx
resp = httpx.get("https://api.coingecko.com/api/v3/search/trending")
for item in resp.json()["coins"]:
coin = item["item"]
print(f"#{coin['market_cap_rank'] or '?':>4} {coin['name']} ({coin['symbol']})")Authentication
The free tier requires no API key (30 calls/min). For higher limits, get a Pro key from https://www.coingecko.com/en/api/pricing and set:
export COINGECKO_API_KEY="CG-xxxxxxxxxxxxxxxxxxxx"
Pro requests use a different base URL and header:
import os, httpx
API_KEY = os.getenv("COINGECKO_API_KEY", "")
if API_KEY:
BASE_URL = "https://pro-api.coingecko.com/api/v3"
HEADERS = {"x-cg-pro-api-key": API_KEY}
else:
BASE_URL = "https://api.coingecko.com/api/v3"
HEADERS = {}Rate Limiting
Free tier: 30 requests/min. Implement backoff on 429 responses:
import time, httpx
def cg_get(url: str, params: dict, max_retries: int = 3) -> dict:
"""GET with retry on rate limit."""
for attempt in range(max_retries):
resp = httpx.get(url, params=params, headers=HEADERS, timeout=15.0)
if resp.status_code == 429:
wait = 2 ** attempt * 10
print(f"Rate limited, waiting {wait}s...")
time.sleep(wait)
continue
resp.raise_for_status()
return resp.json()
raise RuntimeError("Max retries exceeded")Finding CoinGecko Token IDs
CoinGecko uses slug-style IDs (e.g., `solana`, `bitcoin`, `usd-coin`). To find an ID from a contract address or name, see `references/id_mapping.md`.
Quick lookup by contract address (useful for Solana tokens):
import httpx
# Look up by Solana contract address
contract = "So11111111111111111111111111111111111111112"
resp = httpx.get(
"https://api.coingecko.com/api/v3/coins/solana/contract/"
+ contract
)
coin = resp.json()
print(f"ID: {coin['id']}, Name: {coin['name']}")Key Limitations
- **No real-time data**: Prices update every 1-2 minutes on free tier
- **Limited Solana coverage**: Many newer Solana tokens are not listed
- **OHLC granularity**: Only 1/7/14/30/90/180/365 day windows, candle size
depends on the window (see `references/endpoints.md`)
- **Historical gaps**: Some tokens have missing data for early periods
- **Free tier throttling**: 30 req/min means batch operations need careful pacing
See `references/data_quality.md` for detailed notes on data gaps and tier differences.
Files
References
- `references/endpoints.md` — Complete endpoint reference with parameters, response schemas, and rate limits
-
A comprehensive collection of 67 ready-to-use trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools.
Repo: agiprolabs/claude-trading-skills
Other skills on trading-skills.
- /backtrader
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators
Open skill - /birdeye-api
Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity
Open skill - /cointegration-analysis
Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis
Open skill - /copy-trading
Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading
Open skill - /correlation-analysis
Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation
Open skill - /cost-basis-engine
Multi-method cost basis computation including specific identification, FIFO, LIFO, HIFO, and proportional average cost with partial sell handling
Open skill

