Retrieves top cryptocurrencies → structured CSVs with price and market data.
A Python scraper that queries the CoinGecko public API for cryptocurrency market data.
It retrieves the top N coins by market cap, parses the JSON response, and exports clean CSVs for analysis.
- Retrieves top cryptocurrencies by market cap (default: 100).
- Structured fields exported to CSV:
name,symbol,current_price,market_cap,volume_24h,price_change_24h_pct. - Lightweight (uses Python + requests/httpx).
- Error handling for network failures and API rate limits.
- Easy to extend with custom fields or output formats.
- Python 3.10+
- Git
# 1) Clone
git clone https://github.com/mdugan8186/coingecko-scraper.git
cd coingecko-scraper
# 2) (optional) Virtual environment
python -m venv .venv
# macOS/Linux:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate
# 3) Dependencies
pip install -r requirements.txtpython main.py- Outputs a CSV at:
output/top_100_crypto_2025-07-29_22-38-18.csv - Each run creates a timestamped CSV (e.g.,
top_100_crypto_2025-07-29_22-38-18.csv). Older files are not overwritten.
- Timestamped CSVs saved in
output/(e.g.,top_100_crypto_2025-07-29_22-38-18.csv).
Columns
name, symbol, current_price, market_cap, volume_24h, price_change_24h_pct
Example of the scraper output:
The full dataset is saved as: output/top_100_crypto_2025-07-29_22-38-18.csv
See TESTING.md for a step-by-step sanity flow, API maintenance notes, and data-quality checks.
- Python (3.10+)
- requests / httpx for API calls
- CSV outputs (pandas optional for further cleaning)
This scraper uses the CoinGecko public API and is intended for educational and demonstration purposes only.
Please review and comply with the CoinGecko API Terms of Service before using this project beyond small-scale testing or portfolio demonstration.
This project is licensed under the MIT License. See LICENSE.
Mike Dugan — Python Web Scraper & Automation Developer
- GitHub: @mdugan8186
- Portfolio Website: scraping-portfolio
- LinkIn: View my profile
- Fiverr: Hire me for web scraping and custom scrapers
- Upwork: Hire me for web scraping and Python automation
- Email: mdugan8186.work@gmail.com
