Skip to content

Instantly share code, notes, and snippets.

@apinanyogaratnam
Created February 9, 2022 00:46
Show Gist options
  • Save apinanyogaratnam/b657ee1bd476e731988e63ba10eed41d to your computer and use it in GitHub Desktop.
Save apinanyogaratnam/b657ee1bd476e731988e63ba10eed41d to your computer and use it in GitHub Desktop.
get historical ethereum prices
import requests
date = input("Enter a date in DD-MM-YYYY format: ")
url = f"https://api.coingecko.com/api/v3/coins/ethereum/history?date={date}"
response = requests.get(url).json()
price_at = round(response['market_data']['current_price']['usd'], 2)
print(price_at)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment