Hey everyone I am trying to access the Coin Market Cap API and return the top 5000 slugs their price and there 24 hour change in volume. I want to save what is returned to a CSV file as well so I can add it to a data frame. I tried a few time to write a loop using the response variable but have had no luck. Any help will be great!
from inspect import Parameter
from requests import Request, Session
import json
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest' # Coinmarketcap API url
headers = {
'Accepts': 'application/json',
'X-CMC_PRO_API_KEY': 'API KEY'
}
parameter = {'slug':**, 'convert': 'USD' }
session = Session()
session.headers.update(headers)
response = session.get(url, params=parameter)
for parameter in response:
print(parameter)
print(response)
Try something as follows:
Result: