Skip to main content

order_book_resync

Function order_book_resync 

Source
pub async fn order_book_resync<M: OrderBookSource + ?Sized>(
    md: &M,
    rx: &mut Receiver<Envelope>,
    id: &InstrumentId,
    prepare: impl FnOnce(),
)
Expand description

The order book stream is void after a break: a [Event::Resync] follows, then a fresh snapshot.

prepare sets the mock so that it breaks the stream after the first snapshot (it runs before the subscribe). Steps and checks, on one subscription:

  1. A [Event::Resync] for the subscription and the instrument arrives (books before it may or may not).
  2. A book arrives after the Resync: the stream came back.

§Panics

With [conformance:order_book_resync] <reason>.