pub struct OrderManager { /* private fields */ }Expand description
Manages order state and fill deduplication.
Implementations§
Source§impl OrderManager
impl OrderManager
Sourcepub fn get(&self, client_id: &ClientOrderId) -> Option<&LiveOrder>
pub fn get(&self, client_id: &ClientOrderId) -> Option<&LiveOrder>
Get an order by client_id
Sourcepub fn get_mut(&mut self, client_id: &ClientOrderId) -> Option<&mut LiveOrder>
pub fn get_mut(&mut self, client_id: &ClientOrderId) -> Option<&mut LiveOrder>
Get a mutable order by client_id
Sourcepub fn contains(&self, client_id: &ClientOrderId) -> bool
pub fn contains(&self, client_id: &ClientOrderId) -> bool
Check if we’re tracking an order
Sourcepub fn create_order(
&mut self,
client_id: ClientOrderId,
instrument: InstrumentId,
side: OrderSide,
price: Price,
qty: Qty,
) -> &LiveOrder
pub fn create_order( &mut self, client_id: ClientOrderId, instrument: InstrumentId, side: OrderSide, price: Price, qty: Qty, ) -> &LiveOrder
Create a new order (when PlaceOrder command is emitted)
Sourcepub fn accept_order(
&mut self,
client_id: &ClientOrderId,
exchange_order_id: Option<ExchangeOrderId>,
) -> bool
pub fn accept_order( &mut self, client_id: &ClientOrderId, exchange_order_id: Option<ExchangeOrderId>, ) -> bool
Mark order as accepted
Sourcepub fn reject_order(&mut self, client_id: &ClientOrderId) -> Option<LiveOrder>
pub fn reject_order(&mut self, client_id: &ClientOrderId) -> Option<LiveOrder>
Mark order as rejected and remove it
Sourcepub fn apply_fill(
&mut self,
client_id: &ClientOrderId,
trade_id: &TradeId,
fill_qty: Qty,
fill_px: Price,
) -> bool
pub fn apply_fill( &mut self, client_id: &ClientOrderId, trade_id: &TradeId, fill_qty: Qty, fill_px: Price, ) -> bool
Apply a fill to an order Returns true if this is a new fill (not a duplicate)
Sourcepub fn cancel_order(&mut self, client_id: &ClientOrderId) -> Option<LiveOrder>
pub fn cancel_order(&mut self, client_id: &ClientOrderId) -> Option<LiveOrder>
Mark order as canceled and remove it
Sourcepub fn is_complete(&self, client_id: &ClientOrderId) -> bool
pub fn is_complete(&self, client_id: &ClientOrderId) -> bool
Check if an order is complete (fully filled)
Sourcepub fn remove_terminal(
&mut self,
client_id: &ClientOrderId,
) -> Option<LiveOrder>
pub fn remove_terminal( &mut self, client_id: &ClientOrderId, ) -> Option<LiveOrder>
Remove completed/terminal orders
Sourcepub fn client_id_from_exchange_id(
&self,
exchange_id: &ExchangeOrderId,
) -> Option<&ClientOrderId>
pub fn client_id_from_exchange_id( &self, exchange_id: &ExchangeOrderId, ) -> Option<&ClientOrderId>
Look up client_id from exchange_order_id
Sourcepub fn is_trade_seen(&self, trade_id: &TradeId) -> bool
pub fn is_trade_seen(&self, trade_id: &TradeId) -> bool
Check if a trade_id has been seen (for external dedupe)
Sourcepub fn order_count(&self) -> usize
pub fn order_count(&self) -> usize
Get the number of orders currently tracked
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrderManager
impl RefUnwindSafe for OrderManager
impl Send for OrderManager
impl Sync for OrderManager
impl Unpin for OrderManager
impl UnsafeUnpin for OrderManager
impl UnwindSafe for OrderManager
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