I was running my paper app on Friday 28th, based on the Momentum Day Trader example. My app subscribes to the polygon ‘A’ socket for second-level bar data, plus ‘AM’ and trade_updates sockets. I happened to be collecting all ‘A’ ticker data for a few hundred stocks on Friday so I can set up a local back-testing framework. I noticed after end of market day on Friday that I was left holding many securities even though they are supposed to liquidate within the last 15 minutes of trading. I have run the app on other days and it has always liquidated by end of day. I looked at the ‘A’ data I collected and for the non-liquidated stocks there are no updates on or after 15:45. I checked against the AM ticker data for the same stocks and there is minute-level data all the way up to market close (16:00). I initiated the StreamConn object with DEBUG=True arg but no socket errors are logged. Any idea why the second ticker would have stopped while the others did not? More to the point, how can I ensure in code that my end of day positions are liquidated without having to manually check on it? I have to be able to trust the Alpaca/Polygon integration is robust before I can think about switching to LIVE trading (possibly not the only person with this concern in this case). I suppose I could move the liquidation code to the minute-ticker socket event code if it turns out the minute ticker is sufficiently robust.
Any comments or pointers welcome.
Hi, the polygon socket works directly against the polygon API servers.
I would suggest checking with them if there was an issues on Friday causing the data stream to stop at 15:45 or is it something else.
The debug flag basically gives more data if there’s a ws connection error (which probably wasn’t the case here)