Redesign and rewrite of `connection.py`, `sockets.py` as well as the loop and exception handling in `manager.py` and
support for `await get_stream_data_from_asyncio_queue(stream_id)`.
Runs perfectly on Python 3.7 to 3.12 on Windows, Linux and Mac!
Added
- `ubwa.api.get_listen_key()`
- Unit tests for python 3.7 to 3.12, extension of the tests.
- Support and use of an `asyncio.queue()`. The parameter "process_asyncio_queue" for `BinanceWebSocketApiManager()` and
`create_stream()` can be passed an async function, which is automatically added to the event loop of the websocket as
an async task. Received websocket data can be conveniently awaited with
`await get_stream_data_from_asyncio_queue(stream_id)` as an AsyncIO alternative to
`pop_stream_data_from_stream_buffer()`. This is probably the smartest way to process data from the websocket and
should be preferred to the stream_buffer and the callback function.
- `is_socket_ready()`
Changed
- Updated from websockets 10.4 to 11.0.3.
- `pop_stream_data_from_stream_buffer()` returns `None` instead of `False`
- The parameter `throw_exception_if_unrepairable` was removed by the UBWA Manager and replaced by the stream_signal
`STREAM_UNREPAIRABLE`.
Info: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60
- Many `False` values have been changed to `None` values in accordance with Python conventions.
- `shutdown_asyncgens()` to `_shutdown_asyncgens()`
- `run_socket()` to `_run_socket()`
- `_auto_data_cleanup_stopped_streams()` now performs a check every 60 seconds and deletes the data from streams that
have been stopped for more than 900 seconds.
- `datetime.utcfromtimestamp(stream_info['start_time']).strftime('%Y-%m-%d, %H:%M:%S UTC'))` is obsolete and has been
replaced by `datetime.fromtimestamp(timestamp, timezone.utc).strftime('%Y-%m-%d, %H:%M:%S UTC')`.
- Renamed `stop_stream_as_crash()` with `_crash_stream()`
- Renamed `is_stop_as_crash_request()` with `is_crash_request()`
- Renamed `stream_is_crashing()` with `_stream_is_crashing()`
- Renamed `stream_is_stopping()` with `_stream_is_stopping()`
Fixed
- In Websocket API wrong method names were used in logging.
- Logging info in `connection.py` revised.
- `ubwa.api.get_open_orders()` can now be used without the `symbol` parameter to query all open orders.
- Completely revised the error handling.
Removed
- Parameter `throw_exception_if_unrepairable` of `BinanceWebSocketApiManager()`.
- Exception `StreamRecoveryError`.
- `set_restart_request()`
- `_restart_stream()`
- `_keepalive_streams()`
- `kill_stream()`