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
impl DataActorCore
Sourcepub fn new(
config: DataActorConfig,
cache: Rc<RefCell<Cache>>,
clock: Rc<RefCell<dyn Clock>>,
) -> Self
pub fn new( config: DataActorConfig, cache: Rc<RefCell<Cache>>, clock: Rc<RefCell<dyn Clock>>, ) -> Self
Creates a new DataActorCore
instance.
pub fn initialize(&mut self) -> Result<()>
pub fn state(&self) -> ComponentState
Sourcepub fn register_warning_event(&mut self, event_type: &str)
pub fn register_warning_event(&mut self, event_type: &str)
Register an event type for warning log levels.
Sourcepub fn deregister_warning_event(&mut self, event_type: &str)
pub fn deregister_warning_event(&mut self, event_type: &str)
Deregister an event type from warning log levels.
pub fn start(&mut self) -> Result<()>
pub fn stop(&mut self) -> Result<()>
pub fn resume(&mut self) -> Result<()>
pub fn reset(&mut self) -> Result<()>
pub fn dispose(&mut self) -> Result<()>
pub fn degrade(&mut self) -> Result<()>
pub fn fault(&mut self) -> Result<()>
pub fn shutdown_system(&self, reason: Option<String>)
Sourcepub fn subscribe_data<A: DataActor>(
&mut self,
data_type: DataType,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn subscribe_instruments<A: DataActor>(
&mut self,
venue: Venue,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn subscribe_instrument<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub 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>>,
)
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.
Sourcepub 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>>,
)
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.
Sourcepub fn subscribe_quotes<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn subscribe_trades<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn subscribe_bars<A: DataActor>(
&mut self,
bar_type: BarType,
client_id: Option<ClientId>,
await_partial: bool,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn subscribe_mark_prices<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn subscribe_index_prices<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn subscribe_instrument_status<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn subscribe_instrument_close<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn unsubscribe_data<A: DataActor>(
&self,
data_type: DataType,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn unsubscribe_instruments<A: DataActor>(
&self,
venue: Venue,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_instrument<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_book_deltas<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_book_at_interval<A: DataActor>(
&mut self,
instrument_id: InstrumentId,
interval_ms: NonZeroUsize,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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.
Sourcepub fn unsubscribe_quotes<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_trades<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_bars<A: DataActor>(
&mut self,
bar_type: BarType,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_mark_prices<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_index_prices<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_instrument_status<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
Sourcepub fn unsubscribe_instrument_close<A: DataActor>(
&self,
instrument_id: InstrumentId,
client_id: Option<ClientId>,
params: Option<HashMap<String, String>>,
)
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
.
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>
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>
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>
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>
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>
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>
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
impl Actor for DataActorCore
Source§impl DataActor for DataActorCore
impl DataActor for DataActorCore
Source§fn state(&self) -> ComponentState
fn state(&self) -> ComponentState
ComponentState
of the actor.Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
true
if the actor is in a Running
state.Source§fn is_stopped(&self) -> bool
fn is_stopped(&self) -> bool
true
if the actor is in a Stopped
state.Source§fn is_disposed(&self) -> bool
fn is_disposed(&self) -> bool
true
if the actor is in a Disposed
state.Source§fn is_degraded(&self) -> bool
fn is_degraded(&self) -> bool
true
if the actor is in a Degraded
state.Source§fn is_faulting(&self) -> bool
fn is_faulting(&self) -> bool
true
if the actor is in a Faulted
state.