pub struct BookStreamChecker { /* private fields */ }Expand description
Checks adapter order book output against the book stream contract.
Implementations§
Source§impl BookStreamChecker
impl BookStreamChecker
Sourcepub fn new(book_type: BookType, sequenced: bool) -> Self
pub fn new(book_type: BookType, sequenced: bool) -> Self
Creates a checker; sequenced requires each incremental event group’s sequence to exceed
the previous one.
Emitted deltas do not carry a venue’s linkage fields, so the adapter’s tracker validates
linkage. Pass false for a venue whose sequence can reset within an episode, such as OKX,
and rely on Self::verify against venue truth.
Sourcepub fn open(&mut self, instrument_id: InstrumentId)
pub fn open(&mut self, instrument_id: InstrumentId)
Accepts output for a subscribed book; its next batch must be a snapshot.
Sourcepub fn close(&mut self, instrument_id: InstrumentId)
pub fn close(&mut self, instrument_id: InstrumentId)
Rejects later output for a book after a settled unsubscribe or client stop.
Sourcepub fn apply(
&mut self,
deltas: &OrderBookDeltas,
) -> Result<(), BookContractViolation>
pub fn apply( &mut self, deltas: &OrderBookDeltas, ) -> Result<(), BookContractViolation>
Applies one emitted batch.
§Errors
Returns an error if the batch violates the book contract. The error reports the first violation.
Sourcepub fn verify(
&mut self,
instrument_id: InstrumentId,
depth: usize,
bids: &BTreeMap<Decimal, Decimal>,
asks: &BTreeMap<Decimal, Decimal>,
) -> Result<(), BookContractViolation>
pub fn verify( &mut self, instrument_id: InstrumentId, depth: usize, bids: &BTreeMap<Decimal, Decimal>, asks: &BTreeMap<Decimal, Decimal>, ) -> Result<(), BookContractViolation>
Compares the top depth levels with venue truth, counting the current episode verified.
§Errors
Returns an error if either side differs or no snapshot has arrived since the book opened.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BookStreamChecker
impl RefUnwindSafe for BookStreamChecker
impl Send for BookStreamChecker
impl Sync for BookStreamChecker
impl Unpin for BookStreamChecker
impl UnsafeUnpin for BookStreamChecker
impl UnwindSafe for BookStreamChecker
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more