This WebSocket channel provides you a updates related to your trading activity. Please see our WebSocket guide for information on Authentication with WebSockets and common messages.
This channel contains sequenced messages, which are messages that contain a sequence field indicating the order of the message for a specific account. This is a monotonic sequence number you can use to detect gaps and validate ordering of messages. After you subscribe to this channel, you will get a replay of all sequenced messages for the requested account from the beginning of the day.
Messages that do not contain a sequence field are not sequenced and therefore are not replayed.
Every message the server sends on this channel carries a channel field set to activity, except heartbeats, which carry no channel. Use it to route messages when you are subscribed to more than one channel on the same socket.
Subscribe Activity
You send the following message when you want to subscribe to this channel for a particular account.
{
"authorization": "<access-token>",
"payload": {
"type": "subscribe-activity",
"account_id": "<account-id>"
}
}| Field | Type | Required | Description |
|---|---|---|---|
authorization | string | Yes | Your access token. |
payload.type | string | Yes | Always subscribe-activity. |
payload.account_id | string | Yes | Account you want to subscribe to. |
Subscribe Activity Ack
You receive this message to indicate success or failure of the subscription request you sent. Note, if your request is malformed or otherwise not parsable, you'll instead get an Error Notice.
{
"timestamp": 1711076847030,
"channel": "activity",
"payload": {
"type": "subscribe-activity-ack",
"account_id": "<account-id>",
"success": true,
"details": "Subscribed successfully"
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
payload.type | string | Yes | Always subscribe-activity-ack. |
payload.account_id | string | Yes | The account you sent in your request echoed back. |
payload.success | boolean | Yes | True if successful, false otherwise. |
payload.details | string | Yes | Additional details. |
Replay Complete
You receive this message after all sequenced messages have been replayed. Sequenced messages are automatically replayed after your subscribe to this channel. This message lets you know that the replay is complete.
{
"timestamp": 1711076847030,
"channel": "activity",
"payload": {
"type": "replay-complete"
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
payload.type | string | Yes | Always replay-complete. |
Order Update
You receive this message anytime an order changes state.
{
"timestamp": 1711076847030,
"channel": "activity",
"sequence": 123,
"payload": {
"type": "order-update",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
sequence | number | Yes | Monotonic sequence number. |
payload.type | string | Yes | Always order-update. |
payload.data | object | Yes | Order object in the same shape as the response to Get Order. |
Trade Notice
You receive this message anytime an open order is executed against.
{
"timestamp": 1711076847030,
"channel": "activity",
"sequence": 124,
"payload": {
"type": "trade-notice",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
sequence | number | Yes | Monotonic sequence number. |
payload.type | string | Yes | Always trade-notice. |
payload.data | object | Yes | Trade object in the same shape as the response to Get trade. |
Position Update
You receive this message anytime your position in a symbol changes.
{
"timestamp": 1711076847030,
"channel": "activity",
"sequence": 124,
"payload": {
"type": "position-update",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
sequence | number | Yes | Monotonic sequence number. |
payload.type | string | Yes | Always position-update. |
payload.data | object | Yes | Position object in the same shape as the response to Get position |
Buying Power
You receive this message when your buying power changes, if applicable.
{
"timestamp": 1711076847030,
"channel": "activity",
"sequence": 124,
"payload": {
"type": "buying-power-update",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
sequence | number | Yes | Monotonic sequence number. |
payload.type | string | Yes | Always buying-power-update. |
payload.data | object | Yes | Buying power update details. |
Locate Inventory
You receive this message when your locate inventory changes, if applicable.
{
"timestamp": 1711076847030,
"channel": "activity",
"sequence": 124,
"payload": {
"type": "locate-inventory-update",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always activity. |
sequence | number | Yes | Monotonic sequence number. |
payload.type | string | Yes | Always locate-inventory-update. |
payload.data | object | Yes | Locate inventory update details. |