Websocket stream

Defines the MexcWebsocketClient.

class mexc_api.websocket.websocket_stream.SpotWebsocketStreamClient(api_key: str, api_secret: str, on_message: Callable[[dict], None], on_open: Callable[[], None] | None = None, on_close: Callable | None = None, on_error: Callable | None = None)

Handles the stream subscriptions.

account_deals(action: Action = Action.SUBSCRIBE) None

Subscribes to account deals.

account_orders(action: Action = Action.SUBSCRIBE) None

Subscribes to account orders.

account_updates(action: Action = Action.SUBSCRIBE) None

Subscribes to account updates.

book_ticker(symbol: str, action: Action = Action.SUBSCRIBE) None

Subscribes to the book ticker stream of a symbol.

diff_depth(symbol: str, action: Action = Action.SUBSCRIBE) None

Subscribes to the increase depth stream of a symbol.

klines(symbol: str, interval: StreamInterval, action: Action = Action.SUBSCRIBE) None

Subscribes to the kline stream of a symbol.

partial_depth(symbol: str, level: Literal[5, 10, 20], action: Action = Action.SUBSCRIBE) None

Subscribes to the partial depth stream of a symbol.

stop() None

Stops the websocket connection.

trades(symbol: str, action: Action = Action.SUBSCRIBE) None

Subscribes to the trade stream of a symbol.