An Example how to retrieve user account balance with ThreadedWebsocketManager?

Hello. May I kindly ask if there is any python example how to retrieve user account balance and open orders with ThreadedWebsocketManager, or with POST? I found definition of POSTs, but it is not clear to me how to use that POST to create and run websocket. Or better yet, is it possible with ThreadedWebsocketManager? (I could not get

I do agree on with your concep here.

Not familiar with ThreadedWebsocketManage, but we have Python SDK to use our API endpoints at GitHub - binance/binance-connector-python: a simple connector to Binance Public API

Thanks very much. I tried exaple here: https://github.com/binance/binance-connector-python/blob/master/examples/websocket/spot/user_data.py

and it works with testnet. Then I modified it for realnet:

client = Client(api_key, api_secret) #base_url="https://api.binance.vision")
response = client.new_listen_key()
logging.info("Receiving listen key : {}".format(response["listenKey"]))
ws_client = SpotWebsocketClient(stream_url="wss://api.binance.vision")
ws_client.start()

But I am gettig this error. Can you help please?
2022-12-28 15:13:18.532 UTC INFO binance.websocket.binance_client_factory: Start to connect…
2022-12-28 15:13:19.531 UTC WARNING binance.websocket.binance_client_protocol: WebSocket connection closed: connection was closed uncleanly (“WebSocket connection upgrade failed [403]: Forbidden”), code: 1006, clean: False, reason: connection was closed uncleanly (“WebSocket connection upgrade failed [403]: Forbidden”)
2022-12-28 15:13:19.531 UTC ERROR binance.websocket.binance_client_factory: Lost connection to Server. Reason: [Failure instance: Traceback (failure with no frames): <class ‘twisted.internet.error.ConnectionAborted’>: Connection was aborted locally using ITCPTransport.abortConnection.

Got it. the real address of the stream:
ws_client = SpotWebsocketClient(stream_url="wss://stream.binance.com")

1 Like