Hello, I have been having some trouble using the Alpaca API as it is giving me incorrect data, such that the API is useless to me. I am still practising with the paper API as i’m not sure whether to use this API for live trading yet.
I have attached the sample code below,
LASTQUOTE_URL = “https://data.alpaca.markets/v1/last_quote/stocks”
def new_price():
last_quote_url = LASTQUOTE_URL + ‘/AAPL’
r = requests.get(last_quote_url, headers=HEADERS)
last_price_json = json.loads((json.dumps(r.json(), indent=4)))
print(last_price_json)
new_price()
I greatly appreciate any help!