Private WebSocket for real-time account updates and order management.
After authenticating, the server automatically pushes real-time updates for your orders, trade executions, asset balances, positions, and margin calls. You can also place, replace, and cancel orders directly over the same WebSocket connection without needing separate REST API calls.
WebSocket URL: wss://wss.liquiditytech.com/v1/private
Supported exchanges: BINANCE / OKX / EDX
Connection & Authentication
- Establish Connection: Connect to the WebSocket URL above and send a
loginrequest immediately. - Authentication Required: All private channels require authentication. The server will not push any data until the login process is successful.
- Connection Maintenance: * 3he server may disconnect due to cloud service abnormalities or system updates.
- Crucial: Even with a successful login, the connection will be terminated if the client remains inactive for 30 seconds.
- Action Required: Implement automatic reconnection logic and refer to the Heartbeat & Connection Stability section to maintain an active state via regular pings.
Authentication
Send a login message immediately after connecting. All subsequent push data and order actions are only available after a successful login response.
{
"action": "login",
"args": {
"apiKey": "your_api_key",
"timestamp": "1538054050",
"sign": "your_signature"
}
}
Signature: HMAC-SHA256(secret, timestamp + "GET" + "/users/self/verify"), hex-encoded.
import hmac, hashlib, time
timestamp = str(int(time.time()))
message = timestamp + "GET" + "/users/self/verify"
sign = hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()
Success response:
{ "id": null, "event": "login", "code": 0, "msg": "", "data": null }
Failure response:
{ "id": null, "event": "login", "code": 60009, "msg": "Login failed." }
| Field | Type | Required | Description |
|---|---|---|---|
args.apiKey | String | Yes | Your API key |
args.timestamp | String | Yes | Current Unix timestamp in seconds |
args.sign | String | Yes | HMAC-SHA256 signature (see above) |
args.onlyTrade | Boolean | No | Default false; set true to restrict this connection to order actions only (no push data) |
Rate Limits
| Action | Limit |
|---|---|
| Login | 1 request per second per API key |
| Place Order | 1200 requests per 60 seconds |
| Replace Order | 300 requests per 60 seconds |
| Cancel Order | 1200 requests per 60 seconds |
| Cancel Orders (Batch) | 1200 requests per 60 seconds |
Heartbeat
The 30-Second Timeout (Crucial)
Maintaining a stable connection is critical. Please pay close attention to the 30-second inactivity rule to avoid frequent disconnections.
- How it works: The server sends a protocol-level ping shortly after the connection is established. Most libraries handle this automatically.
- The Risk: If your client does not send any messages (pings or subscriptions) and the server has no data to push to you for 30 seconds, you will be disconnected.
Keep-Alive Strategy (JSON Ping)
To prevent unexpected closures, you must send an application-level JSON ping at regular intervals.
- Recommended Interval: Every 10 seconds.
- When it's mandatory: If you are subscribed to low-frequency channels or have no active subscriptions, you must send explicit pings.
Message Format
Client ping:
You can send a ping at any time to verify the connection.
{ "ping": 1769050973831 }
Server response:
The server will immediately return a pong with the corresponding timestamp.
{ "pong": 1769050974552 }
💡 Developer Tips for Stability
- Handle Terminations Gracefully: Always implement an
onCloselistener to trigger an automatic reconnection logic if the 30s timeout is breached. - Don't wait for 30s: Network latency can cause a 29th-second ping to arrive late. Setting your heartbeat at 10-15 seconds is the safest industry standard.
- Background Throttling: If running in a browser, be aware that setInterval might be throttled in background tabs. Use Web Workers or check the connection state on tab focus.
Available Pages
| Page | Description |
|---|---|
| User Data | Real-time push: orders, trades, assets, positions, margin calls |
| Place Order | Submit a new order over WebSocket |
| Replace Order | Amend the price or quantity of an open order |
| Cancel Order | Cancel a single order by order ID or client order ID |
| Cancel Orders | Cancel all open orders, optionally filtered by exchange |
