I could use a sanity check from the community.
I’ve put together a real-time trading system which relies on StockLatestBarRequest to update my charts every minute on the minute. I log all the incoming real-time values for a given day and then compare them with a historical back test the following day. Everything seems to match up very well with the one exception of one to two dozen repeating minutes in any given day. I added a half a second delay to the StockLatestBarRequest to make sure that the new minute bar would be ready before being queried and had assumed that for a few random minutes that just wasn’t enough time to get the new bar ready, and Alpaca was still returning the previous minute.
To resolve this issue I added a loop to keep calling StockLatestBarRequest until the new minute has a different timestamp from the latest in my chart. I would have expected after a few seconds at most the new minute bar would be returned. Anyway, it loops for a solid minute, completely skipping over the minute in question and then returns the following minute.
This test is run on SPY using the IEX feed. My best guess is that no transactions happen during that minute, so IEX never creates a new bar… but that seems unlikely that something as popular as SPY would have zero movement even on the IEX. Anyway, can someone help make sense of this? Thanks!