pub struct OrderMatchingEngine {
pub venue: Venue,
pub instrument: InstrumentAny,
pub raw_id: u32,
pub book_type: BookType,
pub oms_type: OmsType,
pub account_type: AccountType,
pub market_status: MarketStatus,
pub config: OrderMatchingEngineConfig,
pub core: OrderMatchingCore,
/* private fields */
}
Expand description
An order matching engine for a single market.
Fields§
§venue: Venue
The venue for the matching engine.
instrument: InstrumentAny
The instrument for the matching engine.
raw_id: u32
The instruments raw integer ID for the venue.
book_type: BookType
The order book type for the matching engine.
oms_type: OmsType
The order management system (OMS) type for the matching engine.
account_type: AccountType
The account type for the matching engine.
market_status: MarketStatus
The market status for the matching engine.
config: OrderMatchingEngineConfig
The config for the matching engine.
core: OrderMatchingCore
Implementations§
Source§impl OrderMatchingEngine
impl OrderMatchingEngine
pub fn new( instrument: InstrumentAny, raw_id: u32, fill_model: FillModel, fee_model: FeeModelAny, book_type: BookType, oms_type: OmsType, account_type: AccountType, clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, config: OrderMatchingEngineConfig, ) -> Self
pub fn reset(&mut self)
pub const fn set_fill_model(&mut self, fill_model: FillModel)
pub fn best_bid_price(&self) -> Option<Price>
pub fn best_ask_price(&self) -> Option<Price>
pub const fn get_book(&self) -> &OrderBook
pub const fn get_open_bid_orders(&self) -> &[PassiveOrderAny]
pub const fn get_open_ask_orders(&self) -> &[PassiveOrderAny]
pub fn get_open_orders(&self) -> Vec<PassiveOrderAny>
pub fn order_exists(&self, client_order_id: ClientOrderId) -> bool
Sourcepub fn process_order_book_delta(&mut self, delta: &OrderBookDelta)
pub fn process_order_book_delta(&mut self, delta: &OrderBookDelta)
Process the venues market for the given order book delta.
pub fn process_order_book_deltas(&mut self, deltas: &OrderBookDeltas)
Sourcepub fn process_quote_tick(&mut self, quote: &QuoteTick)
pub fn process_quote_tick(&mut self, quote: &QuoteTick)
§Panics
Panics if updating the order book with the quote tick fails.
Sourcepub fn process_bar(&mut self, bar: &Bar)
pub fn process_bar(&mut self, bar: &Bar)
§Panics
Panics if the bar type configuration is missing a time delta.
Sourcepub fn process_trade_tick(&mut self, trade: &TradeTick)
pub fn process_trade_tick(&mut self, trade: &TradeTick)
§Panics
Panics if updating the order book with the trade tick fails.
pub fn process_status(&mut self, action: MarketStatusAction)
Sourcepub fn process_order(&mut self, order: &mut OrderAny, account_id: AccountId)
pub fn process_order(&mut self, order: &mut OrderAny, account_id: AccountId)
§Panics
Panics if the instrument activation timestamp is missing.
pub fn process_modify(&mut self, command: &ModifyOrder, account_id: AccountId)
pub fn process_cancel(&mut self, command: &CancelOrder, account_id: AccountId)
pub fn process_cancel_all( &mut self, command: &CancelAllOrders, account_id: AccountId, )
pub fn process_batch_cancel( &mut self, command: &BatchCancelOrders, account_id: AccountId, )
Sourcepub fn iterate(&mut self, timestamp_ns: UnixNanos)
pub fn iterate(&mut self, timestamp_ns: UnixNanos)
Iterate the matching engine by processing the bid and ask order sides
and advancing time up to the given UNIX timestamp_ns
.
§Panics
Panics if the best bid or ask price is unavailable when iterating.
pub fn fill_market_order(&mut self, order: &mut OrderAny)
Sourcepub fn fill_limit_order(&mut self, order: &mut OrderAny)
pub fn fill_limit_order(&mut self, order: &mut OrderAny)
§Panics
Panics if the order has no price, or if fill price or quantity precision mismatches occur.