Live Data Collection¶
- class src.boatwright.Data.Collection.Live.DataStream.DataStream(symbols, granularity, broker_name, api_key, api_secret, debug=False)¶
A DataStream is an interface to an external websocket client for streaming live candle data, and converting the received data to be compatible with boatwright.
- Parameters:
symbols (str) – string, or list of strings of symbols to subscribe websocket client to
granularity (str) – desired data resolution i.e. “1-min”
broker_name (str) – (optional) broker name to load api keys from config file
api_key (str) – if broker_name is None will use this api_key
api_secret (str) – if broker_name is None will use this secret_key
debug (bool) – boolean toggle to print debugging information to terminal
- abstract async handle_msg(msg)¶
converts message collected from a websocket subscription to boatwright compatabile format
- Parameters:
msg – message recieved from websocket
- abstract async run(queue)¶
launch datastream
- Parameters:
queue (Queue) – asyncio.Queue or dictionary of {“symbol”:asyncio.Queue, …}