Closed connor-roche closed 2 years ago
I think there is a volume threshold to publish a minute bar, maybe 100 shares or so. If you look at heavy volume symbols like SPY or QQQ you will see minute bars at every interval. The bars can be pretty spread out in PM/AH due to low volume.
Hi @connor-roche
it is generally not good practice to do the REST calls for every symbol in a separate thread ( you could use it as a backup if you want)
but exactly for that purpose you have the WS service.
having said that, if you use the latest package version (or >=0.48) you are using the alpaca WS, not the polygon WS.
to use the polygon WS you need to specify it directly alpaca.StreamConn("key", "secretkey", data_stream='polygon')
a follow up to @jaggas 's comment: when are you experiencing these issues (is it PM/AH)? and is it for highly traded stocks or not?
I tried this with the Polygon WS and Alpaca WS and still got the same result. While this issue is much more exaggerated in pre-market and after-market (I get a response from the SPY minute interval WS every 5-8 mins) I am still experiencing the issue during market hours. I ran my script with a number of high volume stocks and had this problem for a decent amount of them. Here are some symbols where I ran into the issue: AMZN / DIS / AMD / SHOP / TSLA / GOOG / GOOGL / ZM / FB just to name a few
Keep in mind it doesn't happen every minute. Some minutes it might return a bar for TSLA and the next minute it might not. For instance, I ran my script for 22 mins and got 17 TSLA bars back spread out through the 22 mins.
If you would like I can send you my script for greater insight.
Thanks for all your help thus far @jaggas & @shlomikushchi!
having this exact issue
Hey closing this one out due to inactivity, and I believe this is todo with the api/ws itself and not so much the SDK here
I set up a WebSocket connection to grab 1 min aggregates for a number of stocks:
This is similar to the work done here: https://github.com/alpacahq/example-scalping by @umitanuki. However, when I run the script it doesn't return bars every minute for all the symbols. Some minute aggregates are skipped for some symbols and it changes for different symbols each minute as well.
I tried this with 5 and 15 symbols and still, the same issue persists. Is this on the polygon side or is there a check to make sure the WebSocket returns info for every minute aggregate? Also, if others have had this issue then could it be best to move to REST API with multiple threads running, one for each symbol?