This article contains direct links to the official technical API documentation for developers to set up WebSocket trading on WhiteBIT.
Order Management via WebSocket
The "WebSocket Trading" feature provides direct order management via the WhiteBIT API, which simplifies event-driven trading workflows and reduces latency when placing or canceling orders by minimizing intermediate communication steps.
When building a new integration or updating an existing trading system, all current methods, technical requirements, and examples can be found in the "WebSocket Trading" section of WhiteBIT's public API documentation.
This section includes detailed information on:
supported operations and parameters
connection authentication and security
rate limits
order status and execution handling
Practical Trading Workflow
Below is an example of how an automated system can handle rapid order adjustments using a single persistent WebSocket connection instead of multiple REST requests.
The Cancel-and-Replace Loop
Consider a trading system that places buy and sell orders simultaneously. When price or market conditions change, the system checks whether its active orders are still aligned with the strategy. If they are no longer relevant, it replaces them through a single connection:
The system receives real-time order book updates through the open WebSocket channel.
The trading algorithm processes the data and calculates updated parameters for the new orders.
The system sends a "cancel" instruction to close the outdated active order.
The system sends a "place" instruction to submit a new order with the updated parameters.
This workflow minimizes the time a stale order remains active in the order book, helping protect your capital from adverse price movements.
Monitored Market Data
A trading system can monitor and respond to specific real-time data variables depending on the selected market.
For Perpetual Futures
- Index Price — the aggregated reference price of the underlying asset across major exchanges
- Mark Price — the calculated reference price used to assess positions, calculate unrealized PnL, and trigger liquidations
- Funding Rate — the periodic fee exchanged between long and short position holders
- PnL — the current realized or unrealized profit or loss of active positions
For Spot Trading
- Latest trade price — the execution price of the most recent transaction on the exchange
- Order book quotes — the best available bid and ask prices in the market
- Trading volume — the total volume of the asset traded over a specified period