Per tick data spread data

having all kinds of nightmares trying to pull accurate per tick data, spreads are all over the place for AMD, usually spread is no more than a few cents from bid/ask, but what i’m getting from the new data feed is spreads .50, 60, 80c?

worked when i had polygon.io but not since i tried to change over… anyone elese noticing this?

1 Like

I’m also very interested i the answer to the above. I had to subscribe to Polygon but really hate wasting $200 a month if i can get it for free.

The quote data provided in the Alpaca ‘Unlimited’ data plan, for both the streaming connection as well as the quotes REST API, are NBBO quotes and should match Polygon’s NBBO quotes. The ‘Free’ plan has only quotes (ie limit orders) which were placed on the IEX exchange and are not full consolidated market data.

If one subscribes to the Unlimited’ data plan and uses the corresponding v2 data stream and APIs, the quote data will be accurate. Note that switching to the v2 stream and REST APIs (and associated new methods in the various SDKs) is important. Simply subscribing to the ‘Unlimited’ data plan but continuing to use the original v1 methods will result in the original quotes just from the IEX exchange.

1 Like

Dan, can you please check why the following query returns data for 05/01/21

https://data.alpaca.markets/v2/stocks/TRV/bars?timeframe=1Day&start=2021-05-01T00:00:00Z&end=2021-05-08T02:26:16Z&limit=10000&page_token=

2021-05-01 00:00:00.000 154.66 154.66 154.66 154.66 1406000

I’m pretty sure that this day was Saturday and the market was closed.

Thank you in advance

Dan, i found a daily closing price discrepancy. Symbol: TRV

QuoteDate AlpacaClosePrice Polygon/MarketWatch/YahooFin ClosePrice
2020-03-12 105.58 102.18

How is it possible that out of 500 days i checked you have such a big discrepancy on 03/12/20?
Can you please look into it.
Than you

@SpyToTheSky You asked about a closing price discrepancy between Alpaca data and some other sources. Specifically the close price of The Travelers Companies, Inc. (TRV) on 2020-03-12. Alpaca shows it as $105.58 while others display a price of $102.18.

Doing a bit of checking it seems the other sources are wrong. Let’s investigate. Here is the daily bar data from Alpaca around that date showing a close price on 2020-03-12 of $105.58 and indeed looking at Yahoo they show 102.18.

Where do these prices come from? All major data providers, including Alpaca, get their data from a single set of Securities Information Processors (SIPs). The bar data, and open and close data, is based upon the detail of every single trade occurring on a specific day. It’s up to the individual provider to aggregate and filter the trades to display. The SIP generally provides just the raw trades. That is where some discrepancies occur. Not all trades should be included in the consolidated price and sometimes trades are missed or mis-classified by the provider.

Let’s look at the raw trades which occurred around the close of markets (ie 16:00 ET) on 2020-03-12. These trades can be fetched with the Alpaca get_trades method. The timestamp is the ‘participant_timestamp’ or the actual time the trade was executed.

The trade highlighted in yellow is the one which Alpaca took as the ‘close’. It is the last ‘included’ trade of the day which by definition is considered the ‘close’.

What about all those other trades? One needs to look at the ‘conditions’. The SIP provides guidance on which conditions to exclude from consolidated prices. The CTS conditions can be found on page 64 of their spec.. The condition excluding most of the trades above are ‘I’ and ‘T’. Those are ‘odd lot’ and ‘after hours’ trades. All the trades for the day, after the yellow highlighted trade, are ‘T’ or after hour trades and excluded.

Alpaca used this yellow highlighted trade as the close because it is chronologically the last ‘included’ trade of the day. Not sure why the other sites used the previous trade. It is very odd that the last trade of the day came in 7 minutes after the markets closed. That may be part of the reason? The other sites may have some cut-off where they stop looking for included trades?

Anyway, very good callout. Everyone should understand where the data comes from and potential shortcomings.

1 Like

Dan, thank you for the detailed explanation of how you compute your daily OHLC prices. I’m sure you do it by the book. Unfortunatly it adversely affects various levels based on the closing price. Any chance you’d reconsider and do it the way others do (any print that comes after the close gets ignored) ?