Request
Authenticate the same way as the other order endpoints. The stream carries only the authenticated user’s own orders: an account you have no orders on streams an empty snapshot and nothing after it.
Events
A
: ping comment is sent every 15 seconds to keep idle connections open.
snapshot
orders holds every order on the account in an open state: pending_new, new, partially_filled, or unknown. Each order has the same shape as data.order in Get Prediction Order.
order
order is the whole order as it stands after the change, not a delta: replace what you hold for that orderId. Orders reaching a final state (filled, canceled, rejected, expired, done_for_day) arrive this way too, and so do orders placed after you connected.
resync
resync. Reconnect, and the new snapshot brings your view up to date. slow_client means you stopped reading events fast enough to keep up; shutdown means the server is restarting.
Ordering
- Every order carries a
versionthat rises with each change. Keep the highestversionyou have seen for eachorderId, and ignore an order at or below it. The stream already drops older versions, but applying this rule makes your client correct across reconnects too. snapshotcomes first. Everyorderafter it is newer than the snapshot’s copy of that order.- Changes to one order arrive in the order they happened. Changes to different orders may interleave.
Reconnecting
Events have no IDs and are not replayed. Every connection starts with a freshsnapshot, so after a disconnect or a resync, reconnect and replace your open orders with the new snapshot. A change that happened while you were disconnected is reflected in it. An order that reached a final state while you were away drops out of the snapshot; read it with List Prediction Orders if you need it.
Examples
cURL
EventSource cannot send an Authorization header, so read the stream with fetch:
JavaScript
Working with the stream
- Prices and quantities are decimal strings.
"0.54", not0.54. Parse them with a decimal type. - Optional fields are omitted when absent, never sent as zero.
- Do not put the stream behind a buffering proxy. Events must reach you as they are sent.