LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
677 stars 166 forks source link

Unhandled Exceptions When Disabling Internet Connection #272

Closed Scoooooba closed 2 years ago

Scoooooba commented 2 years ago

Version of this library.

unicorn_fy: 0.12.2 unicorn_binance_local_depth_cache: not found unicorn_binance_rest_api: not found unicorn_binance_trailing_stop_loss: not found unicorn_binance_websocket_api: 1.41.0

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

Hardware?

Local server/workstation

Operating System?

Windows

Python version?

Python3.9

Installed packages

aniso8601                     9.0.1
backcall                      0.2.0
certifi                       2021.10.8
charset-normalizer            2.0.12
cheroot                       8.6.0
click                         8.1.3
cloudpickle                   2.0.0
colorama                      0.4.4
cycler                        0.11.0
debugpy                       1.6.0
decorator                     5.1.1
entrypoints                   0.4
Flask                         2.1.2
Flask-RESTful                 0.3.9
fonttools                     4.33.3
idna                          3.3
importlib-metadata            4.11.3
ipykernel                     6.13.0
ipython                       7.33.0
itsdangerous                  2.1.2
jaraco.functools              3.5.0
jedi                          0.18.1
Jinja2                        3.1.2
jupyter-client                7.3.0
jupyter-core                  4.10.0
kiwisolver                    1.4.2
MarkupSafe                    2.1.1
matplotlib                    3.5.1
matplotlib-inline             0.1.3
more-itertools                8.12.0
nest-asyncio                  1.5.5
numpy                         1.22.3
packaging                     21.3
parso                         0.8.3
pickleshare                   0.7.5
Pillow                        9.1.0
pip                           22.0.4
prompt-toolkit                3.0.29
psutil                        5.9.0
Pygments                      2.12.0
pyparsing                     3.0.8
python-dateutil               2.8.2
pytz                          2022.1
pywin32                       303
pyzmq                         22.3.0
requests                      2.27.1
setuptools                    61.3.1
six                           1.16.0
spyder-kernels                2.3.0
tornado                       6.1
traitlets                     5.1.1
ujson                         5.2.0
unicorn-binance-websocket-api 1.41.0
unicorn-fy                    0.12.2
urllib3                       1.26.9
wcwidth                       0.2.5
websocket-client              1.3.2
websockets                    10.3
Werkzeug                      2.1.2
wheel                         0.37.1
zipp                          3.8.0

Logging output

No response

Processing method?

stream_buffer

Used endpoint?

binance.com

Issue

Hello,

first of all I want to thank you, Oliver, for the effort you have put into this project! I've just started switching from python-binance to your library as yours seems to offer many more possibilities, especially when it comes to monitoring the streams. Great work!

While testing some of the examples and the library's ability to reconnect streams, I came across some exceptions using the newest version of the library (1.41.0).

I ran the example_ctrl-c.py. While it was printing the buffered data, I disabled my wifi-connection. This caused the exceptions that were printed to the console.

{"stream":"btcusdt@kline_1m","data":{"e":"kline","E":1651336928394,"s":"BTCUSDT","k":{"t":1651336920000,"T":1651336979999,"s":"BTCUSDT","i":"1m","f":1342001980,"L":1342002131,"o":"38567.11000000","c":"38567.10000000","h":"38567.11000000","l":"38567.10000000","v":"0.85699000","n":152,"x":false,"q":"33051.62284140","V":"0.38124000","Q":"14703.32501640","B":"0"}}}
BinanceWebSocketApiSocket.start_socket(93a7446a6197-86d4-39fc-4318-0a36178f, ['kline', 'kline_1m'], ['btcusdt']) - Exception ConnectionClosed - error_msg: sent 1011 (unexpected error) keepalive ping timeout; no close frame received
BinanceWebSocketApiManager.stream_is_crashing(93a7446a6197-86d4-39fc-4318-0a36178f)
BinanceWebSocketApiConnection.await._conn.__aenter__(93a7446a6197-86d4-39fc-4318-0a36178f, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
BinanceWebSocketApiManager.stream_is_crashing(93a7446a6197-86d4-39fc-4318-0a36178f)
BinanceWebSocketApiConnection.await._conn.__aenter__(93a7446a6197-86d4-39fc-4318-0a36178f, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
BinanceWebSocketApiManager.stream_is_crashing(93a7446a6197-86d4-39fc-4318-0a36178f)
Task exception was never retrieved
future: <Task finished name='Task-3917' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\nest_asyncio.py", line 75, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\nest_asyncio.py", line 111, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\nest_asyncio.py", line 183, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\Tradetool\.Tradetool_1_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1

This exception was printed several times, each time with a different task name in "<Task finished name='Task-3917'".

When I enabled the wifi again, everythings been fine. The stream reconnected and the kline data has been printed again.

When I then stopped the script by pressing ctrl-c, the same exceptions arised again.

To my surprise, these exceptions did not occur, when I was using a "clean" virtual environment with only the unicorn-binance-websocket-api library and the spyder-kernels installed. So I started to install my other used packages one after the other and after each installation I checked whether the Exceptions occured or not. This is how i found out, that the Exceptions occured just after installing the matplotlib. This seems very strange to me, but I have been able to reproduce it several times.

Do you have any idea what the problem might be?

Installed packages WITHOUT exceptions:

aniso8601                     9.0.1
backcall                      0.2.0
certifi                       2021.10.8
charset-normalizer            2.0.12
cheroot                       8.6.0
click                         8.1.3
cloudpickle                   2.0.0
colorama                      0.4.4
debugpy                       1.6.0
decorator                     5.1.1
entrypoints                   0.4
Flask                         2.1.2
Flask-RESTful                 0.3.9
idna                          3.3
importlib-metadata            4.11.3
ipykernel                     6.13.0
ipython                       7.33.0
itsdangerous                  2.1.2
jaraco.functools              3.5.0
jedi                          0.18.1
Jinja2                        3.1.2
jupyter-client                7.3.0
jupyter-core                  4.10.0
MarkupSafe                    2.1.1
matplotlib-inline             0.1.3
more-itertools                8.12.0
nest-asyncio                  1.5.5
packaging                     21.3
parso                         0.8.3
pickleshare                   0.7.5
pip                           22.0.4
prompt-toolkit                3.0.29
psutil                        5.9.0
Pygments                      2.12.0
pyparsing                     3.0.8
python-dateutil               2.8.2
pytz                          2022.1
pywin32                       303
pyzmq                         22.3.0
requests                      2.27.1
setuptools                    61.3.1
six                           1.16.0
spyder-kernels                2.3.0
tornado                       6.1
traitlets                     5.1.1
ujson                         5.2.0
unicorn-binance-websocket-api 1.41.0
unicorn-fy                    0.12.2
urllib3                       1.26.9
wcwidth                       0.2.5
websocket-client              1.3.2
websockets                    10.3
Werkzeug                      2.1.2
wheel                         0.37.1
zipp                          3.8.0

Installed packages WITH exceptions:

aniso8601                     9.0.1
backcall                      0.2.0
certifi                       2021.10.8
charset-normalizer            2.0.12
cheroot                       8.6.0
click                         8.1.3
cloudpickle                   2.0.0
colorama                      0.4.4
cycler                        0.11.0
debugpy                       1.6.0
decorator                     5.1.1
entrypoints                   0.4
Flask                         2.1.2
Flask-RESTful                 0.3.9
fonttools                     4.33.3
idna                          3.3
importlib-metadata            4.11.3
ipykernel                     6.13.0
ipython                       7.33.0
itsdangerous                  2.1.2
jaraco.functools              3.5.0
jedi                          0.18.1
Jinja2                        3.1.2
jupyter-client                7.3.0
jupyter-core                  4.10.0
kiwisolver                    1.4.2
MarkupSafe                    2.1.1
matplotlib                    3.5.1
matplotlib-inline             0.1.3
more-itertools                8.12.0
nest-asyncio                  1.5.5
numpy                         1.22.3
packaging                     21.3
parso                         0.8.3
pickleshare                   0.7.5
Pillow                        9.1.0
pip                           22.0.4
prompt-toolkit                3.0.29
psutil                        5.9.0
Pygments                      2.12.0
pyparsing                     3.0.8
python-dateutil               2.8.2
pytz                          2022.1
pywin32                       303
pyzmq                         22.3.0
requests                      2.27.1
setuptools                    61.3.1
six                           1.16.0
spyder-kernels                2.3.0
tornado                       6.1
traitlets                     5.1.1
ujson                         5.2.0
unicorn-binance-websocket-api 1.41.0
unicorn-fy                    0.12.2
urllib3                       1.26.9
wcwidth                       0.2.5
websocket-client              1.3.2
websockets                    10.3
Werkzeug                      2.1.2
wheel                         0.37.1
zipp                          3.8.0

Thanks again and best regards, Sebastian

oliver-zehentleitner commented 2 years ago

Hi Sebastian!

Thank you for the kind words :)

How do you install ubwa, via pip, conda, download and seutp.py?

Please provide a full log file as this could help to understand what the lib was doing and it provides info about the setup of the lib.

Do you load matplotlib? i wonder how it could affect ubwa. only by installation.

if its not loaded i only can imagine two reasons:

  1. files are overwritten by the installation, but this would not result to such an error type.
  2. or matplotlib has an dependency that avoids to install ubwa latest version, but then matplotlib must be installed first and you would get some kind of error msgs.

Do you have many python versions on your system?

Can you reproduce this on an other system too?

What kind of virtual environment are you using?

Is an other app on the same system running with matplotlib?

Best regards, Oliver

Scoooooba commented 2 years ago

Hi Oliver,

I did some more tests today using the following script and disconnecting the wifi after receiving the first few klines.

from unicorn_binance_websocket_api.manager import BinanceWebSocketApiManager

import time
import threading
import logging
import os

logging.getLogger("unicorn_binance_websocket_api")
logging.basicConfig(level=logging.DEBUG,
                    filename=os.path.basename(__file__) + '.log',
                    format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}",
                    style="{")

def print_stream_data_from_stream_buffer(binance_websocket_api_manager):
    while True:
        if binance_websocket_api_manager.is_manager_stopping():
            exit(0)
        oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
        if oldest_stream_data_from_stream_buffer is False:
            time.sleep(0.01)
        else:
            try:
                print(oldest_stream_data_from_stream_buffer)
                pass
            except Exception:
                # not able to process the data? write it back to the stream_buffer
                binance_websocket_api_manager.add_to_stream_buffer(oldest_stream_data_from_stream_buffer)

if __name__ == '__main__':
    binance_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com")
    worker_thread = threading.Thread(target=print_stream_data_from_stream_buffer, args=(binance_websocket_api_manager,))
    worker_thread.start()
    kline_stream_id = binance_websocket_api_manager.create_stream(['kline', 'kline_1m'], ['btcusdt'])
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        print("\nStopping ... just wait a few seconds!")
        binance_websocket_api_manager.stop_manager_with_all_streams()

As you can see, matplotlib is not imported.

1) I tried the exact same test on an other laptop under the exact same conditions: Python 3.9.12 Script ran within a virtual environment created with virtualenv (https://pypi.org/project/virtualenv/) and using the default "virtualenv" command Same modules installed as mentioned in my previous post (including matplotlib) Scrip was executed from within the Spyder IDE 5.3.0 --> It worked without any problems, no exceptions. But honestly, I dont see the difference to the setup on my main laptop.

So then on my main laptop, I uninstalled everything related to python including the Spyder IDE and deleted all left-over files to really make sure nothing is left from the old installation and no other Python version is installed. Then I performed a fresh installation of Python 3.9.12 and the Spyder IDE 5.3.0. I created a fresh virtualenv and only installed ubwa in it.

2) With this virtualenv I executed the test-script directly from the console and disconnected wifi --> No Exceptions

3) Then I installed matplotlib in the virtualenv and executed the script again from the console --> No Exceptions

4) Then I installed the spyder-kernels 2.3.0 (necessary to run the virtualenv with the Spyder IDE) and execured the script from the console --> No Exceptions

5) Then I started the Spyder IDE using the virtualenv as external interpreter and executed the script from within spyder --> Ha! Exceptions! There they are ;)

6) Then I closed the Spyder IDE and executed the script from the console (again) --> No Exceptions

7) Then I started the Spyder IDE using the virtualenv as external interpreter and executed the script from within spyder --> There they are again, Exceptions!

8) Then I pip uninstalled matplotlib, and tested again from within the Spyder IDE --> No Exceptions.

9) Then I installed matplotlib again and tested from within Spyder --> Exceptions!

10) Then I executed the script from the console --> No Exceptions.

So now I'm totally confused. It seems like the exceptions have something to do with the combination of matplotlib and spyder. But only on my main laptop - on the other laptop its working fine.

Here is the logging of test 5):

2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: New instance of unicorn-binance-websocket-api_1.41.0-python_3.9.12 on Windows 10 for exchange binance.com started ...
2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: Debug is False
2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: Initiating `colorama_0.4.4`
2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: Using `websockets_10.3`
2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: Using `stream_buffer`
2022-05-02 12:43:39,060 [INFO    ] 7572 12716 manager: Using `stream_signal_buffer`
2022-05-02 12:43:39,060 [INFO    ] 7572 19320 manager: BinanceWebSocketApiManager._frequent_checks() new instance created with frequent_checks_id=1651488219.060935
2022-05-02 12:43:39,060 [INFO    ] 7572 6028 manager: BinanceWebSocketApiManager._keepalive_streams() new instance created with keepalive_streams_id=1651488219.060935
2022-05-02 12:43:39,060 [DEBUG   ] 7572 12716 connectionpool: Starting new HTTPS connection (1): api.github.com:443
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12716 connectionpool: https://api.github.com:443 "GET /repos/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/releases/latest HTTP/1.1" 200 1404
2022-05-02 12:43:39,311 [INFO    ] 7572 12716 manager: BinanceWebSocketApiManager.create_stream(['kline', 'kline_1m'], ['btcusdt'], None, False, False) with stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263
2022-05-02 12:43:39,311 [INFO    ] 7572 12716 manager: BinanceWebSocketApiManager._add_stream_to_stream_list(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt'], None, False, None, False)
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12716 selector_events: Using selector: SelectSelector
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12716 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12716 manager: BinanceWebSocketApiManager.create_stream(['kline', 'kline_1m'], ['btcusdt'], None, False, False, None) with stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 - Waiting till new socket and asyncio is ready
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt']) socket_id=28e5a610-3c49-45e6-8409-fd7f0d6f4649 recent_socket_id=28e5a610-3c49-45e6-8409-fd7f0d6f4649
2022-05-02 12:43:39,311 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt']) - started ... -
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 1}]
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt']) finished ...
2022-05-02 12:43:39,311 [INFO    ] 7572 12524 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline', 'kline_1m'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline_1m
2022-05-02 12:43:39,592 [DEBUG   ] 7572 12524 protocol: = connection is CONNECTING
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > GET /stream?streams=btcusdt@kline_1m HTTP/1.1
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Host: stream.binance.com:9443
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Upgrade: websocket
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Connection: Upgrade
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Sec-WebSocket-Key: Drh4RVDTUBaxuDfCruYzgQ==
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Sec-WebSocket-Version: 13
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2022-05-02 12:43:40,108 [DEBUG   ] 7572 12524 client: > User-Agent: unicorn-binance-websocket-api_1.41.0-python_3.9.12
2022-05-02 12:43:40,311 [DEBUG   ] 7572 12716 manager: BinanceWebSocketApiManager.create_stream(['kline', 'kline_1m'], ['btcusdt'], None, False, False, None) with stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 - Waiting till new socket and asyncio is ready
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < HTTP/1.1 101 Switching Protocols
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < Date: Mon, 02 May 2022 10:44:14 GMT
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < Connection: upgrade
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < Upgrade: websocket
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < Sec-WebSocket-Accept: 3gTzjMzyM/5gUAOg/uC9GwEwohc=
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 client: < Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_max_window_bits=15
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 protocol: = connection is OPEN
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,623 [INFO    ] 7572 12524 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt'] socket_id=28e5a610-3c49-45e6-8409-fd7f0d6f4649 recent_socket_id=28e5a610-3c49-45e6-8409-fd7f0d6f4649 - Sending payload started ...
2022-05-02 12:43:40,623 [INFO    ] 7572 12524 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt'] - Sending payload: {'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 1}
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,623 [DEBUG   ] 7572 12524 protocol: > TEXT '{"method":"SUBSCRIBE","params":["btcusdt@kline_...btcusdt@kline"],"id":1}' [75 bytes]
2022-05-02 12:43:40,921 [DEBUG   ] 7572 12524 protocol: < TEXT '{"result":null,"id":1}' [22 bytes]
2022-05-02 12:43:40,968 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,968 [INFO    ] 7572 12524 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Received result message: {"result":null,"id":1}
2022-05-02 12:43:40,968 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,968 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:40,968 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:41,140 [DEBUG   ] 7572 12524 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...52.38985740","B":"0"}}}' [364 bytes]
2022-05-02 12:43:41,140 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:41,140 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:41,140 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:41,249 [INFO    ] 7572 19320 manager: BinanceWebSocketApiManager._frequent_checks() - reached new `highest_receiving_speed` 71 B/s at 2022-05-02, 10:43:41 UTC
2022-05-02 12:43:42,187 [INFO    ] 7572 19320 manager: BinanceWebSocketApiManager._frequent_checks() - reached new `highest_receiving_speed` 413 B/s at 2022-05-02, 10:43:42 UTC
2022-05-02 12:43:44,619 [DEBUG   ] 7572 12524 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...52.38985740","B":"0"}}}' [364 bytes]
2022-05-02 12:43:44,619 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:44,619 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:44,619 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:45,635 [DEBUG   ] 7572 12524 protocol: % sending keepalive ping
2022-05-02 12:43:45,635 [DEBUG   ] 7572 12524 protocol: > PING b3 7a 52 68 [binary, 4 bytes]
2022-05-02 12:43:45,963 [DEBUG   ] 7572 12524 protocol: < PONG b3 7a 52 68 [binary, 4 bytes]
2022-05-02 12:43:45,963 [DEBUG   ] 7572 12524 protocol: % received keepalive pong
2022-05-02 12:43:46,823 [DEBUG   ] 7572 12524 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...35.63525500","B":"0"}}}' [364 bytes]
2022-05-02 12:43:46,823 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:46,823 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:46,823 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:43:50,972 [DEBUG   ] 7572 12524 protocol: % sending keepalive ping
2022-05-02 12:43:50,972 [DEBUG   ] 7572 12524 protocol: > PING 45 93 6c 01 [binary, 4 bytes]
2022-05-02 12:44:00,984 [DEBUG   ] 7572 12524 protocol: ! timed out waiting for keepalive pong
2022-05-02 12:44:00,984 [DEBUG   ] 7572 12524 protocol: ! failing connection with code 1011
2022-05-02 12:44:00,984 [DEBUG   ] 7572 12524 protocol: = connection is CLOSING
2022-05-02 12:44:00,984 [DEBUG   ] 7572 12524 protocol: > CLOSE 1011 (unexpected error) keepalive ping timeout [24 bytes]
2022-05-02 12:44:01,986 [DEBUG   ] 7572 12524 protocol: ! timed out waiting for TCP close
2022-05-02 12:44:01,986 [DEBUG   ] 7572 12524 protocol: x closing TCP connection
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 protocol: ! timed out waiting for TCP close
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 protocol: x aborting TCP connection
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 protocol: = connection is CLOSED
2022-05-02 12:44:02,997 [CRITICAL] 7572 12524 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline', 'kline_1m'], ['btcusdt']) - Exception ConnectionClosed - error_msg: sent 1011 (unexpected error) keepalive ping timeout; no close frame received
2022-05-02 12:44:02,997 [CRITICAL] 7572 12524 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_restart_request() - creating new request
2022-05-02 12:44:02,997 [DEBUG   ] 7572 12524 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 10204 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:03,169 [INFO    ] 7572 10204 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:03,169 [DEBUG   ] 7572 10204 selector_events: Using selector: SelectSelector
2022-05-02 12:44:03,169 [DEBUG   ] 7572 10204 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 10204 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=bf9e3300-6336-4cdf-97ec-70de8896333a recent_socket_id=bf9e3300-6336-4cdf-97ec-70de8896333a
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 2}]
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:03,169 [INFO    ] 7572 15408 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:03,169 [CRITICAL] 7572 15408 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:03,169 [CRITICAL] 7572 15408 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:03,169 [DEBUG   ] 7572 15408 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 18172 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:09,176 [INFO    ] 7572 18172 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:09,176 [DEBUG   ] 7572 18172 selector_events: Using selector: SelectSelector
2022-05-02 12:44:09,176 [DEBUG   ] 7572 18172 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 18172 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=f74d33f5-e514-4b6b-bf72-7c9651d3cf2e recent_socket_id=f74d33f5-e514-4b6b-bf72-7c9651d3cf2e
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 3}]
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:09,176 [INFO    ] 7572 8060 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:09,176 [ERROR   ] 7572 8060 base_events: Task exception was never retrieved
future: <Task finished name='Task-503' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:09,176 [CRITICAL] 7572 8060 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:09,176 [CRITICAL] 7572 8060 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:09,176 [DEBUG   ] 7572 8060 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 3996 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:15,227 [INFO    ] 7572 3996 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:15,227 [DEBUG   ] 7572 3996 selector_events: Using selector: SelectSelector
2022-05-02 12:44:15,227 [DEBUG   ] 7572 3996 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 3996 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=6712e077-bf1b-4772-8409-84aaae37fe02 recent_socket_id=6712e077-bf1b-4772-8409-84aaae37fe02
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 4}]
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:15,227 [INFO    ] 7572 11516 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:15,227 [CRITICAL] 7572 11516 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:15,227 [CRITICAL] 7572 11516 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:15,227 [DEBUG   ] 7572 11516 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 15492 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:21,261 [INFO    ] 7572 15492 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:21,261 [DEBUG   ] 7572 15492 selector_events: Using selector: SelectSelector
2022-05-02 12:44:21,261 [DEBUG   ] 7572 15492 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 15492 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=0170c54b-5057-4a70-8a1a-95d7c263cef1 recent_socket_id=0170c54b-5057-4a70-8a1a-95d7c263cef1
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 5}]
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:21,261 [INFO    ] 7572 17856 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:21,261 [CRITICAL] 7572 17856 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:21,261 [CRITICAL] 7572 17856 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:21,261 [DEBUG   ] 7572 17856 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 19328 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:27,297 [INFO    ] 7572 19328 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:27,297 [DEBUG   ] 7572 19328 selector_events: Using selector: SelectSelector
2022-05-02 12:44:27,297 [DEBUG   ] 7572 19328 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 19328 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=4b781f3c-c0d4-428c-b2e3-2b6d1e5aa432 recent_socket_id=4b781f3c-c0d4-428c-b2e3-2b6d1e5aa432
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 6}]
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:27,297 [INFO    ] 7572 18836 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:27,297 [CRITICAL] 7572 18836 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:27,297 [CRITICAL] 7572 18836 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:27,297 [DEBUG   ] 7572 18836 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 18012 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:33,346 [INFO    ] 7572 18012 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:33,346 [DEBUG   ] 7572 18012 selector_events: Using selector: SelectSelector
2022-05-02 12:44:33,346 [DEBUG   ] 7572 18012 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 18012 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=e7886000-da60-4e32-af17-f6eed6b46a98 recent_socket_id=e7886000-da60-4e32-af17-f6eed6b46a98
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 7}]
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:33,346 [INFO    ] 7572 5084 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:33,346 [ERROR   ] 7572 5084 base_events: Task exception was never retrieved
future: <Task finished name='Task-507' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:33,346 [ERROR   ] 7572 5084 base_events: Task exception was never retrieved
future: <Task finished name='Task-509' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:33,346 [ERROR   ] 7572 5084 base_events: Task exception was never retrieved
future: <Task finished name='Task-511' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:33,346 [CRITICAL] 7572 5084 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:33,346 [CRITICAL] 7572 5084 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:33,346 [DEBUG   ] 7572 5084 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 16900 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:39,398 [INFO    ] 7572 16900 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:39,398 [DEBUG   ] 7572 16900 selector_events: Using selector: SelectSelector
2022-05-02 12:44:39,398 [DEBUG   ] 7572 16900 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 16900 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=0e7f9548-a63a-4552-917c-7f283d9d931d recent_socket_id=0e7f9548-a63a-4552-917c-7f283d9d931d
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 8}]
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:39,398 [INFO    ] 7572 17592 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:39,398 [CRITICAL] 7572 17592 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:39,398 [CRITICAL] 7572 17592 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:39,398 [DEBUG   ] 7572 17592 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 3524 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:45,463 [INFO    ] 7572 3524 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:45,463 [DEBUG   ] 7572 3524 selector_events: Using selector: SelectSelector
2022-05-02 12:44:45,463 [DEBUG   ] 7572 3524 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 3524 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=8fd1e497-dfda-41a2-a481-8165dc1c1b17 recent_socket_id=8fd1e497-dfda-41a2-a481-8165dc1c1b17
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 9}]
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:45,463 [INFO    ] 7572 2364 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:45,463 [CRITICAL] 7572 2364 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:45,463 [CRITICAL] 7572 2364 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:45,463 [DEBUG   ] 7572 2364 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 15576 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:51,529 [INFO    ] 7572 15576 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:51,529 [DEBUG   ] 7572 15576 selector_events: Using selector: SelectSelector
2022-05-02 12:44:51,529 [DEBUG   ] 7572 15576 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 15576 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=27c94410-0d16-4621-abc4-92962c41c171 recent_socket_id=27c94410-0d16-4621-abc4-92962c41c171
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 10}]
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:51,529 [INFO    ] 7572 18396 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:51,529 [CRITICAL] 7572 18396 connection: BinanceWebSocketApiConnection.await._conn.__aenter__(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - No internet connection? - error_msg: [Errno 11001] getaddrinfo failed: wss://stream.binance.com:9443/
2022-05-02 12:44:51,529 [CRITICAL] 7572 18396 manager: BinanceWebSocketApiManager.stream_is_crashing(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.set_restart_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.set_restart_request() - last_restart_time timeout, initiate new
2022-05-02 12:44:51,529 [DEBUG   ] 7572 18396 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:57,550 [DEBUG   ] 7572 6028 manager: BinanceWebSocketApiManager.kill_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:57,550 [DEBUG   ] 7572 12208 manager: BinanceWebSocketApiManager._restart_stream_thread(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:57,550 [INFO    ] 7572 12208 manager: BinanceWebSocketApiManager._restart_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'])
2022-05-02 12:44:57,550 [DEBUG   ] 7572 12208 selector_events: Using selector: SelectSelector
2022-05-02 12:44:57,550 [DEBUG   ] 7572 12208 manager: BinanceWebSocketApiManager.set_socket_is_not_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:57,550 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:57,550 [DEBUG   ] 7572 12208 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) socket_id=1675c77c-dc3f-407e-bd4e-4b4ccaeb3e1d recent_socket_id=1675c77c-dc3f-407e-bd4e-4b4ccaeb3e1d
2022-05-02 12:44:57,550 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - started ... -
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) started ...
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) - Payload: [{'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 11}]
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.create_payload(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.subscribe_to_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt']) finished ...
2022-05-02 12:44:57,550 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.create_websocket_uri(['kline_1m', 'kline'], ['btcusdt'], , False) - Created websocket URI for stream_id=6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263 is wss://stream.binance.com:9443/stream?streams=btcusdt@kline
2022-05-02 12:44:57,816 [DEBUG   ] 7572 11032 protocol: = connection is CONNECTING
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > GET /stream?streams=btcusdt@kline HTTP/1.1
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Host: stream.binance.com:9443
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Upgrade: websocket
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Connection: Upgrade
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Sec-WebSocket-Key: S/TWId96LqW4t/yzLTYRZg==
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Sec-WebSocket-Version: 13
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2022-05-02 12:44:58,352 [DEBUG   ] 7572 11032 client: > User-Agent: unicorn-binance-websocket-api_1.41.0-python_3.9.12
2022-05-02 12:44:58,566 [DEBUG   ] 7572 12208 manager: BinanceWebSocketApiManager.create_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Waiting till new socket and asyncio is ready
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < HTTP/1.1 101 Switching Protocols
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < Date: Mon, 02 May 2022 10:45:32 GMT
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < Connection: upgrade
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < Upgrade: websocket
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < Sec-WebSocket-Accept: OsY4OXz4oioulnApMi3AxLRCS3s=
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 client: < Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_max_window_bits=15
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 protocol: = connection is OPEN
2022-05-02 12:44:58,894 [ERROR   ] 7572 11032 base_events: Task exception was never retrieved
future: <Task finished name='Task-515' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:58,894 [ERROR   ] 7572 11032 base_events: Task exception was never retrieved
future: <Task finished name='Task-517' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:58,894 [ERROR   ] 7572 11032 base_events: Task exception was never retrieved
future: <Task finished name='Task-519' coro=<BinanceWebSocketApiSocket.start_socket() done, defined at C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py:63> exception=SystemExit(1)>
Traceback (most recent call last):
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 138, in __aenter__
    self.manager.websocket_list[self.stream_id] = await self._conn.__aenter__()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 633, in __aenter__
    return await self
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 479, in wait_for
    return fut.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 258, in __step
    result = coro.throw(exc)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\websockets\legacy\client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1026, in create_connection
    infos = await self._ensure_resolved(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1405, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\manager.py", line 529, in _create_stream_thread
    loop.run_until_complete(socket.start_socket())
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 83, in run_until_complete
    self._run_once()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 119, in _run_once
    handle._run()
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 339, in __wakeup
    self.__step()
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\nest_asyncio.py", line 195, in step
    step_orig(task, exc)
  File "C:\Users\Sebi\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\sockets.py", line 67, in start_socket
    async with BinanceWebSocketApiConnection(self.manager,
  File "C:\Sebi\CryptoTrading\UnicornWebsocketTest\.unicorn_virtualenv\lib\site-packages\unicorn_binance_websocket_api\connection.py", line 186, in __aenter__
    sys.exit(1)
SystemExit: 1
2022-05-02 12:44:58,894 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:58,910 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:58,910 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:58,910 [INFO    ] 7572 11032 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'] socket_id=1675c77c-dc3f-407e-bd4e-4b4ccaeb3e1d recent_socket_id=1675c77c-dc3f-407e-bd4e-4b4ccaeb3e1d - Sending payload started ...
2022-05-02 12:44:58,910 [INFO    ] 7572 11032 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263, ['kline_1m', 'kline'], ['btcusdt'] - Sending payload: {'method': 'SUBSCRIBE', 'params': ['btcusdt@kline_1m', 'btcusdt@kline'], 'id': 11}
2022-05-02 12:44:58,910 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:58,910 [DEBUG   ] 7572 11032 protocol: > TEXT '{"method":"SUBSCRIBE","params":["btcusdt@kline_...tcusdt@kline"],"id":11}' [76 bytes]
2022-05-02 12:44:59,207 [DEBUG   ] 7572 11032 protocol: < TEXT '{"result":null,"id":11}' [23 bytes]
2022-05-02 12:44:59,254 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:59,254 [INFO    ] 7572 11032 sockets: BinanceWebSocketApiSocket.start_socket(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263) - Received result message: {"result":null,"id":11}
2022-05-02 12:44:59,254 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:59,254 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:44:59,254 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:01,224 [DEBUG   ] 7572 11032 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...11.74975210","B":"0"}}}' [366 bytes]
2022-05-02 12:45:01,224 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:01,224 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:01,224 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:02,257 [INFO    ] 7572 19320 manager: BinanceWebSocketApiManager._frequent_checks() - reached new `highest_receiving_speed` 415 B/s at 2022-05-02, 10:45:02 UTC
2022-05-02 12:45:03,226 [DEBUG   ] 7572 11032 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...79.37032930","B":"0"}}}' [367 bytes]
2022-05-02 12:45:03,226 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:03,226 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:03,226 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:03,899 [DEBUG   ] 7572 11032 protocol: % sending keepalive ping
2022-05-02 12:45:03,899 [DEBUG   ] 7572 11032 protocol: > PING a8 fd 4d f5 [binary, 4 bytes]
2022-05-02 12:45:04,135 [INFO    ] 7572 19320 manager: BinanceWebSocketApiManager._frequent_checks() - reached new `highest_receiving_speed` 416 B/s at 2022-05-02, 10:45:04 UTC
2022-05-02 12:45:04,164 [DEBUG   ] 7572 11032 protocol: < PONG a8 fd 4d f5 [binary, 4 bytes]
2022-05-02 12:45:04,165 [DEBUG   ] 7572 11032 protocol: % received keepalive pong
2022-05-02 12:45:05,240 [DEBUG   ] 7572 11032 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...61.38184160","B":"0"}}}' [367 bytes]
2022-05-02 12:45:05,240 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:05,240 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:05,240 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_heartbeat(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:06,521 [INFO    ] 7572 12716 manager: BinanceWebSocketApiManager.stop_manager_with_all_streams() - Stopping unicorn_binance_websocket_api_manager 1.41.0 ...
2022-05-02 12:45:06,521 [INFO    ] 7572 12716 manager: BinanceWebSocketApiManager.stop_stream(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:06,521 [INFO    ] 7572 12716 manager: BinanceWebSocketApiManager.stream_is_stopping(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:07,977 [DEBUG   ] 7572 11032 protocol: < TEXT '{"stream":"btcusdt@kline_1m","data":{"e":"kline...61.09205910","B":"0"}}}' [367 bytes]
2022-05-02 12:45:07,992 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:07,992 [INFO    ] 7572 11032 manager: BinanceWebSocketApiManager.stream_is_stopping(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:07,992 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.is_stop_as_crash_request(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:07,992 [INFO    ] 7572 11032 connection: BinanceWebSocketApiConnection.close(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)
2022-05-02 12:45:07,992 [DEBUG   ] 7572 11032 protocol: = connection is CLOSING
2022-05-02 12:45:07,992 [DEBUG   ] 7572 11032 protocol: > CLOSE 1000 (OK) [2 bytes]
2022-05-02 12:45:08,305 [DEBUG   ] 7572 11032 protocol: < CLOSE 1000 (OK) [2 bytes]
2022-05-02 12:45:09,306 [DEBUG   ] 7572 11032 protocol: ! timed out waiting for TCP close
2022-05-02 12:45:09,306 [DEBUG   ] 7572 11032 protocol: x closing TCP connection
2022-05-02 12:45:09,557 [DEBUG   ] 7572 11032 protocol: = connection is CLOSED
2022-05-02 12:45:09,557 [DEBUG   ] 7572 11032 manager: BinanceWebSocketApiManager.set_socket_is_ready(6c5cbb02ca89-a2f6-cf2e-bf62-5e5f8263)

No other python apps were running while performing the tests.

I hope you find something.. Thanks and best regards, Sebastian

oliver-zehentleitner commented 2 years ago

Hello Sebastian!

Thanks, this is really a very neat bug report, I wish all were like this :)

I don't know Spyder IDE, but I have a suspicion.

You get the error as soon as you change the event_loop from run_forever to create_task method. I know the problem, I have tested this very intensively :)

I suspect that the Spyder IDE for debugging hooks into it and possibly modifies the eventloop inappropriately.

With Pycharm and Visual Code there is no problem as far as I know.

I'm also not sure what we could change about it and if it's even worth the effort :)

I can leave this thread open and we will see if more users get this or a similar problem and maybe we will get more accurate conclusions.

Do any other libs have similar problems with Spyder IDE? What have they done to solve it? What does Spyder IDE say about it?

Scoooooba commented 2 years ago

Hello Oliver,

it seems like I've been able to solve the problem! After your last post I took a deeper dive into the Spyder IDE. After I uninstalled Spyder and deleted the remaining files, I actually missed the configuration files. The configuration files are not stored in the actual program folder, but under C:\User[Name].spyder-py3\config\spyder.ini and \transient.ini. So I compared these files from both of my laptops and I found a difference. In the spyder.ini, under [ipython_console] ther is a "pylab/backend =" setting. pylab/backend = 1 causes the exceptions. When set to pylab/backend 0, everything works fine.

The attached screenshot expains, what this setting does. Set to 1 corresponds to "Automatic", set to 0 corresponds to "Inline".

So this might expain, why installing/uninstalling matplotlib had an impact on the exception. But still i cant't see what ubwa has to do with it..

backend_setting

Edit for others, who might have the same problem in the future: Changing the backend to "inline" (pylab/backend 0) on the one hand solves the problem with the exceptions, but on the other hand plots are then plottet inline and not in a new window. As far as I have tested, there are two possible solutions: 1) In the Spyder settings, change the backend to "Qt5" and install Qt5 (e.g. by "pip install PyQt5"). This seems to work fine with both, avoiding the exceptions and plotting in new windows. 2) In the Spyder settings, keep the backend at "Inline" and install Qt5. Then in the code, add the following in the import section:

try:
    from IPython import get_ipython
    get_ipython().run_line_magic('matplotlib', 'qt5')
except:
    pass
oliver-zehentleitner commented 2 years ago

strange thing. thanks for your reported solution!

So if inline is changing the behavior and qt5 solves the root issue, then automatic is choosing tkinter and the problem is happening with it?

Scoooooba commented 2 years ago

Yes, I just checked it. Selecting Tkinter as backend results in the exception.

oliver-zehentleitner commented 2 years ago

If any other users have this problem and can help find out the exact reason, please post a new thread. I am closing this thread in the meantime. Thank you for the good research!