Skip to content

Instantly share code, notes, and snippets.

@Lvl4Sword
Last active September 16, 2018 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lvl4Sword/452b15c0a1cfb6ded3e419073a3ed59b to your computer and use it in GitHub Desktop.
Save Lvl4Sword/452b15c0a1cfb6ded3e419073a3ed59b to your computer and use it in GitHub Desktop.
import requests
get_this = requests.get('https://api.coinmarketcap.com/v1/ticker/?convert=USD&limit=2000')
all_dict = {}
for each in get_this.json():
ticker = each['symbol']
all_dict[ticker] = {}
all_dict[ticker]['rank'] = each['rank']
all_dict[ticker]['price'] = each['price_usd']
all_dict[ticker]['volume'] = each['24h_volume_usd']
all_dict[ticker]['market_cap'] = each['market_cap_usd']
all_dict[ticker]['1h_change'] = each['percent_change_1h']
all_dict[ticker]['24h_change'] = each['percent_change_24h']
all_dict[ticker]['7d_change'] = each['percent_change_7d']
all_dict[ticker]['name'] = each['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment