Stream latency up to 20 minutes


I noticed today there is high latency on stream data from 3 minutes to ~20 mins, and I was looking at minute data. Not sure if anyone see the issue as well. Also what’s the normal latency?


I noticed the default stream is for Alpaca data while we have to specify stream for polygon.

I just compare the latency for the two, and it seems like latency for polygon is much lower. Is that expected?

It is not expected and if that’s the case we need to address it. Is it happenning from today?

I just start to test my script today, so not sure about earlier data.

Below is an example data from my log:
2020-07-09 08:27:37 PDT-INFO-Alpaca time 2020-07-09 11:27:36.984646-04:00 (This is from Alpaca API get_clock(), right before logging the minute data below)
2020-07-09 08:27:37 PDT-INFO-Agg({ ‘average’: 10.2559,
‘close’: 10.165,
‘end’: 1594307520000,
‘high’: 10.17,
‘low’: 10.165,
‘open’: 10.17,
’start’: 1594307460000, (this corresponding to 2020-07-09 11:12:00-04:00)
‘symbol’: ‘INFY’,
‘timestamp’: 1594307460000,
‘totalvolume’: 368259,
‘volume’: 1401,
‘vwap’: 10.1668})

From the timestamp above, the data arrived has 15 minutes latency (11:12 vs 11:27). I’ve tested at some other time today, and it seems the latency varies from a few minutes to 20 minutes or so.

I was using Alpaca data API. Is there any difference if using Polygon data stream, in terms of latency, data source, and limit of channel numbers?

Thank you for the details. As far as I tested on my side, it wasn’t the case, but there might be some issues depending on the server process you are connected to. We will look more into it.

I’m noticing this today as well using the Python SDK’s StreamConn class. Streaming bar data seems to be delayed by more than 20 minutes. The logs below show the Agg object returned from the AM channel, the end time from the Agg object, and the current time from the get_clock() method:

[DEBUG]2020-07-13 11:41:26,687:INO-data-stream:Agg({   'average': 25.9832,
    'close': 26.6,
    'end': 1594664040000,
    'high': 26.6,
    'low': 26.49,
    'open': 26.49,
    'start': 1594663980000,
    'symbol': 'INO',
    'timestamp': 1594663980000,
    'totalvolume': 313959,
    'volume': 284,
    'vwap': 26.5661})
[DEBUG]2020-07-13 11:41:26,687:INO-data-stream:bar end: 2020-07-13 14:14:00-04:00
[DEBUG]2020-07-13 11:41:27,253:INO-data-stream:alpaca clock: Clock({   'is_open': True,
    'next_close': '2020-07-13T16:00:00-04:00',
    'next_open': '2020-07-14T09:30:00-04:00',
    'timestamp': '2020-07-13T14:41:27.214128429-04:00'})

The bar end time is 14:14 EDT while the clock time is 14:41 so latency here is up to 27 minutes. Any update on this issue?

Edit: This is using the Alpaca Data API not Polygon.

Thanks for the report. My own connection shows up to date for INO minute bars but there could be connection specifc issue. Do you subscribe to other symbols and get the same delay?

Thanks for the quick response. Looks like it’s happening for other symbols as well.


[DEBUG]2020-07-13 12:01:48,550:SPY-data-stream:Agg({   'average': 321.4504,
    'close': 319.82,
    'end': 1594664940000,
    'high': 319.98,
    'low': 319.77,
    'open': 319.98,
    'start': 1594664880000,
    'symbol': 'SPY',
    'timestamp': 1594664880000,
    'totalvolume': 6024981,
    'volume': 15643,
    'vwap': 319.8347})
[DEBUG]2020-07-13 12:01:48,551:SPY-data-stream:bar end: 2020-07-13 14:29:00-04:00
[DEBUG]2020-07-13 12:01:48,654:SPY-data-stream:alpaca clock: Clock({   'is_open': True,
    'next_close': '2020-07-13T16:00:00-04:00',
    'next_open': '2020-07-14T09:30:00-04:00',
    'timestamp': '2020-07-13T15:01:48.61505983-04:00'})


[DEBUG]2020-07-13 12:05:42,186:AAPL-data-stream:Agg({   'average': 395.6626,
    'close': 388.74,
    'end': 1594665060000,
    'high': 389.25,
    'low': 388.71,
    'open': 389.25,
    'start': 1594665000000,
    'symbol': 'AAPL',
    'timestamp': 1594665000000,
    'totalvolume': 533232,
    'volume': 1248,
    'vwap': 388.8346})
[DEBUG]2020-07-13 12:05:42,187:AAPL-data-stream:bar end: 2020-07-13 14:31:00-04:00
[DEBUG]2020-07-13 12:05:42,723:AAPL-data-stream:alpaca clock: Clock({   'is_open': True,
    'next_close': '2020-07-13T16:00:00-04:00',
    'next_open': '2020-07-14T09:30:00-04:00',
    'timestamp': '2020-07-13T15:05:42.685072552-04:00'})

Is this only aggs or do you see similar delay to quotes or trades?

I’m only streaming minute bars right now, but let me add trades and quotes quick and I’ll post the results.

Okay, so in my case the issue is related to a VPN connection. When using the VPN I see the delays shown above and without the VPN I get real-time updates. I haven’t had more time to test this yet so I don’t know if the data was actually delayed when connected to the VPN or if the timestamps were just off. All good for now either way. Any idea why a VPN might cause this issue?