Skip to main content
WSS
The events stream is how you see the outcome of every request you send over REST. Connect to wss://public-api.charting.com/api/v1/trading/events/stream with accountId, connectorCode when the account has more than one connector, and optionally label in the query string. Sign the handshake like a GET (see Sign every request). After it, the client sends nothing.

Frames

The first frame is a snapshot: the account totals, balances, working orders and open positions. Then a frame arrives for every change:
  • label filters orders and fills, and the snapshot’s orders, to your script’s orders. Positions and balances are account-wide and never filtered.
  • An amend can replace the order. On a connector that can’t amend in place, the amend cancels the order and places a new one. The notification frame has order.kind replaced, and the order continues under order.replacementOrderId: track the new id from then on.
  • seq orders the frames of one connection, starting at 1 with the snapshot. After a reconnect, the new snapshot replaces everything you hold.

Staying connected

  • Credits: 25 from the streaming quota when the stream opens, and again in every 300-second window it stays open. If a window is already spent at renewal, the stream ends with an error frame rate_limited.
  • At most 5 trading streams per account, across all keys.
  • The key is rechecked at least every 5 minutes. A revoked or expired key ends the stream with permission_denied.
  • Pings: the server pings every 30 seconds and closes the connection if no pong arrives within 5 seconds.
  • Read fast enough. A client that falls behind is disconnected with slow_consumer rather than slowing the account’s stream.
  • After an error frame, the stream is over. Reconnecting opens a new, newly charged subscription. Wait at least retryAfter seconds when the frame has it.
X-API-KEY
type:httpApiKey

Your API key.

X-API-TIMESTAMP
type:httpApiKey

Time of the upgrade request in Unix milliseconds.

X-API-SIGNATURE
type:httpApiKey

Hex Ed25519 signature of timestamp + API key + receive window + raw query string.

method
type:string

GET

query
type:object
Account snapshot
type:object
Order changed
type:object
Execution
type:object
Position changed
type:object
Balances changed
type:object
A request failed during processing
type:object

A request you sent over REST was accepted (202) for asynchronous processing but then failed, in TakeProfit or at the exchange. Not terminal: the stream continues.

Notification
type:object

The outcome of a request you sent over REST (an order placed, rejected, amended or replaced; a bulk cancel; a position closed or protected) or an account event (a position closed or reversed, an execution, a higher margin window). Not terminal.

Margin mode changed
type:object
Spot margin trading switched
type:object
Rebate of an execution
type:object

A user rebate written after its execution was delivered; it sets userRebateUsdt of the execution with execId. Exness only for now.

Stream degraded
type:object

Not terminal: the stream continues. exchangeSession - the connection to the exchange was interrupted and is being restored; requests may fail until it is. dataMayBeMissing - some account changes may have been missed; to resynchronise, reconnect and take the fresh snapshot.

Terminal error
type:object

The stream is over; the socket is closed after this frame.