Event Contracts channel

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>"
  }
}
FieldTypeRequiredDescription
authorizationstringYesYour access token.
payload.typestringYesAlways subscribe-event-contracts.
payload.account_idstringYesAccount 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"
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways subscribe-event-contracts-ack.
payload.account_idstringYesThe account you sent in your request echoed back.
payload.successbooleanYesTrue if successful, false otherwise.
payload.detailsstringYesAdditional 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"
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways 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": {...}
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways event-contract-order-update.
payload.dataobjectYesEvent 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": {...}
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways event-contract-trade-notice.
payload.dataobjectYesEvent 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": {...}
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways event-contract-position-update.
payload.dataobjectYesEvent 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": {...}
  }
}
FieldTypeRequiredDescription
timestampnumberYesMilliseconds since epoch timestamp of when the server sent the message.
channelstringYesAlways event-contracts.
payload.typestringYesAlways event-contract-cash-balance-update.
payload.dataobjectYesEvent contract cash balance object in the same shape as the response to Get event contract cash balance.