Who Else is Getting Inaccurate ask/bid Spreads During Live Markets?

It’s been over a week now since I subscribed to the $9 data plan which means I shouldn’t be getting data from just IEX anymore but rather I should be getting the more accurate SIP data right? Well here’s my python code for pulling market prices (ask and bid) which is giving me very wide spreads.

if name== ‘main’:

APCA_API_BASE_URL= "https://api.alpaca.markets"
APCA_API_KEY_ID= "XXXXXXXXXXXXXXXXXXXXX"
APCA_API_SECRET_KEY= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

api = tradeapi.REST(
     base_url=APCA_API_BASE_URL,
     key_id=APCA_API_KEY_ID,
     secret_key=APCA_API_SECRET_KEY
)

aapl_last_quote = api.get_last_quote('AAPL')
xom_last_quote = api.get_last_quote('XOM')
tsla_last_quote = api.get_last_quote('TSLA')

print("AAPL last quote: "+str(aapl_last_quote))
print("XOM last quote: "+str(xom_last_quote))
print("TSLA last quote: "+str(tsla_last_quote))

Here are some examples of results I got when running the above a few times. The quotes are all over the place, sometimes matching the actual live market quotes, sometimes not. Appears I’m still getting fed IEX data.

AAPL last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 172.34,
‘asksize’: 1,
‘bidexchange’: 15,
‘bidprice’: 172.32,
‘bidsize’: 4,
‘timestamp’: 1644266072449013311})

XOM last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 82.87,
‘asksize’: 4,
‘bidexchange’: 15,
‘bidprice’: 82.86,
‘bidsize’: 2,
‘timestamp’: 1644266072546718096})

TSLA last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 960,
‘asksize’: 2,
‘bidexchange’: 15,
‘bidprice’: 903,
‘bidsize’: 1,
‘timestamp’: 1644266072635263979})

AAPL last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 172.35,
‘asksize’: 3,
‘bidexchange’: 15,
‘bidprice’: 172.32,
‘bidsize’: 4,
‘timestamp’: 1644266091652678817})

XOM last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 82.87,
‘asksize’: 2,
‘bidexchange’: 15,
‘bidprice’: 82.86,
‘bidsize’: 5,
‘timestamp’: 1644266091715268409})

TSLA last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 948,
‘asksize’: 1,
‘bidexchange’: 15,
‘bidprice’: 903,
‘bidsize’: 1,
‘timestamp’: 1644266092147050381})

AAPL last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 178.21,
‘asksize’: 1,
‘bidexchange’: 15,
‘bidprice’: 172.37,
‘bidsize’: 6,
‘timestamp’: 1644266100742269106})

XOM last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 82.87,
‘asksize’: 2,
‘bidexchange’: 15,
‘bidprice’: 82.85,
‘bidsize’: 1,
‘timestamp’: 1644266100829180588})

TSLA last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 960,
‘asksize’: 2,
‘bidexchange’: 15,
‘bidprice’: 914.61,
‘bidsize’: 1,
‘timestamp’: 1644266100886873525})

AAPL last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 178.21,
‘asksize’: 1,
‘bidexchange’: 15,
‘bidprice’: 172.36,
‘bidsize’: 4,
‘timestamp’: 1644266106879688339})

XOM last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 82.88,
‘asksize’: 2,
‘bidexchange’: 15,
‘bidprice’: 82.86,
‘bidsize’: 1,
‘timestamp’: 1644266106550462539})

TSLA last quote: Quote({ ‘askexchange’: 15,
‘askprice’: 915.1,
‘asksize’: 1,
‘bidexchange’: 15,
‘bidprice’: 903,
‘bidsize’: 1,
‘timestamp’: 1644266106987356850})

Hi @drayarms… did you get a solution for this by any chance?

I am curious about this too!

@algire The issue with this is that the original user was only fetching IEX data. Those are only quotes from the IEX exchange which are a small subset of full market NBBO quotes. This is obvious from the bid and ask exchange. Notice it’s always 15. 15 is the code for IEX. To ensure you are getting full market quotes add a parameter feed=sip to your query.

That may be the issue and fix the problem?