pub struct WsDispatchState {
pub order_identities: DashMap<ClientOrderId, OrderIdentity>,
pub pending_requests: DashMap<String, PendingRequest>,
pub cancel_replace_request_ids: DashMap<String, String>,
/* private fields */
}Expand description
Tracks order lifecycle state for dispatch routing.
Orders with a registered identity (submitted through this client) produce proper order events. Orders without identity (external or pre-existing) fall back to execution reports for reconciliation.
Fields§
§order_identities: DashMap<ClientOrderId, OrderIdentity>§pending_requests: DashMap<String, PendingRequest>§cancel_replace_request_ids: DashMap<String, String>Cancel-replace request IDs mapped to their cancelNewClientOrderId.
Implementations§
Source§impl WsDispatchState
impl WsDispatchState
pub fn has_emitted_accepted(&self, cid: &ClientOrderId) -> bool
Sourcepub fn insert_accepted(&self, cid: ClientOrderId)
pub fn insert_accepted(&self, cid: ClientOrderId)
Marks an order as having emitted an OrderAccepted event.
pub fn has_filled(&self, cid: &ClientOrderId) -> bool
Sourcepub fn insert_filled(&self, cid: ClientOrderId)
pub fn insert_filled(&self, cid: ClientOrderId)
Marks an order as having received a fill.
Sourcepub fn insert_cancel_replace(&self, cancel_id: String)
pub fn insert_cancel_replace(&self, cancel_id: String)
Records the cancelNewClientOrderId sent with a cancel-replace request.
Sourcepub fn has_cancel_replace(&self, cancel_id: &str) -> bool
pub fn has_cancel_replace(&self, cancel_id: &str) -> bool
Returns true when cancel_id belongs to a cancel-replace this client issued.
Sourcepub fn on_cancel_replace_canceled(
&self,
cancel_id: &str,
report: OrderStatusReport,
) -> bool
pub fn on_cancel_replace_canceled( &self, cancel_id: &str, report: OrderStatusReport, ) -> bool
Records the cancel half’s CANCELED report for a cancel-replace request.
Returns true when the report must be withheld because the replacement is
pending or succeeded, and false when it should dispatch as a standalone
cancel because the venue already rejected the replacement or the ID is not
one this client issued.
Sourcepub fn on_cancel_replace_rejected(
&self,
cancel_id: &str,
) -> Option<OrderStatusReport>
pub fn on_cancel_replace_rejected( &self, cancel_id: &str, ) -> Option<OrderStatusReport>
Records a rejected cancel-replace request.
Returns the withheld cancel report when it already arrived, so the caller can emit the confirmed cancellation for the original order.
pub fn insert_algo_order_id( &self, cid: ClientOrderId, venue_order_id: VenueOrderId, )
Sourcepub fn promote_algo_order_id(
&self,
cid: ClientOrderId,
venue_order_id: VenueOrderId,
) -> Option<bool>
pub fn promote_algo_order_id( &self, cid: ClientOrderId, venue_order_id: VenueOrderId, ) -> Option<bool>
Promotes a known Algo order to its matching-engine venue order ID.
Returns None for an unknown Algo order, Some(true) for a new ID, and
Some(false) when the ID was already current.
Sourcepub fn promoted_algo_order_id(
&self,
cid: &ClientOrderId,
) -> Option<VenueOrderId>
pub fn promoted_algo_order_id( &self, cid: &ClientOrderId, ) -> Option<VenueOrderId>
Returns the matching-engine venue order ID for a promoted Algo order.
Sourcepub fn cleanup_terminal(&self, cid: ClientOrderId)
pub fn cleanup_terminal(&self, cid: ClientOrderId)
Removes all tracking state for a terminal order.
Trait Implementations§
Source§impl Debug for WsDispatchState
impl Debug for WsDispatchState
Auto Trait Implementations§
impl !Freeze for WsDispatchState
impl !RefUnwindSafe for WsDispatchState
impl Send for WsDispatchState
impl Sync for WsDispatchState
impl Unpin for WsDispatchState
impl UnsafeUnpin for WsDispatchState
impl UnwindSafe for WsDispatchState
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
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