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 maybe_fill_voids(
&mut self,
uo: &UnmatchedOrder,
) -> Vec<FillVoidAllocation>
pub fn maybe_fill_voids( &mut self, uo: &UnmatchedOrder, ) -> Vec<FillVoidAllocation>
Allocates cumulative Betfair sv to known applied fill lots, newest first.
First-seen voids without known fill lots are recorded but emit no correction.
Sourcepub fn has_unseen_fill_void(&self, uo: &UnmatchedOrder) -> bool
pub fn has_unseen_fill_void(&self, uo: &UnmatchedOrder) -> bool
Returns whether a cumulative Betfair void update has not yet been applied.
Sourcepub fn has_unseen_fill(&self, uo: &UnmatchedOrder) -> bool
pub fn has_unseen_fill(&self, uo: &UnmatchedOrder) -> bool
Returns whether a cumulative Betfair fill update has not yet been applied.
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.
Monotonic in filled_qty: keeps the larger of the cached and
in-memory values so a cache that lags the tracker (engine has
not yet processed an emitted fill) cannot regress it.
Sourcepub fn seed_published_trade_ids<I, S>(&mut self, trade_ids: I)
pub fn seed_published_trade_ids<I, S>(&mut self, trade_ids: I)
Seeds the trade-id dedup set so fills already published via another channel are not re-emitted when the post-reconnect image arrives.
Trait Implementations§
Source§impl Clone for FillTracker
impl Clone for FillTracker
Source§fn clone(&self) -> FillTracker
fn clone(&self) -> FillTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FillTracker
impl Debug for FillTracker
Source§impl Default for FillTracker
impl Default for FillTracker
Source§fn default() -> FillTracker
fn default() -> FillTracker
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§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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