PLEASE help me get simple market data

I keep getting stock quotes with a bid price MORE than the ask price, e.g.,

when I run
r = requests.get("{}/v1/last_quote/stocks/".format(“https://data.alpaca.markets”) + ‘AAPL’, headers={‘APCA-API-KEY-ID’: ALPACA_API_KEY, ‘APCA-API-SECRET-KEY’: ALPACA_SECRET_KEY})
return json.loads(r.content)

I get:

{‘status’: ‘success’,
‘symbol’: ‘AAPL’,
‘last’: {‘askprice’: 323.93,
‘asksize’: 1,
‘askexchange’: 2,
‘bidprice’: 323.98,
‘bidsize’: 2,
‘bidexchange’: 3,
‘timestamp’: 1591196943308085322}}

1 Like

Try:barset= self.api.get_barset( ‘DIA’, ‘1Min’, limit = 18 )

Hey, thanks. I’m using v2 of alpacas api and that works