Struct DataActorCore

Source
pub struct DataActorCore {
    pub actor_id: ActorId,
    pub config: DataActorConfig,
    pub clock: Rc<RefCell<dyn Clock>>,
    pub cache: Rc<RefCell<Cache>>,
    /* private fields */
}
Expand description

Core functionality for all actors.

Fields§

§actor_id: ActorId

The actor identifier.

§config: DataActorConfig

The actors configuration.

§clock: Rc<RefCell<dyn Clock>>

The actors clock.

§cache: Rc<RefCell<Cache>>

The cache for the actor.

Implementations§

Source§

impl DataActorCore

Source

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

Creates a new DataActorCore instance.

Source

pub fn initialize(&mut self) -> Result<()>

Source

pub fn trader_id(&self) -> Option<TraderId>

Returns the trader ID this actor is registered to.

Source

pub fn state(&self) -> ComponentState

Source

pub fn register_warning_event(&mut self, event_type: &str)

Register an event type for warning log levels.

Source

pub fn deregister_warning_event(&mut self, event_type: &str)

Deregister an event type from warning log levels.

Source

pub fn start(&mut self) -> Result<()>

Source

pub fn stop(&mut self) -> Result<()>

Source

pub fn resume(&mut self) -> Result<()>

Source

pub fn reset(&mut self) -> Result<()>

Source

pub fn dispose(&mut self) -> Result<()>

Source

pub fn degrade(&mut self) -> Result<()>

Source

pub fn fault(&mut self) -> Result<()>

Source

pub fn shutdown_system(&self, reason: Option<String>)

Source

pub fn subscribe_data<A: DataActor>( &mut self, data_type: DataType, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming data_type data.

Source

pub fn subscribe_instruments<A: DataActor>( &mut self, venue: Venue, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [InstrumentAny] data for the venue.

Source

pub fn subscribe_instrument<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [InstrumentAny] data for the instrument_id.

Source

pub fn subscribe_book_deltas<A: DataActor>( &mut self, instrument_id: InstrumentId, book_type: BookType, depth: Option<NonZeroUsize>, client_id: Option<ClientId>, managed: bool, params: Option<HashMap<String, String>>, )

Subscribe to streaming [OrderBookDeltas] data for the instrument_id.

Once subscribed, any matching order book deltas published on the message bus are forwarded to the on_book_deltas handler.

Source

pub fn subscribe_book_at_interval<A: DataActor>( &mut self, instrument_id: InstrumentId, book_type: BookType, depth: Option<NonZeroUsize>, interval_ms: NonZeroUsize, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to [OrderBook] snapshots at a specified interval for the instrument_id.

Once subscribed, any matching order book snapshots published on the message bus are forwarded to the on_book handler.

§Warnings

Consider subscribing to order book deltas if you need intervals less than 100 milliseconds.

Source

pub fn subscribe_quotes<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [QuoteTick] data for the instrument_id.

Source

pub fn subscribe_trades<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [TradeTick] data for the instrument_id.

Source

pub fn subscribe_bars<A: DataActor>( &mut self, bar_type: BarType, client_id: Option<ClientId>, await_partial: bool, params: Option<HashMap<String, String>>, )

Subscribe to streaming [Bar] data for the bar_type.

Once subscribed, any matching bar data published on the message bus is forwarded to the on_bar handler.

Source

pub fn subscribe_mark_prices<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [MarkPriceUpdate] data for the instrument_id.

Once subscribed, any matching mark price updates published on the message bus are forwarded to the on_mark_price handler.

Source

pub fn subscribe_index_prices<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [IndexPriceUpdate] data for the instrument_id.

Once subscribed, any matching index price updates published on the message bus are forwarded to the on_index_price handler.

Source

pub fn subscribe_instrument_status<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [InstrumentStatus] data for the instrument_id.

Once subscribed, any matching bar data published on the message bus is forwarded to the on_bar handler.

Source

pub fn subscribe_instrument_close<A: DataActor>( &mut self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Subscribe to streaming [InstrumentClose] data for the instrument_id.

Once subscribed, any matching instrument close data published on the message bus is forwarded to the on_instrument_close handler.

Source

pub fn unsubscribe_data<A: DataActor>( &self, data_type: DataType, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming data_type data.

Source

pub fn unsubscribe_instruments<A: DataActor>( &self, venue: Venue, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [Instrument] data for the venue.

Source

pub fn unsubscribe_instrument<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [Instrument] definitions for the instrument_id.

Source

pub fn unsubscribe_book_deltas<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [OrderBookDeltas] for the instrument_id.

Source

pub fn unsubscribe_book_at_interval<A: DataActor>( &mut self, instrument_id: InstrumentId, interval_ms: NonZeroUsize, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from [OrderBook] snapshots at a specified interval for the instrument_id.

The interval_ms must match a previously subscribed interval.

Source

pub fn unsubscribe_quotes<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [QuoteTick] data for the instrument_id.

Source

pub fn unsubscribe_trades<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [TradeTick] data for the instrument_id.

Source

pub fn unsubscribe_bars<A: DataActor>( &mut self, bar_type: BarType, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [Bar] data for the bar_type.

Source

pub fn unsubscribe_mark_prices<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [MarkPriceUpdate] data for the instrument_id.

Source

pub fn unsubscribe_index_prices<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [IndexPriceUpdate] data for the instrument_id.

Source

pub fn unsubscribe_instrument_status<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [InstrumentStatus] data for the instrument_id.

Source

pub fn unsubscribe_instrument_close<A: DataActor>( &self, instrument_id: InstrumentId, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, )

Unsubscribe from streaming [InstrumentClose] data for the instrument_id.

Source

pub fn request_data<A: DataActor>( &self, data_type: DataType, client_id: ClientId, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, limit: Option<NonZeroUsize>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_instrument<A: DataActor>( &self, instrument_id: InstrumentId, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_instruments<A: DataActor>( &self, venue: Option<Venue>, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_book_snapshot<A: DataActor>( &self, instrument_id: InstrumentId, depth: Option<NonZeroUsize>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_quotes<A: DataActor>( &self, instrument_id: InstrumentId, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, limit: Option<NonZeroUsize>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_trades<A: DataActor>( &self, instrument_id: InstrumentId, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, limit: Option<NonZeroUsize>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Source

pub fn request_bars<A: DataActor>( &self, bar_type: BarType, start: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>, limit: Option<NonZeroUsize>, client_id: Option<ClientId>, params: Option<HashMap<String, String>>, ) -> Result<UUID4>

Trait Implementations§

Source§

impl Actor for DataActorCore

Source§

fn id(&self) -> Ustr

The unique identifier for the actor.
Source§

fn handle(&mut self, msg: &dyn Any)

Handles the msg.
Source§

fn as_any(&self) -> &dyn Any

Returns a reference to self as Any, for downcasting support.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Returns a mutable reference to self as Any, for downcasting support. Read more
Source§

impl DataActor for DataActorCore

Source§

fn state(&self) -> ComponentState

Returns the ComponentState of the actor.
Source§

fn is_ready(&self) -> bool

Returns true if the actor is in a Ready state.
Source§

fn is_running(&self) -> bool

Returns true if the actor is in a Running state.
Source§

fn is_stopped(&self) -> bool

Returns true if the actor is in a Stopped state.
Source§

fn is_disposed(&self) -> bool

Returns true if the actor is in a Disposed state.
Source§

fn is_degraded(&self) -> bool

Returns true if the actor is in a Degraded state.
Source§

fn is_faulting(&self) -> bool

Returns true if the actor is in a Faulted state.
Source§

fn on_save(&self) -> Result<HashMap<String, Vec<u8>>>

Actions to be performed when the actor state is saved.
Source§

fn on_load(&mut self, state: HashMap<String, Vec<u8>>) -> Result<()>

Actions to be performed when the actor state is loaded.
Source§

fn on_start(&mut self) -> Result<()>

Actions to be performed on start.
Source§

fn on_stop(&mut self) -> Result<()>

Actions to be performed on stop.
Source§

fn on_resume(&mut self) -> Result<()>

Actions to be performed on resume.
Source§

fn on_reset(&mut self) -> Result<()>

Actions to be performed on reset.
Source§

fn on_dispose(&mut self) -> Result<()>

Actions to be performed on dispose.
Source§

fn on_degrade(&mut self) -> Result<()>

Actions to be performed on degrade.
Source§

fn on_fault(&mut self) -> Result<()>

Actions to be performed on fault.
Source§

fn on_event(&mut self, event: &dyn Any) -> Result<()>

Actions to be performed when receiving an event.
Source§

fn on_time_event(&mut self, event: &TimeEvent) -> Result<()>

Actions to be performanced when receiving a time event.
Source§

fn on_data(&mut self, data: &dyn Any) -> Result<()>

Actions to be performed when receiving custom data.
Source§

fn on_signal(&mut self, signal: &Signal) -> Result<()>

Actions to be performed when receiving a signal.
Source§

fn on_instrument(&mut self, instrument: &InstrumentAny) -> Result<()>

Actions to be performed when receiving an instrument.
Source§

fn on_book_deltas(&mut self, deltas: &OrderBookDeltas) -> Result<()>

Actions to be performed when receiving order book deltas.
Source§

fn on_book(&mut self, order_book: &OrderBook) -> Result<()>

Actions to be performed when receiving an order book.
Source§

fn on_quote(&mut self, quote: &QuoteTick) -> Result<()>

Actions to be performed when receiving a quote.
Source§

fn on_trade(&mut self, tick: &TradeTick) -> Result<()>

Actions to be performed when receiving a trade.
Source§

fn on_bar(&mut self, bar: &Bar) -> Result<()>

Actions to be performed when receiving a bar.
Source§

fn on_mark_price(&mut self, mark_price: &MarkPriceUpdate) -> Result<()>

Actions to be performed when receiving a mark price update.
Source§

fn on_index_price(&mut self, index_price: &IndexPriceUpdate) -> Result<()>

Actions to be performed when receiving an index price update.
Source§

fn on_instrument_status(&mut self, data: &InstrumentStatus) -> Result<()>

Actions to be performed when receiving an instrument status update.
Source§

fn on_instrument_close(&mut self, update: &InstrumentClose) -> Result<()>

Actions to be performed when receiving an instrument close update.
Source§

fn on_historical_data(&mut self, data: &dyn Any) -> Result<()>

Actions to be performed when receiving historical data.
Source§

fn on_historical_quotes(&mut self, quotes: &[QuoteTick]) -> Result<()>

Actions to be performed when receiving historical quotes.
Source§

fn on_historical_trades(&mut self, trades: &[TradeTick]) -> Result<()>

Actions to be performed when receiving historical trades.
Source§

fn on_historical_bars(&mut self, bars: &[Bar]) -> Result<()>

Actions to be performed when receiving historical bars.
Source§

fn on_historical_mark_prices( &mut self, mark_prices: &[MarkPriceUpdate], ) -> Result<()>

Actions to be performed when receiving historical mark prices.
Source§

fn on_historical_index_prices( &mut self, index_prices: &[IndexPriceUpdate], ) -> Result<()>

Actions to be performed when receiving historical index prices.
Source§

fn handle_data(&mut self, data: &dyn Any)

Handles a received custom/generic data point.
Source§

fn handle_signal(&mut self, signal: &Signal)

Handles a received signal.
Source§

fn handle_instrument(&mut self, instrument: &InstrumentAny)

Handles a received instrument.
Source§

fn handle_book_deltas(&mut self, deltas: &OrderBookDeltas)

Handles received order book deltas.
Source§

fn handle_book(&mut self, book: &OrderBook)

Handles a received order book reference.
Source§

fn handle_quote(&mut self, quote: &QuoteTick)

Handles a received quote.
Source§

fn handle_trade(&mut self, trade: &TradeTick)

Handles a received trade.
Source§

fn handle_bar(&mut self, bar: &Bar)

Handles a receiving bar.
Source§

fn handle_mark_price(&mut self, mark_price: &MarkPriceUpdate)

Handles a received mark price update.
Source§

fn handle_index_price(&mut self, index_price: &IndexPriceUpdate)

Handles a received index price update.
Source§

fn handle_instrument_status(&mut self, status: &InstrumentStatus)

Handles a received instrument status.
Source§

fn handle_instrument_close(&mut self, close: &InstrumentClose)

Handles a received instrument close.
Source§

fn handle_historical_data(&mut self, data: &dyn Any)

Handles received historical data.
Source§

fn handle_time_event(&mut self, event: &TimeEvent)

Handles a received time event.
Source§

fn handle_event(&mut self, event: &dyn Any)

Handles a received event.
Source§

fn handle_data_response(&mut self, response: &CustomDataResponse)

Handles a data response.
Source§

fn handle_instruments_response(&mut self, response: &InstrumentsResponse)

Handles an instruments response.
Source§

fn handle_book_response(&mut self, response: &BookResponse)

Handles a book response.
Source§

fn handle_quotes_response(&mut self, response: &QuotesResponse)

Handles a quotes response.
Source§

fn handle_trades_response(&mut self, response: &TradesResponse)

Handles a trades response.
Source§

fn handle_bars_response(&mut self, response: &BarsResponse)

Handles a bars response.
Source§

impl Debug for DataActorCore

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, 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