Polygon DataStream¶
- class src.boatwright.Data.OHLCV.Live.PolygonDataStream.PolygonDataStream(symbols, granularity='1-min', api_key=None, crypto=False, debug=False, verbose=False)¶
DataStream for collecting live Stock or Crypto bars using Polygon WebSocket.
- Parameters:
symbols – string or list of strings of symbols to subscribe
granularity – desired data resolution (only “minute” supported for Polygon aggs)
api_key – Polygon API key
crypto – boolean toggle for crypto or stock bars
debug – boolean toggle for printing debugging information
- async handle_msg(msg)¶
converts message collected from a websocket subscription to boatwright compatabile format
- Parameters:
msg – message recieved from websocket
- async run(queue)¶
Launch Polygon WebSocket and stream bars to the appropriate queues. :param queue: dict of {symbol: asyncio.Queue}