Gets the prices of 5 top cryptocurrency prices

PHOTO EMBED

Thu Mar 17 2022 17:43:19 GMT+0000 (Coordinated Universal Time)

Saved by @Taylor #python #get #requests

import json
import requests

apikey = '43979f1b-f353-4842-ad8a-ecb2735f3b71'

headers = {
    'X-CMC_PRO_API_KEY' : apikey,
    'Accepts' : 'application/json'
}

params = {
    'start' : '1',
    'limit' : '5',
    'convert' : 'USD'
}

url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'

json = requests.get(url, params=params, headers=headers).json()

coins = json['data']

for coin in coins:
    print(coin['symbol'], coin['quote']['USD']['price'])
content_copyCOPY

https://www.youtube.com/watch?v=iIGNhBcj4zs