Events stream
Follow one exchange account live over WebSocket: a snapshot of its balances, working orders and positions, then a frame for every order change, fill, position and balance.
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 asnapshot: the account totals, balances, working orders and open positions. Then a frame arrives for every change:
| Frame | Sent when |
|---|---|
order | An order is placed, filled, partly filled, canceled or rejected. A final status (filled, partiallyFilledClosed, rejected, canceled, closed) means it’s no longer working. |
execution | A fill, a funding fee or another execution. Every fill comes as its own frame. |
position | A position changed. size "0" means it closed. |
balance | The totals or balances changed. |
commandError | A request accepted with 202 then failed, in TakeProfit or at the exchange. The stream goes on. |
notification | The outcome of a request or an account event: an order placed, rejected, amended or replaced, a bulk cancel, a position closed, reversed or protected. |
marginMode, spotMarginTrade | The account’s margin mode or spot margin trading changed. |
executionRebate | Cashback set on a fill already delivered (Exness only for now). |
warning | The connection to the exchange was interrupted, or data may have been missed. Reconnect to get a fresh snapshot. |
error | The stream ended. The socket closes after it. |
labelfilters 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
notificationframe hasorder.kindreplaced, and the order continues underorder.replacementOrderId: track the new id from then on. seqorders 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
errorframerate_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_consumerrather than slowing the account’s stream. - After an
errorframe, the stream is over. Reconnecting opens a new, newly charged subscription. Wait at leastretryAfterseconds when the frame has it.
{
"type": "snapshot",
"seq": 1,
"accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
"connectorCode": "binance_usdm",
"totals": {
"equity": "12500.00",
"availableBalance": "11900.00"
},
"balances": [
{
"asset": "USDT",
"equity": "12500.00",
"walletBalance": "12500.00",
"availableBalance": "11900.00"
}
],
"openOrders": [
{
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"kind": "limit",
"status": "placed",
"quantity": "0.001",
"cumExecQuantity": "0",
"price": "60000",
"timeInForce": "gtc",
"createdAt": "2026-11-20T10:15:00Z",
"updatedAt": "2026-11-20T10:15:01Z"
}
],
"positions": []
}{
"type": "order",
"seq": 2,
"order": {
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"kind": "limit",
"status": "filled",
"quantity": "0.001",
"cumExecQuantity": "0.001",
"cumExecValue": "60.00",
"price": "60000",
"avgPrice": "60000",
"timeInForce": "gtc",
"createdAt": "2026-11-20T10:15:00Z",
"updatedAt": "2026-11-20T10:21:44Z"
}
}{
"type": "execution",
"seq": 3,
"execution": {
"execId": "e-5521-1",
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"execType": "trade",
"execPrice": "60000",
"execQuantity": "0.001",
"execValue": "60.00",
"quoteCurrency": "USDT",
"execFee": "0.012",
"feeCurrency": "USDT",
"isMaker": true,
"execTime": "2026-11-20T10:21:44Z"
}
}{
"type": "position",
"seq": 4,
"position": {
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"marketType": "perpetual",
"contractType": "linear",
"side": "long",
"positionMode": "oneWay",
"size": "0.001",
"avgPrice": "60000",
"markPrice": "60010",
"unrealizedPnl": "0.01",
"leverage": "10",
"updatedAt": "2026-11-20T10:21:44Z"
}
}{
"type": "balance",
"seq": 5,
"totals": {
"equity": "12499.99",
"availableBalance": "11893.99"
},
"balances": [
{
"asset": "USDT",
"equity": "12499.99",
"walletBalance": "12499.988",
"availableBalance": "11893.99"
}
]
}{
"type": "commandError",
"seq": 6,
"orderId": "2a3b4c5d-6e7f-4809-9a1b-2c3d4e5f6a7b",
"code": "failed_precondition",
"message": "order rejected by the exchange",
"exchangeError": {
"code": "-2019",
"message": "Margin is insufficient."
}
}{
"type": "notification",
"seq": 8,
"connectorCode": "exness",
"notification": {
"timestamp": "2026-11-20T10:22:05Z",
"order": {
"kind": "replaced",
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"replacementOrderId": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"instrument": {
"exchange": "EXNESS",
"symbol": "EURUSD"
},
"side": "buy",
"orderType": "limit",
"quantity": "0.1",
"limitPrice": "1.0810",
"previousQuantity": "0.1",
"previousLimitPrice": "1.0800"
}
}
}{
"type": "<string>",
"seq": 123,
"connectorCode": "<string>",
"marginMode": "<string>"
}{
"type": "<string>",
"seq": 123,
"connectorCode": "<string>",
"enabled": true
}No examples found{
"type": "warning",
"seq": 7,
"reason": "dataMayBeMissing",
"message": "account updates may have been missed"
}{
"type": "error",
"error": {
"code": "rate_limited",
"message": "quota exceeded"
}
}Your API key.
Time of the upgrade request in Unix milliseconds.
Hex Ed25519 signature of timestamp + API key + receive window + raw query string.
GET
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.
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.
A user rebate written after its execution was delivered; it sets userRebateUsdt of the execution with execId. Exness only for now.
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.
The stream is over; the socket is closed after this frame.
Was this page helpful?
{
"type": "snapshot",
"seq": 1,
"accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
"connectorCode": "binance_usdm",
"totals": {
"equity": "12500.00",
"availableBalance": "11900.00"
},
"balances": [
{
"asset": "USDT",
"equity": "12500.00",
"walletBalance": "12500.00",
"availableBalance": "11900.00"
}
],
"openOrders": [
{
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"kind": "limit",
"status": "placed",
"quantity": "0.001",
"cumExecQuantity": "0",
"price": "60000",
"timeInForce": "gtc",
"createdAt": "2026-11-20T10:15:00Z",
"updatedAt": "2026-11-20T10:15:01Z"
}
],
"positions": []
}{
"type": "order",
"seq": 2,
"order": {
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"kind": "limit",
"status": "filled",
"quantity": "0.001",
"cumExecQuantity": "0.001",
"cumExecValue": "60.00",
"price": "60000",
"avgPrice": "60000",
"timeInForce": "gtc",
"createdAt": "2026-11-20T10:15:00Z",
"updatedAt": "2026-11-20T10:21:44Z"
}
}{
"type": "execution",
"seq": 3,
"execution": {
"execId": "e-5521-1",
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"exchangeOrderId": "8389765521",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"label": "grid-btc-1",
"side": "buy",
"execType": "trade",
"execPrice": "60000",
"execQuantity": "0.001",
"execValue": "60.00",
"quoteCurrency": "USDT",
"execFee": "0.012",
"feeCurrency": "USDT",
"isMaker": true,
"execTime": "2026-11-20T10:21:44Z"
}
}{
"type": "position",
"seq": 4,
"position": {
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"connectorCode": "binance_usdm",
"marketType": "perpetual",
"contractType": "linear",
"side": "long",
"positionMode": "oneWay",
"size": "0.001",
"avgPrice": "60000",
"markPrice": "60010",
"unrealizedPnl": "0.01",
"leverage": "10",
"updatedAt": "2026-11-20T10:21:44Z"
}
}{
"type": "balance",
"seq": 5,
"totals": {
"equity": "12499.99",
"availableBalance": "11893.99"
},
"balances": [
{
"asset": "USDT",
"equity": "12499.99",
"walletBalance": "12499.988",
"availableBalance": "11893.99"
}
]
}{
"type": "commandError",
"seq": 6,
"orderId": "2a3b4c5d-6e7f-4809-9a1b-2c3d4e5f6a7b",
"code": "failed_precondition",
"message": "order rejected by the exchange",
"exchangeError": {
"code": "-2019",
"message": "Margin is insufficient."
}
}{
"type": "notification",
"seq": 8,
"connectorCode": "exness",
"notification": {
"timestamp": "2026-11-20T10:22:05Z",
"order": {
"kind": "replaced",
"orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
"replacementOrderId": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"instrument": {
"exchange": "EXNESS",
"symbol": "EURUSD"
},
"side": "buy",
"orderType": "limit",
"quantity": "0.1",
"limitPrice": "1.0810",
"previousQuantity": "0.1",
"previousLimitPrice": "1.0800"
}
}
}{
"type": "<string>",
"seq": 123,
"connectorCode": "<string>",
"marginMode": "<string>"
}{
"type": "<string>",
"seq": 123,
"connectorCode": "<string>",
"enabled": true
}No examples found{
"type": "warning",
"seq": 7,
"reason": "dataMayBeMissing",
"message": "account updates may have been missed"
}{
"type": "error",
"error": {
"code": "rate_limited",
"message": "quota exceeded"
}
}