Skip to content

Instantly share code, notes, and snippets.

@KolevDarko
Created May 22, 2020 10:16
Show Gist options
  • Save KolevDarko/16aaf3889ef561e3cb4412af12f83dca to your computer and use it in GitHub Desktop.
Save KolevDarko/16aaf3889ef561e3cb4412af12f83dca to your computer and use it in GitHub Desktop.
Get crypto history price and circulating supply
def get_coin_supplies():
metadata_url = "https://apiv2.bitcoinaverage.com/metadata"
return make_request(metadata_url)
def get_history_at(days_back):
history_url = "https://apiv2.bitcoinaverage.com/indices/global/history"
history_time = datetime.datetime.utcnow() - datetime.timedelta(days=days_back)
history_timestamp = int(history_time.timestamp())
results = {}
for coin in coins:
coin_history_url = f"{history_url}/{coin}?at={history_timestamp}"
response = make_request(coin_history_url)
results[coin] = response
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment