Skip to content

feat(coingecko): add CoinGecko crypto adapter with 10 commands#203

Open
0xsline wants to merge 2 commits intojackwener:mainfrom
0xsline:feat/coingecko-adapter
Open

feat(coingecko): add CoinGecko crypto adapter with 10 commands#203
0xsline wants to merge 2 commits intojackwener:mainfrom
0xsline:feat/coingecko-adapter

Conversation

@0xsline
Copy link
Contributor

@0xsline 0xsline commented Mar 21, 2026

Summary

Add comprehensive CoinGecko adapter with 10 public API commands for cryptocurrency data. No authentication needed.

New Commands

Command Description Example
top Top coins by market cap opencli coingecko top --limit 10
trending Trending coins opencli coingecko trending
search Search coins opencli coingecko search --query solana
coin Detailed coin info opencli coingecko coin --id bitcoin
price Quick multi-coin price check opencli coingecko price --ids "bitcoin,ethereum,solana"
global Global market overview (top 10) opencli coingecko global
categories Coin categories by market cap opencli coingecko categories --limit 10
exchanges Top exchanges by volume opencli coingecko exchanges --limit 10
gainers Top gainers by 24h change opencli coingecko gainers --limit 10
losers Top losers by 24h change opencli coingecko losers --limit 10

Supports --currency flag for multi-currency pricing (usd, eur, aud, cny, etc.)

Test plan

  • top --limit 5 — BTC $70,613, ETH $2,153, market caps and 24h changes
  • trending — Akash Network, Zano, Bitcoin, Pudgy Penguins
  • search --query solana — SOL rank npm 包缺少 github 目录导致模块找不到错误 #7, related tokens
  • coin --id bitcoin — price, 24h/7d/30d change, ATH $126,080
  • price --ids "bitcoin,ethereum,solana" — 3 coins with price, change, market cap
  • global — top 10 coins by market cap overview
  • categories --limit 5 — Smart Contract Platform, Layer 1, PoW
  • exchanges --limit 5 — Binance, Gate, Bybit, Coinbase, OKX
  • gainers --limit 5 — Akash Network +11.69%
  • losers --limit 5 — Provenance -6.46%, Midnight -4.10%
  • Doc coverage: 50/50 adapters documented
  • All 258 existing unit tests pass (zero regression)

0xsline added 2 commits March 21, 2026 23:19
…in commands

CoinGecko (4 commands, public API, no auth needed):
- top: top cryptocurrencies by market cap with price and 24h change
- trending: trending coins on CoinGecko
- search: search for cryptocurrencies by name
- coin: detailed info for a specific coin (price, 24h/7d/30d change, ATH)

Supports multi-currency pricing via --currency flag (usd, eur, aud, etc.)
…hanges, gainers, losers

New commands:
- price: quick multi-coin price check via markets API
- global: top 10 coins by market cap overview
- categories: coin categories ranked by market cap (DeFi, Layer 1, etc.)
- exchanges: top exchanges by trading volume with trust scores
- gainers: top gaining coins by 24h change (sorted from 250 coins)
- losers: top losing coins by 24h change

All commands use public CoinGecko API, no auth needed.
@0xsline 0xsline force-pushed the feat/coingecko-adapter branch from 2b4dee5 to aa74846 Compare March 21, 2026 15:19
@0xsline 0xsline changed the title feat(coingecko): add CoinGecko crypto adapter feat(coingecko): add CoinGecko crypto adapter with 10 commands Mar 21, 2026
Copy link
Contributor

@Astro-Han Astro-Han left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good coverage of CoinGecko endpoints. Several issues, some blocking:

CoinGecko API now requires a demo API key

The public api.coingecko.com/api/v3 endpoint now requires x-cg-demo-api-key (free registration). Without it, requests are limited to 5-15 calls/min and will frequently return 401/429. The adapters have no header injection path for API keys. Consider adding a headers: config with an env var (e.g. COINGECKO_API_KEY), or at minimum document this requirement.

Unrelated files: facebook.md and instagram.md

These doc changes don't belong in a CoinGecko PR. They also change existing positional arg examples (facebook profile zuck) to named flags (--username zuck), which contradicts the actual YAML definitions (positional: true). Please revert these and submit separately.

URL encoding missing

search.yaml and price.yaml interpolate user input directly into URLs. Use params: (auto-encodes) or the urlencode filter.

global.yaml duplicates top.yaml

global calls /coins/markets?per_page=10, which is identical to top --limit 10. CoinGecko has a dedicated /global endpoint for actual market-wide stats (total market cap, BTC dominance, etc.). Consider using that instead.

losers.yaml missing filter

gainers.yaml has - filter: item.price_change_percentage_24h to remove null entries, but losers.yaml doesn't. Coins with null values will incorrectly appear at the top of the losers list.

Doc examples use --id/--query but args are positional

Same issue as #215 — YAML defines positional args correctly, but docs show --flag usage which will cause commander errors.

Missing deliverables

No README, docs/adapters/index.md, config.mts sidebar, or E2E tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants