Module client

Module client 

Source
Expand description

Provides the WebSocket client integration for the OKX WebSocket API.

The OKXWebSocketClient ties together several recurring patterns:

  • Heartbeats use text ping/pong, responding to both text and control-frame pings.
  • Authentication re-runs on reconnect before resubscribing and skips private channels when credentials are unavailable.
  • Subscriptions cache instrument type/family/ID groupings so reconnects rebuild the same set of channels while respecting the authentication guard described above.

Structs§

OKXWebSocketClient
Provides a WebSocket client for connecting to OKX.

Constants§

OKX_RATE_LIMIT_KEY_AMEND
Rate limit key for amend operations (amend orders).
OKX_RATE_LIMIT_KEY_CANCEL
Rate limit key for cancel operations (cancel regular and algo orders, mass cancel).
OKX_RATE_LIMIT_KEY_ORDER
Rate limit key for order operations (place regular and algo orders).
OKX_RATE_LIMIT_KEY_SUBSCRIPTION
Rate limit key for subscription operations (subscribe/unsubscribe/login).

Statics§

OKX_WS_CONNECTION_QUOTA
Default OKX WebSocket connection rate limit: 3 requests per second.
OKX_WS_ORDER_QUOTA
Rate limit for order-related WebSocket operations: 250 requests per second.
OKX_WS_SUBSCRIPTION_QUOTA
OKX WebSocket subscription rate limit: 480 requests per hour per connection.