pub struct ExecutionStream { /* private fields */ }Expand description
Execution events and order error events of one account, in the order the server sent them.
The stream starts with the first event that arrives after it was created and goes on
across reconnections; events the server sent while the connection was down are not sent
again, so after a reconnection the state of the account is read anew with
OpenApiClient::reconcile.
A stream that is read too slowly loses events: the connection holds a limited number of
them, set with
ConnectionOptions::event_capacity.
The loss is reported once by ExecutionStream::next with ConnectorError::Lagged and
the stream then goes on with the oldest event still held.
Implementations§
Source§impl ExecutionStream
impl ExecutionStream
Sourcepub async fn next(&mut self) -> Result<TradeEvent, ConnectorError>
pub async fn next(&mut self) -> Result<TradeEvent, ConnectorError>
Waits for the next event of the account.
§Errors
Returns ConnectorError::Closed when the connection is shut down,
ConnectorError::SessionEnded when the server ended the authorisation of the account,
ConnectorError::Lagged when events were dropped because the stream was read too
slowly, and ConnectorError::Value when the server sends a value out of range; the
stream can be read on after the last two.