Crypto Market Data
Give any AI agent the ability to fetch live cryptocurrency market data, analyze price trends, and generate structured reports.
Setup
Install dependencies first:
pip install -r scripts/requirements.txt
Quick Start
Get current prices:
python scripts/fetch_prices.py --coins bitcoin,ethereum
Get market overview (top coins):
python scripts/market_overview.py --top 10
Get price history with trend analysis:
python scripts/price_history.py --coin bitcoin --days 30 --analysis
Compare multiple coins:
python scripts/coin_compare.py --coins bitcoin,ethereum,solana
Decision Tree
Use this to pick the right script:
- User wants current price(s) →
scripts/fetch_prices.py - User wants a market overview or top coins →
scripts/market_overview.py - User wants historical data or trend analysis →
scripts/price_history.py - User wants to compare coins side by side →
scripts/coin_compare.py
Important Notes
- Always run scripts with
--helpfirst to see all available options. - All scripts output JSON to stdout — parse the output directly.
- Coin IDs are slugs, not ticker symbols: use
bitcoinnotBTC,ethereumnotETH. - See references/REFERENCE.md for the full coin ID mapping and API details.
- See references/EXAMPLES.md for example workflows and sample outputs.
Common Pitfalls
- Wrong coin ID: Use
bitcoinnotbtc. Runscripts/fetch_prices.py --list-coinsto search for coin IDs. - Rate limiting: CoinGecko free tier allows ~30 calls/minute. Space out large batch requests.
- Historical data: Free tier supports up to 365 days of history.
- Currency codes: Use lowercase ISO codes:
usd,eur,gbp, etc.
Dependencies
requests— HTTP client for API calls- Python 3.8+
- Internet access (CoinGecko public API, no API key required)
