Subscribe to ACCOUNT
Send a SUBSCRIBE message naming ACCOUNT. The server answers with a SUBSCRIPTIONS confirmation, or an error. You must authenticate first; otherwise the request is rejected with AUTHENTICATION_REQUIRED. The confirmation carries the account_id of the account your token authenticated.
Private. Events about your account, such as changes of state of your take profit / stop loss orders (TP/SLs). One subscription covers your main account and every subaccount; each message carries the account_id it belongs to. The channel sends no snapshot, and messages are not replayed after a reconnect: use Get Exotic Orders (TP/SL) on the REST API to read the current state.
apiTokenAuthorizationBearer <token>API token sent in the AUTHENTICATE message (not as a header). Generate it in the One Trading UI with the Trade permission; a valid token authorises all private channels for the connection.
const payload = { "type": "SUBSCRIBE", "channels": [ { "name": "ACCOUNT" } ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});Requires a prior successful AUTHENTICATE. One subscription covers your main account and every subaccount.
- payload
type*stringchannels*array<>1 <= items <= 1Subscribe to the ACCOUNT channel
{ "type": "SUBSCRIBE", "channels": [ { "name": "ACCOUNT" } ]}Reply
Sent back on the same channel.