jpskill.com
🛠️ 開発・MCP コミュニティ

coingecko-api

CoinGeckoのAPIを活用し、13,000以上の暗号資産に関する世界的な市場統計、過去の価格データ、取引量、トレンド、カテゴリなどを分析し、暗号資産市場のマクロ分析や長期的な動向把握に役立つ情報を提供する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.

🇯🇵 日本人クリエイター向け解説

一言でいうと

CoinGeckoのAPIを活用し、13,000以上の暗号資産に関する世界的な市場統計、過去の価格データ、取引量、トレンド、カテゴリなどを分析し、暗号資産市場のマクロ分析や長期的な動向把握に役立つ情報を提供するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o coingecko-api.zip https://jpskill.com/download/10398.zip && unzip -o coingecko-api.zip && rm coingecko-api.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10398.zip -OutFile "$d\coingecko-api.zip"; Expand-Archive "$d\coingecko-api.zip" -DestinationPath $d -Force; ri "$d\coingecko-api.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して coingecko-api.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → coingecko-api フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

CoinGecko API Skill

包括的な暗号資産市場データ(価格、過去のチャート、取引所の出来高、トレンドのトークン、グローバルな統計、カテゴリ別の内訳など)について、CoinGecko API にクエリを実行します。 無料の階層では API キーは不要で、30 回/分の呼び出しをサポートします。

この Skill の使用に適した場面

  • マクロ分析: グローバルな時価総額、BTC ドミナンス、総出来高のトレンド
  • 過去データ: 数年分の過去の日次/時間足の OHLCV データ (分単位のデータではありません)
  • 取引所間の比較: 取引所の出来高ランキングとトラストスコア
  • トレンド/発見: 過去 24 時間で CoinGecko でトレンドになっているトークン
  • カテゴリ分析: DeFi、L1、ミームコインの時価総額の比較
  • トークンリサーチ: リンク、説明、コミュニティ統計などの完全なメタデータ

リアルタイムの Solana DEX データ、新しいトークンのローンチ、または Solana トークンの日足未満の粒度が必要な場合は、代わりに Birdeye または DexScreener を使用してください。

クイックスタート

現在の価格を取得する

import httpx

# 無料の階層では API キーは不要です
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}%)")

時価総額上位のコインを取得する

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}%")

過去の価格データを取得する

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())

OHLC ローソク足データを取得する

import httpx

resp = httpx.get(
    "https://api.coingecko.com/api/v3/coins/solana/ohlc",
    params={"vs_currency": "usd", "days": "30"},
)
# [[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}")

グローバルな市場統計

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']:,}")

トレンドのコイン

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']})")

認証

無料の階層では API キーは不要です (30 回/分)。より高い制限が必要な場合は、https://www.coingecko.com/en/api/pricing から Pro キーを取得して、以下を設定します。

export COINGECKO_API_KEY="CG-xxxxxxxxxxxxxxxxxxxx"

Pro リクエストでは、異なるベース URL とヘッダーを使用します。

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 = {}

レート制限

無料の階層: 30 リクエスト/分。429 レスポンスに対してバックオフを実装します。

import time, httpx

def cg_get(url: str, params: dict, max_retries: int = 3) -> dict:
    """レート制限時にリトライする GET."""
    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")

CoinGecko トークン ID の検索

CoinGecko は、スラグ形式の ID (例: solanabitcoinusd-coin) を使用します。 コントラクトアドレスまたは名前から ID を見つけるには、references/id_mapping.md を参照してください。

コントラクトアドレスによるクイックルックアップ (Solana トークンに便利):

import httpx

# Solana コントラクトアドレスで検索
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']}")

主な制限事項

  • リアルタイムデータなし: 価格は無料の階層では 1 ~ 2 分ごとに更新されます
  • Solana のカバレッジが限定的: 多くの新しい Solana トークンはリストされていません
  • OHLC の粒度: 1/7/14/30/90/180/365 日のウィンドウのみ、ローソク足のサイズはウィンドウによって異なります ( references/endpoints.md を参照)
  • 過去のギャップ: 一部のトークンには、初期の期間のデータがありません
  • 無料の階層のスロットリング: 30 req/分は、バッチ処理に慎重なペースが必要であることを意味します

データのギャップと階層の違いに関する詳細なメモについては、references/data_quality.md を参照してください。

ファイル

参考文献

  • references/endpoints.md — パラメータ、レスポンススキーマ、およびレート制限を含む完全なエンドポイントリファレンス
  • references/id_mapping.md — トークンの CoinGecko ID の検索方法、コントラクトアドレスのマッピング、検索のヒント
  • references/data_quality.md — データの品質に関するメモ、過去のギャップ、無料階層と Pro 階層の違い

スクリプト

  • scripts/fetch_market_data.py — 上位のコイン、トレンドのトークン、およびグローバルな統計を取得します ( --demo モードをサポート)
  • scripts/historical_analysis.py — 過去の OHLCV データを取得します。

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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
  • references/id_mapping.md — How to find CoinGecko IDs for tokens, contract address mapping, search tips
  • references/data_quality.md — Data quality notes, historical gaps, free vs pro tier differences

Scripts

  • scripts/fetch_market_data.py — Fetch top coins, trending tokens, and global stats (supports --demo mode)
  • scripts/historical_analysis.py — Fetch historical OHLCV data and compute returns, volatility, drawdown (supports --demo mode)