CoinGecko API-Driven Crypto Data Collector
in Python

This project focused on utilizing the CoinGecko API to extract and compile key data points for the top 100 cryptocurrencies. The objective was to aggregate this data efficiently into a user-friendly CSV format for further analysis and reference.


Project Overview

  • Problem Statement: With the dynamic and fast-paced nature of the cryptocurrency market, obtaining up-to-date and comprehensive information on the top cryptocurrencies is essential for market analysis and investment decisions. Manually collecting this data is time-consuming and prone to errors.
  • Solution: I developed a Python script that interfaces with the CoinGecko API to fetch data for the top 100 cryptocurrencies. The script automated the process of sending requests to the API, handling responses, and extracting relevant data fields such as market capitalization, price, volume, and circulating supply.
  • Technologies Used:
    • Python: For scripting the data extraction process and handling the data transformation into a CSV format.
    • CoinGecko API: A robust and comprehensive API offering detailed information on various cryptocurrencies.

Key Features

  • Data Extraction: Price and market metrics for each coin are collected.
  • Scalability: The script can be easily modified to fetch data for additional cryptocurrencies or different data points as needed.
  • CSV Output:Organizes and formats the extracted data into a CSV file, making it easy to use for data analysis or reporting purposes.

Project Details

The data to be collected is from the top 100 cryptocurrencies on coingecko.com:


Here is an example of a coin's individual metrics page:


Once the data was fetched from the coingecko.com API, the script needed to loop through it for each coin and aggregate it:

									# Set up a loop to get the data for each coin

data = []
for coin in json_data:
	row = {
		'name': coin['name'],
		'symbol': coin['symbol'],
		'current_price': coin['current_price'],
		'market_cap': coin['market_cap'],
		'market_cap_rank': coin['market_cap_rank'],
		'fully_diluted_val': coin['fully_diluted_valuation'],
		'total_vol': coin['total_volume'],
		'high_24h': coin['high_24h'],
		'low_24h': coin['low_24h'],
		'circ_supply': coin['circulating_supply'],
		'total_supply': coin['total_supply'],
		'max_supply': coin['max_supply'],
		'ath': coin['ath'],
		'ath_date': coin['ath_date'],
		'atl': coin['atl'],
		'atl_date': coin['atl_date'],
	}
	data.append(row)
								

Once the script is run, we can see the final output in a CSV file: