Skip to Content
Account

Subscribe to ACCOUNT

Send
/
Serverwss://streams.fast.onetrading.com

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.

Authorization

apiToken
headerAuthorizationBearer <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.

Code Sample
const payload = {  "type": "SUBSCRIBE",  "channels": [    {      "name": "ACCOUNT"    }  ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => {  socket.send(JSON.stringify(payload));});

Messages

Requires a prior successful AUTHENTICATE. One subscription covers your main account and every subaccount.

application/json
  1. payload
type*string
channels*array<>
Items1 <= items <= 1
account

Subscribe to the ACCOUNT channel

{  "type": "SUBSCRIBE",  "channels": [    {      "name": "ACCOUNT"    }  ]}

Reply

Receive

Sent back on the same channel.