pub struct DataEngine { /* private fields */ }
Expand description
Provides a high-performance DataEngine
for all environments.
Implementations§
Source§impl DataEngine
impl DataEngine
Sourcepub fn new(
clock: Rc<RefCell<dyn Clock>>,
cache: Rc<RefCell<Cache>>,
config: Option<DataEngineConfig>,
) -> Self
pub fn new( clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, config: Option<DataEngineConfig>, ) -> Self
Creates a new DataEngine
instance.
Sourcepub fn get_clock(&self) -> Ref<'_, dyn Clock>
pub fn get_clock(&self) -> Ref<'_, dyn Clock>
Returns a read-only reference to the engines clock.
Sourcepub fn register_catalog(
&mut self,
catalog: ParquetDataCatalog,
name: Option<String>,
)
pub fn register_catalog( &mut self, catalog: ParquetDataCatalog, name: Option<String>, )
Registers the catalog
with the engine with an optional specific name
.
§Panics
Panics if a catalog with the same name
has already been registered.
Sourcepub fn register_client(
&mut self,
client: DataClientAdapter,
routing: Option<Venue>,
)
pub fn register_client( &mut self, client: DataClientAdapter, routing: Option<Venue>, )
Registers the client
with the engine with an optional venue routing
.
§Panics
Panics if a client with the same client ID has already been registered.
Sourcepub fn deregister_client(&mut self, client_id: &ClientId)
pub fn deregister_client(&mut self, client_id: &ClientId)
Sourcepub fn register_default_client(&mut self, client: DataClientAdapter)
pub fn register_default_client(&mut self, client: DataClientAdapter)
Sourcepub fn check_connected(&self) -> bool
pub fn check_connected(&self) -> bool
Returns true
if all registered data clients are currently connected.
Sourcepub fn check_disconnected(&self) -> bool
pub fn check_disconnected(&self) -> bool
Returns true
if all registered data clients are currently disconnected.
Sourcepub fn registered_clients(&self) -> Vec<ClientId>
pub fn registered_clients(&self) -> Vec<ClientId>
Returns a list of all registered client IDs, including the default client if set.
pub fn get_clients(&self) -> Vec<&DataClientAdapter>
pub fn get_clients_mut(&mut self) -> Vec<&mut DataClientAdapter>
pub fn get_client( &mut self, client_id: Option<&ClientId>, venue: Option<&Venue>, ) -> Option<&mut DataClientAdapter>
Sourcepub fn subscribed_custom_data(&self) -> Vec<DataType>
pub fn subscribed_custom_data(&self) -> Vec<DataType>
Returns all custom data types currently subscribed across all clients.
Sourcepub fn subscribed_instruments(&self) -> Vec<InstrumentId>
pub fn subscribed_instruments(&self) -> Vec<InstrumentId>
Returns all instrument IDs currently subscribed across all clients.
Sourcepub fn subscribed_book_deltas(&self) -> Vec<InstrumentId>
pub fn subscribed_book_deltas(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which book delta subscriptions exist.
Sourcepub fn subscribed_book_snapshots(&self) -> Vec<InstrumentId>
pub fn subscribed_book_snapshots(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which book snapshot subscriptions exist.
Sourcepub fn subscribed_quotes(&self) -> Vec<InstrumentId>
pub fn subscribed_quotes(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which quote subscriptions exist.
Sourcepub fn subscribed_trades(&self) -> Vec<InstrumentId>
pub fn subscribed_trades(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which trade subscriptions exist.
Sourcepub fn subscribed_bars(&self) -> Vec<BarType>
pub fn subscribed_bars(&self) -> Vec<BarType>
Returns all bar types currently subscribed across all clients.
Sourcepub fn subscribed_mark_prices(&self) -> Vec<InstrumentId>
pub fn subscribed_mark_prices(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which mark price subscriptions exist.
Sourcepub fn subscribed_index_prices(&self) -> Vec<InstrumentId>
pub fn subscribed_index_prices(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which index price subscriptions exist.
Sourcepub fn subscribed_instrument_status(&self) -> Vec<InstrumentId>
pub fn subscribed_instrument_status(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which status subscriptions exist.
Sourcepub fn subscribed_instrument_close(&self) -> Vec<InstrumentId>
pub fn subscribed_instrument_close(&self) -> Vec<InstrumentId>
Returns all instrument IDs for which instrument close subscriptions exist.
Sourcepub fn subscribed_blocks(&self) -> Vec<Blockchain>
pub fn subscribed_blocks(&self) -> Vec<Blockchain>
Returns all blockchains for which blocks subscriptions exist.
Sourcepub fn subscribed_pools(&self) -> Vec<Address>
pub fn subscribed_pools(&self) -> Vec<Address>
Returns all pool addresses for which pool subscriptions exist.
Sourcepub fn subscribed_pool_swaps(&self) -> Vec<Address>
pub fn subscribed_pool_swaps(&self) -> Vec<Address>
Returns all pool addresses for which swap subscriptions exist.
Sourcepub fn subscribed_pool_liquidity_updates(&self) -> Vec<Address>
pub fn subscribed_pool_liquidity_updates(&self) -> Vec<Address>
Returns all pool addresses for which liquidity update subscriptions exist.
Sourcepub fn execute(&mut self, cmd: &DataCommand)
pub fn execute(&mut self, cmd: &DataCommand)
Executes a DataCommand
by delegating to subscribe, unsubscribe, or request handlers.
Errors during execution are logged.
Sourcepub fn execute_subscribe(&mut self, cmd: &SubscribeCommand) -> Result<()>
pub fn execute_subscribe(&mut self, cmd: &SubscribeCommand) -> Result<()>
Handles a subscribe command, updating internal state and forwarding to the client.
§Errors
Returns an error if the subscription is invalid (e.g., synthetic instrument for book data), or if the underlying client operation fails.
Sourcepub fn execute_defi_subscribe(
&mut self,
cmd: &DefiSubscribeCommand,
) -> Result<()>
pub fn execute_defi_subscribe( &mut self, cmd: &DefiSubscribeCommand, ) -> Result<()>
Handles a subscribe command, updating internal state and forwarding to the client.
§Errors
Returns an error if the subscription is invalid (e.g., synthetic instrument for book data), or if the underlying client operation fails.
Sourcepub fn execute_unsubscribe(&mut self, cmd: &UnsubscribeCommand) -> Result<()>
pub fn execute_unsubscribe(&mut self, cmd: &UnsubscribeCommand) -> Result<()>
Handles an unsubscribe command, updating internal state and forwarding to the client.
§Errors
Returns an error if the underlying client operation fails.
Sourcepub fn execute_defi_unsubscribe(
&mut self,
cmd: &DefiUnsubscribeCommand,
) -> Result<()>
pub fn execute_defi_unsubscribe( &mut self, cmd: &DefiUnsubscribeCommand, ) -> Result<()>
Handles an unsubscribe command, updating internal state and forwarding to the client.
§Errors
Returns an error if the underlying client operation fails.
Sourcepub fn execute_request(&mut self, req: &RequestCommand) -> Result<()>
pub fn execute_request(&mut self, req: &RequestCommand) -> Result<()>
Sends a [RequestCommand
] to a suitable data client implementation.
§Errors
Returns an error if no client is found for the given client ID or venue, or if the client fails to process the request.
Sourcepub fn process(&mut self, data: &dyn Any)
pub fn process(&mut self, data: &dyn Any)
Processes a dynamically-typed data message.
Currently supports InstrumentAny
; unrecognized types are logged as errors.
Sourcepub fn process_data(&mut self, data: Data)
pub fn process_data(&mut self, data: Data)
Processes a Data
enum instance, dispatching to appropriate handlers.
Sourcepub fn process_defi_data(&mut self, data: DefiData)
pub fn process_defi_data(&mut self, data: DefiData)
Processes DeFi-specific data events.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataEngine
impl !RefUnwindSafe for DataEngine
impl !Send for DataEngine
impl !Sync for DataEngine
impl Unpin for DataEngine
impl !UnwindSafe for DataEngine
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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