DataEngine

Struct DataEngine 

Source
pub struct DataEngine { /* private fields */ }
Expand description

Provides a high-performance DataEngine for all environments.

Implementations§

Source§

impl DataEngine

Source

pub fn new( clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, config: Option<DataEngineConfig>, ) -> Self

Creates a new DataEngine instance.

Source

pub fn get_clock(&self) -> Ref<'_, dyn Clock>

Returns a read-only reference to the engines clock.

Source

pub fn get_cache(&self) -> Ref<'_, Cache>

Returns a read-only reference to the engines cache.

Source

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.

Source

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.

Source

pub fn deregister_client(&mut self, client_id: &ClientId)

Deregisters the client for the client_id.

§Panics

Panics if the client ID has not been registered.

Source

pub fn register_default_client(&mut self, client: DataClientAdapter)

Registers the data client with the engine as the default routing client.

When a specific venue routing cannot be found, this client will receive messages.

§Warnings

Any existing default routing client will be overwritten.

§Panics

Panics if a default client has already been registered.

Source

pub fn start(&mut self)

Starts all registered data clients.

Source

pub fn stop(&mut self)

Stops all registered data clients.

Source

pub fn reset(&mut self)

Resets all registered data clients to their initial state.

Source

pub fn dispose(&mut self)

Disposes the engine, stopping all clients and canceling any timers.

Source

pub fn check_connected(&self) -> bool

Returns true if all registered data clients are currently connected.

Source

pub fn check_disconnected(&self) -> bool

Returns true if all registered data clients are currently disconnected.

Source

pub fn registered_clients(&self) -> Vec<ClientId>

Returns a list of all registered client IDs, including the default client if set.

Source

pub fn get_clients(&self) -> Vec<&DataClientAdapter>

Source

pub fn get_clients_mut(&mut self) -> Vec<&mut DataClientAdapter>

Source

pub fn get_client( &mut self, client_id: Option<&ClientId>, venue: Option<&Venue>, ) -> Option<&mut DataClientAdapter>

Source

pub fn subscribed_custom_data(&self) -> Vec<DataType>

Returns all custom data types currently subscribed across all clients.

Source

pub fn subscribed_instruments(&self) -> Vec<InstrumentId>

Returns all instrument IDs currently subscribed across all clients.

Source

pub fn subscribed_book_deltas(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which book delta subscriptions exist.

Source

pub fn subscribed_book_snapshots(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which book snapshot subscriptions exist.

Source

pub fn subscribed_quotes(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which quote subscriptions exist.

Source

pub fn subscribed_trades(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which trade subscriptions exist.

Source

pub fn subscribed_bars(&self) -> Vec<BarType>

Returns all bar types currently subscribed across all clients.

Source

pub fn subscribed_mark_prices(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which mark price subscriptions exist.

Source

pub fn subscribed_index_prices(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which index price subscriptions exist.

Source

pub fn subscribed_funding_rates(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which funding rate subscriptions exist.

Source

pub fn subscribed_instrument_status(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which status subscriptions exist.

Source

pub fn subscribed_instrument_close(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which instrument close subscriptions exist.

Source

pub fn subscribed_blocks(&self) -> Vec<Blockchain>

Returns all blockchains for which blocks subscriptions exist.

Source

pub fn subscribed_pools(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which pool subscriptions exist.

Source

pub fn subscribed_pool_swaps(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which swap subscriptions exist.

Source

pub fn subscribed_pool_liquidity_updates(&self) -> Vec<InstrumentId>

Returns all instrument IDs for which liquidity update subscriptions exist.

Source

pub fn execute(&mut self, cmd: &DataCommand)

Executes a DataCommand by delegating to subscribe, unsubscribe, or request handlers.

Errors during execution are logged.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn process(&mut self, data: &dyn Any)

Processes a dynamically-typed data message.

Currently supports InstrumentAny and FundingRateUpdate; unrecognized types are logged as errors.

Source

pub fn process_data(&mut self, data: Data)

Processes a Data enum instance, dispatching to appropriate handlers.

Source

pub fn process_defi_data(&mut self, data: DefiData)

Processes DeFi-specific data events.

Source

pub fn response(&self, resp: DataResponse)

Processes a DataResponse, handling and publishing the response message.

Source

pub fn handle_funding_rate(&mut self, funding_rate: FundingRateUpdate)

Handles a funding rate update by adding it to the cache and publishing to the message bus.

Trait Implementations§

Source§

impl Debug for DataEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,