The Crypto Snapshot API lets you pull the latest real-time price for a given cryptocurrency.The real-time price is the last price that was traded for the ticker on exchanges like Coinbase, Kraken, and Bitfinex.To get started, please create an account and grab your API key at financialdatasets.ai.You will use the API key to authenticate your API requests.
import requests# add your API key to the headersheaders = { "X-API-KEY": "your_api_key_here"}# set your query paramsticker = 'BTC-USD'# create the URLurl = ( f'https://api.financialdatasets.ai/crypto/prices/snapshot' f'?ticker={ticker}')# make API requestresponse = requests.get(url, headers=headers)# parse snapshot from the responsesnapshot = response.json().get('snapshot')