Skip to main content
Spread trading operations use the OKX business WebSocket channel (/ws/v5/business), which is separate from the private channel used for regular order management. WebsocketAPIClient routes spread methods to the correct channel automatically.
Spread trading is available on the global OKX platform (www.okx.com). Make sure your account has spread trading enabled before using these methods.

submitSpreadOrder()

Place a new spread order.

Parameters

Response

Example


amendSpreadOrder()

Amend the price or quantity of an open spread order.

Parameters

Response

Example


cancelSpreadOrder()

Cancel an open spread order by order ID or client order ID.

Parameters

Response

Example


massCancelSpreadOrders()

Cancel all open spread orders, optionally filtered by spread instrument ID.

Parameters

The response data[0].result is true when the mass cancel was accepted.
Omitting sprdId cancels all open spread orders on your account. This cannot be undone.

Example


Using the business channel directly

If you need lower-level access, spread operations use WS_KEY_MAP.prodBusiness (or the equivalent demo/regional key). You can call sendWSAPIRequest() on the underlying WebsocketClient directly:
For most use cases, stick with WebsocketAPIClient. It selects the correct WS key automatically and provides per-operation type safety.