Answers for "Coinmarketcap API Market Pairs Latest"

0

Coinmarketcap API Market Pairs Latest

{"data": {"id": 1,"name": "Bitcoin","symbol": "BTC","num_market_pairs": 7526,"market_pairs": [{"exchange": {"id": 157,"name": "BitMEX","slug": "bitmex"},"market_id": 4902,"market_pair": "BTC/USD","category": "derivatives","fee_type": "no-fees","market_pair_base": {"currency_id": 1,"currency_symbol": "BTC","exchange_symbol": "XBT","currency_type": "cryptocurrency"},"market_pair_quote": {"currency_id": 2781,"currency_symbol": "USD","exchange_symbol": "USD","currency_type": "fiat"},"quote": {"exchange_reported": {"price": 7839,"volume_24h_base": 434215.85308502,"volume_24h_quote": 3403818072.33347,"last_updated": "2019-05-24T02:39:00.000Z"},"USD": {"price": 7839,"volume_24h": 3403818072.33347,"last_updated": "2019-05-24T02:39:00.000Z"}}},{"exchange": {"id": 108,"name": "Negocie Coins","slug": "negocie-coins"},"market_id": 3377,"market_pair": "BTC/BRL","category": "spot","fee_type": "percentage","market_pair_base": {"currency_id": 1,"currency_symbol": "BTC","exchange_symbol": "BTC","currency_type": "cryptocurrency"},"market_pair_quote": {"currency_id": 2783,"currency_symbol": "BRL","exchange_symbol": "BRL","currency_type": "fiat"},"quote": {"exchange_reported": {"price": 33002.11,"volume_24h_base": 336699.03559957,"volume_24h_quote": 11111778609.7509,"last_updated": "2019-05-24T02:39:00.000Z"},"USD": {"price": 8165.02539531659,"volume_24h": 2749156176.2491,"last_updated": "2019-05-24T02:39:00.000Z"}}}]},"status": {"timestamp": "2021-10-01T23:04:06.604Z","error_code": 0,"error_message": "","elapsed": 10,"credit_count": 1}}
Posted by: Guest on October-02-2021
0

Coinmarketcap API Market Pairs Latest

#This example uses Python 2.7 and the python-request library.

from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json

url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
parameters = {
  'start':'1',
  'limit':'5000',
  'convert':'USD'
}
headers = {
  'Accepts': 'application/json',
  'X-CMC_PRO_API_KEY': 'b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c',
}

session = Session()
session.headers.update(headers)

try:
  response = session.get(url, params=parameters)
  data = json.loads(response.text)
  print(data)
except (ConnectionError, Timeout, TooManyRedirects) as e:
  print(e)
Posted by: Guest on October-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language