pub struct FillTracker { /* private fields */ }Expand description
Tracks cumulative fill state per bet to compute incremental fills from the Betfair OCM stream.
Betfair provides cumulative sm (size matched) and avp (average price
matched) on each order update. This tracker maintains per-bet state to
derive individual fill quantities and prices for each update.
Implementations§
Source§impl FillTracker
impl FillTracker
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new FillTracker instance.
Sourcepub fn maybe_fill_report(
&mut self,
uo: &UnmatchedOrder,
order_qty: Decimal,
instrument_id: InstrumentId,
account_id: AccountId,
currency: Currency,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Option<FillReport>
pub fn maybe_fill_report( &mut self, uo: &UnmatchedOrder, order_qty: Decimal, instrument_id: InstrumentId, account_id: AccountId, currency: Currency, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Option<FillReport>
Computes an incremental [FillReport] for an unmatched order update.
Returns None if no new fill occurred (size matched unchanged,
duplicate trade ID, or overfill detected).
Sourcepub fn sync_order(&mut self, bet_id: &str, filled_qty: Decimal, avg_px: Decimal)
pub fn sync_order(&mut self, bet_id: &str, filled_qty: Decimal, avg_px: Decimal)
Pre-populates state for a bet from existing order data.
Called during reconnect sync so that the first stream update computes a correct incremental fill instead of treating the cumulative matched size as a new fill.
Trait Implementations§
Source§impl Debug for FillTracker
impl Debug for FillTracker
Source§impl Default for FillTracker
impl Default for FillTracker
Source§fn default() -> FillTracker
fn default() -> FillTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FillTracker
impl RefUnwindSafe for FillTracker
impl Send for FillTracker
impl Sync for FillTracker
impl Unpin for FillTracker
impl UnsafeUnpin for FillTracker
impl UnwindSafe for FillTracker
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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