subscribe/unsubscribe
Subscribe/unsubscribe to order/portfolio notifications on the same connection — required to
receive the real final order status after order.place/order.amend/order.cancel has
responded PD (see "Place/amend/cancel orders: fast acknowledgment, result arrives later" at the
top of this document). This message requires no signature and carries no id.
This API only supports channel TRADING, with 2 topic types:
order.{accountNo}— order match and partial-match notifications.portfolio.{accountNo}— asset/portfolio change notifications, derivative accounts only (suffix 8).
Both notification types use the same data structure as channel TRADING on the FastConnect
WebSocket API (market data) — see field details at
Sub/Unsub Trading Data.
Note: every topic must name a specific accountNo — the * wildcard is not supported,
and that account must be owned by the API Key in use (you cannot subscribe to another customer's
account data).
Subscribe sample:
{ "method": "SUBSCRIBE", "channel": "TRADING", "topics": ["order.0901351", "portfolio.1231996"] }
Ack:
{ "method": "SUBSCRIBE", "channel": "TRADING", "status": "ok", "message": "Subscribed to 2 topic(s)" }
If status: "error", message describes the reason (malformed topic syntax, missing permission,
or an account not owned by the caller).
Sample notification (order.{accountNo}):
{ "channel": "TRADING", "topic": "order.0901351", "data": { "eventType": "orderEvent", "clientRequestId": "req-0001", "orderId": "ORD123456", "orderStatus": "FF", "...": "..." } }
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Message the client sends to subscribe/unsubscribe or ping/pong the connection. Has no `id` field.
The request's action. Case-insensitive.
The data channel to subscribe to. Only `TRADING` is supported for SUBSCRIBE/UNSUBSCRIBE (ignored for PING_PONG/PING_ONLY).
List of topics to subscribe/unsubscribe, syntax `{type}.{accountNo}` with `type` ∈ `order, portfolio`. The `*` wildcard for accountNo is **not supported** (unlike the FastConnect WebSocket API) — every topic must name exactly one `accountNo` owned by the API Key. Empty on UNSUBSCRIBE means unsubscribe from all currently-subscribed topics.
Response Body
application/json
Sample Request
wscat -c wss://api.ssi.com.vn/ws/v3/trading -x '{
"method": "SUBSCRIBE",
"channel": "TRADING",
"topics": [
"order.0901351",
"portfolio.1231996"
]
}'Sample Response
{
"method": "SUBSCRIBE",
"channel": "TRADING",
"status": "ok",
"message": "Subscribed to 2 topic(s)"
}