-
-
Notifications
You must be signed in to change notification settings - Fork 170
`stream_buffer`
Every received data record gets added to the stream_buffer stack/pipe (based on deque()) and you can pick up the oldest or latest entry via pop_stream_data_from_stream_buffer(mode='FIFO') or
pop_stream_data_from_stream_buffer(mode='LIFO').
To limit the stream_buffer to a max length use the parameter stream_buffer_maxlen of BinanceWebSocketApiManager() or create_stream().
You can use one stream_buffer for all streams or you can use individual and shared buffers for specific streams. All you have to do is to provide a stream_buffer_name to create_stream().
If you get errors during processing the received data, for example the database is down and throws an exception, you can put the data back to the stream_buffer with add_to_stream_buffer() and reprocess it later again.
To observe the stream_buffer use get_stream_buffer_byte_size() and get_stream_buffer_length().
Reset/clear a stream_buffer with clear_stream_buffer()
It is possible to replace the stream_buffer with a custom callback function.
UNICORN Binance WebSocket API and all other tools of the UNICORN Binance Suite are open source projects which welcomes contributions which can be anything from simple documentation fixes and reporting dead links to new features. To contribute follow this guide.