python-binance

WebsocketAPI

Attributes

attributeconnection_lockasyncio.Lock

Functions

func__init__(self, url, tld='com', testnet=False, https_proxy=None)
paramself
paramurlstr
paramtldstr
= 'com'
paramtestnetbool
= False
paramhttps_proxyOptional[str]
= None

Returns

None
funcregister_subscription_queue(self, subscription_id, queue) -> None

Register a queue to receive events for a specific subscription.

paramself
paramsubscription_idstr
paramqueueasyncio.Queue

Returns

None
funcunregister_subscription_queue(self, subscription_id) -> None

Unregister a subscription queue.

paramself
paramsubscription_idstr

Returns

None
func_handle_message(self, msg)

Override message handling to support request-response

paramself
parammsg

Returns

None
func_ensure_ws_connection(self) -> None

Ensure WebSocket connection is established and ready

This function will:

  1. Check if connection exists and is streaming
  2. Attempt to connect if not
  3. Wait for connection to be ready
  4. Handle reconnection if needed
paramself

Returns

None
funcrequest(self, id, payload) -> dict

Send request and wait for response

paramself
paramidstr
parampayloaddict

Returns

dict
func__aexit__(self, exc_type, exc_val, exc_tb)

Clean up responses before closing

paramself
paramexc_type
paramexc_val
paramexc_tb

Returns

None

On this page