The Snapshot API lets you pull a price snapshot for a given ticker. We cover all actively traded US stocks.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 = 'AAPL'# create the URLurl = ( f'https://api.financialdatasets.ai/prices/snapshot' f'?ticker={ticker}')# make API requestresponse = requests.get(url, headers=headers)# parse snapshot from the responsesnapshot = response.json().get('snapshot')