BrokerX WebSocket provides order placement, cancellation, modification, and server-pushed order and trade updates. After connecting, send LOGIN before any trading command.
Message format
Requests contain action, a caller-defined id, and args. Responses contain event, the echoed request id, code, message, and data. A response code of 0 means success; a nonzero code means failure. REST uses a different success code (200).
Login
URL
- WebSocket private subscription channels: wss://brokerx-wss.connex.trade/v1/private
Sign this exact string using HMAC-SHA256 and encode the result as a hexadecimal digest:
message = timestamp + "GET" + "/users/self/verify"
sign = HMAC-SHA256(secretKey, message).hexdigest()
timestamp is a Unix timestamp in seconds. The server accepts a ±30-second window. Outside this window, login fails with 118001 WS_AUTH_FAILED.
{
"action": "LOGIN",
"id": "req-001",
"args": {
"apiKey": "YOUR_API_KEY",
"timestamp": "1786673744",
"sign": "YOUR_HMAC_SHA256_HEX_DIGEST"
}
}
Generate a fresh timestamp and signature for each login. The sample timestamp is illustrative.
{
"event": "LOGIN_ACK",
"id": "req-001",
"code": 0,
"message": "success",
"data": null
}
Trading commands sent before login return 118002 WS_PERMISSION_DENIED. After successful login, order changes and executions associated with the account are pushed automatically; no subscription request is required.
Commands and events
| Message | Purpose |
|---|---|
| PLACE_ORDER | Place an order |
| CANCEL_ORDER | Cancel an order |
| REPLACE_ORDER | Modify an order |
| ORDER_UPDATE | Order status changes |
| TRADE_UPDATE | Executions |
WebSocket errors
| Code | Name | Meaning |
|---|---|---|
0 | - | Success |
118001 | WS_AUTH_FAILED | Invalid signature, unknown API key, or timestamp outside ±30 seconds |
118002 | WS_PERMISSION_DENIED | Not logged in or portfolio lacks permission |
112003 | ACCOUNT_NOT_FOUND | Unknown brokerClientId or no account mapping |
113001 | ORDER_PLACE_FAILED | Placement failed |
113004 | ORDER_MODIFY_FAILED | Modification failed |
113005 | ORDER_CANCEL_FAILED | Cancellation failed |
