pub struct ExecutionEngine { /* private fields */ }
Expand description
Central execution engine responsible for orchestrating order routing and execution.
The execution engine manages the entire order lifecycle from submission to completion, handling routing to appropriate execution clients, position management, and event processing. It supports multiple execution venues through registered clients and provides sophisticated order management capabilities.
Implementations§
Source§impl ExecutionEngine
impl ExecutionEngine
Sourcepub fn new(
clock: Rc<RefCell<dyn Clock>>,
cache: Rc<RefCell<Cache>>,
config: Option<ExecutionEngineConfig>,
) -> Self
pub fn new( clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, config: Option<ExecutionEngineConfig>, ) -> Self
Creates a new ExecutionEngine
instance.
Sourcepub fn position_id_count(&self, strategy_id: StrategyId) -> usize
pub fn position_id_count(&self, strategy_id: StrategyId) -> usize
Returns the position ID count for the specified strategy.
Sourcepub fn check_integrity(&self) -> bool
pub fn check_integrity(&self) -> bool
Checks the integrity of cached execution data.
Sourcepub fn check_connected(&self) -> bool
pub fn check_connected(&self) -> bool
Returns true if all registered execution clients are connected.
Sourcepub fn check_disconnected(&self) -> bool
pub fn check_disconnected(&self) -> bool
Returns true if all registered execution clients are disconnected.
Sourcepub fn check_residuals(&self) -> bool
pub fn check_residuals(&self) -> bool
Checks for residual positions and orders in the cache.
Sourcepub fn get_external_order_claims_instruments(&self) -> HashSet<InstrumentId>
pub fn get_external_order_claims_instruments(&self) -> HashSet<InstrumentId>
Returns the set of instruments that have external order claims.
Sourcepub fn register_client(&mut self, client: Rc<dyn ExecutionClient>) -> Result<()>
pub fn register_client(&mut self, client: Rc<dyn ExecutionClient>) -> Result<()>
Registers a new execution client.
§Errors
Returns an error if a client with the same ID is already registered.
Sourcepub fn register_default_client(&mut self, client: Rc<dyn ExecutionClient>)
pub fn register_default_client(&mut self, client: Rc<dyn ExecutionClient>)
Registers a default execution client for fallback routing.
Sourcepub fn get_client(
&self,
client_id: &ClientId,
) -> Option<Rc<dyn ExecutionClient>>
pub fn get_client( &self, client_id: &ClientId, ) -> Option<Rc<dyn ExecutionClient>>
Returns the execution client registered with the given ID.
Sourcepub fn register_venue_routing(
&mut self,
client_id: ClientId,
venue: Venue,
) -> Result<()>
pub fn register_venue_routing( &mut self, client_id: ClientId, venue: Venue, ) -> Result<()>
Sets routing for a specific venue to a given client ID.
§Errors
Returns an error if the client ID is not registered.
Sourcepub fn deregister_client(&mut self, client_id: ClientId) -> Result<()>
pub fn deregister_client(&mut self, client_id: ClientId) -> Result<()>
§Errors
Returns an error if no client is registered with the given ID.
Sourcepub async fn load_cache(&mut self) -> Result<()>
pub async fn load_cache(&mut self) -> Result<()>
Loads persistent state into cache and rebuilds indices.
§Errors
Returns an error if any cache operation fails.