Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpotWebsocketStreamClient fails at instantiation #338

Closed
thisismygitrepo opened this issue Sep 9, 2024 · 2 comments
Closed

SpotWebsocketStreamClient fails at instantiation #338

thisismygitrepo opened this issue Sep 9, 2024 · 2 comments

Comments

@thisismygitrepo
Copy link

thisismygitrepo commented Sep 9, 2024

I'm running a straightforward code

    from binance.websocket.spot.websocket_stream import SpotWebsocketStreamClient
    client_class = SpotWebsocketStreamClient
    my_client = client_class(on_message=print, on_close=print)
    my_client.book_ticker(symbol=None)  # this works for ALL or only one symbol

--> 217 my_client = client_class(on_message=msg_handler, on_close=on_close)
218 _ = symbols_ccxt # TODO: allow specific symbols
219 my_client.book_ticker(symbol=None) # this works for ALL or only one symbol

File ~/venvs/cry/lib/python3.11/site-packages/binance/websocket/spot/websocket_stream.py:25, in SpotWebsocketStreamClient.init(self, stream_url, on_messag
e, on_open, on_close, on_error, on_ping, on_pong, is_combined, timeout, logger, proxies)
23 else:
24 stream_url = stream_url + "/ws"
---> 25 super().init(
26 stream_url,
27 on_message=on_message,
28 on_open=on_open,
29 on_close=on_close,
30 on_error=on_error,
31 on_ping=on_ping,
32 on_pong=on_pong,
33 timeout=timeout,
34 logger=logger,
35 proxies=proxies,
36 )

TypeError: BinanceWebsocketClient.init() got an unexpected keyword argument 'timeout'

@thisismygitrepo
Copy link
Author

I think I was once again tripped up by the confusing similar names import binance for both futures and spot libraroes.

@mannol
Copy link

mannol commented Dec 29, 2024

Wth is happening here? I'm getting the same error with the basic example as seen on the website:

import logging
from binance.websocket.spot.websocket_stream import SpotWebsocketStreamClient as Client

def message_handler(message):
    logging.info(message)

ws_client = Client(on_message=message_handler)

ws_client.ticker(symbol="bnbusdt")

logging.debug("closing ws connection")
ws_client.stop()
File "/home/wsai/.pyenv/versions/my-env/lib/python3.12/site-packages/binance/websocket/spot/websocket_stream.py", line 26, in __init__
    super().__init__(
TypeError: BinanceWebsocketClient.__init__() got an unexpected keyword argument 'timeout'

EDIT:

The issue is caused by this: #324
To fix, check the answer: #324 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants