This tiny script calls the public CoinGecko API, stores the latest USD prices for Bitcoin and Ethereum in a pandas DataFrame, and writes the result to data.csv.
- Python 3.9 or newer
requestsandpandasPython packages (pip install requests pandas)
python3 fetch_data.pyThe script prints the fetched prices and saves them to data.csv in the current directory.
- The timestamp column is generated in UTC using timezone-aware ISO 8601 strings.