The Events API provides event push as well as historical queries via SSE (server sent events).
This stream is correspondent-scoped and v2-only. A subscriber receives rebalancer events for their own correspondent. Every event_id is a ULID.
You can listen to portfolio status changes, portfolio run creation, and portfolio run status changes.
Historical events are streamed immediately if queried, and updates are pushed as events occur.
Query Params Rules:
sincerequired ifuntilspecifiedsince_idrequired ifuntil_idspecifiedsinceandsince_idcan't be used at the same timeuntilanduntil_idcan't be used at the same time
Behavior:
- if
sinceorsince_idnot specified this will not return any historic data - if
untiloruntil_idreached stream will end (status 200) - the
Last-Event-Idrequest header, when present, is used assince_idand takes precedence over thesince_idquery parameter. Combining it withsincereturns an error, the same as sendingsinceandsince_idtogether. sinceanduntilselect events by the time encoded inevent_id(when the event was emitted), not byat. To resume reliably, usesince_idorLast-Event-Id.
Event types
event_type selects the payload:
portfolio.status_changedcarries the portfolio snapshot. Weights and rebalance conditions are included.symbolis always present on a weight and isnullfor cash.run.createdandrun.status_changedboth carry the full run snapshot:id,account_id,portfolio_id,type,initiated_from,status,reason,created_at,updated_at,completed_at, andcanceled_at.weights,orders,failed_orders, andskipped_ordersare omitted; read them fromGET /v1/rebalancing/runs/{run_id}.- Run
statuson this stream isQUEUED,IN_PROGRESS,CANCELED,ERROR,TIMEOUT,COMPLETED_ADJUSTED, orCOMPLETED_SUCCESS.CANCELED_MID_RUNis not sent.
correspondent is not included in the event JSON.
Note for people using the clients generated from this OAS spec. Currently OAS-3 doesn't have full support for representing SSE style responses from an API, so if you are using a generated client and don't specify a since and until there is a good chance the generated clients will hang waiting for the response to end.
If you require the streaming capabilities we recommend not using the generated clients for this specific usecase until the OAS-3 standards come to a consensus on how to represent this correctly in OAS-3.