This WebSocket channel provides you updates related to your event contract orders, trades, positions, and cash balance. Please see our WebSocket guide for information on Authentication with WebSockets and common messages.
When you subscribe to this channel, the server first replays the current state of your orders, recent trades, positions, and cash balance, then sends a Replay Complete message, and then continues with live updates.
Every message the server sends on this channel carries a channel field set to event-contracts, 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 Event Contracts
You send the following message when you want to subscribe to this channel for a particular account.
{
"authorization": "<access-token>",
"payload": {
"type": "subscribe-event-contracts",
"account_id": "<account-id>"
}
}| Field | Type | Required | Description |
|---|---|---|---|
authorization | string | Yes | Your access token. |
payload.type | string | Yes | Always subscribe-event-contracts. |
payload.account_id | string | Yes | Account you want to subscribe to. |
Subscribe Event Contracts 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": "event-contracts",
"payload": {
"type": "subscribe-event-contracts-ack",
"account_id": "<account-id>",
"success": true,
"details": "Successfully subscribed"
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always event-contracts. |
payload.type | string | Yes | Always subscribe-event-contracts-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 the current state of your orders, trades, positions, and cash balance has been replayed. This message lets you know that the replay is complete and that subsequent messages are live updates.
{
"timestamp": 1711076847030,
"channel": "event-contracts",
"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 event-contracts. |
payload.type | string | Yes | Always replay-complete. |
Event Contract Order Update
You receive this message when replaying current event contract orders upon subscription, as well as anytime an event contract order is created or changes state.
{
"timestamp": 1711076847030,
"channel": "event-contracts",
"payload": {
"type": "event-contract-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 event-contracts. |
payload.type | string | Yes | Always event-contract-order-update. |
payload.data | object | Yes | Event contract order object in the same shape as the response to Get event contract order. |
Event Contract Trade Notice
You receive this message when replaying current event contract trades upon subscription, as well as anytime an event contract order is executed against.
{
"timestamp": 1711076847030,
"channel": "event-contracts",
"payload": {
"type": "event-contract-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 event-contracts. |
payload.type | string | Yes | Always event-contract-trade-notice. |
payload.data | object | Yes | Event contract trade object in the same shape as the response to Get event contract trade. |
Event Contract Position Update
You receive this message when replaying current event contract positions upon subscription, as well as anytime an event contract position changes.
{
"timestamp": 1711076847030,
"channel": "event-contracts",
"payload": {
"type": "event-contract-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 event-contracts. |
payload.type | string | Yes | Always event-contract-position-update. |
payload.data | object | Yes | Event contract position object in the same shape as an entry in the response to List event contract positions. |
Event Contract Cash Balance Update
You receive this message when replaying current event contracts cash balance for the account upon subscription, as well as anytime the event contracts cash balance for the account changes.
{
"timestamp": 1711076847030,
"channel": "event-contracts",
"payload": {
"type": "event-contract-cash-balance-update",
"data": {...}
}
}| Field | Type | Required | Description |
|---|---|---|---|
timestamp | number | Yes | Milliseconds since epoch timestamp of when the server sent the message. |
channel | string | Yes | Always event-contracts. |
payload.type | string | Yes | Always event-contract-cash-balance-update. |
payload.data | object | Yes | Event contract cash balance object in the same shape as the response to Get event contract cash balance. |