pub struct TradingEvents(/* private fields */);Expand description
The stream Trading::events returns: the account’s acknowledgements and
fills, from an unbounded queue.
It is Send, Unpin and 'static, so a consumer can move it onto a task
of its own, whether it reached the venue statically or through
Arc<DynTrading<'static>>. (A trait method returning impl Stream + 'static
would lose the 'static through the dyn wrapper, so the stream is this
named type.)
Its first item is TradingEvent::Resync, unless the stream cannot open,
when its only item is that error. The venue replays nothing: after
every reconnect of the connection that carries fills, and when the venue
voids a fill it reported (a trade that failed after it matched, which the
stream has no event to take back), the stream yields Resync before any
later fill. What happened while the connection was down will not arrive, and
the consumer reconciles through Trading::open_orders and the venue’s
trade history.
An Err item the venue recovered from, such as a lost connection it
re-established, is followed by more items. After one it could not recover
from, the stream ends. None means the feed has stopped for good.
Implementations§
Source§impl TradingEvents
impl TradingEvents
Sourcepub fn new(
stream: impl Stream<Item = Result<TradingEvent, ClassifiedError>> + Send + 'static,
) -> Self
pub fn new( stream: impl Stream<Item = Result<TradingEvent, ClassifiedError>> + Send + 'static, ) -> Self
Wraps the stream a Trading implementation feeds from its queue.