Trait DataEventHandler

Source
pub trait DataEventHandler: Send + Sync {
    // Required methods
    fn on_trade<'life0, 'async_trait>(
        &'life0 self,
        trade: MarketTrade,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_orderbook_update<'life0, 'async_trait>(
        &'life0 self,
        snapshot: OrderBookSnapshot,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_instrument_update<'life0, 'async_trait>(
        &'life0 self,
        instrument: Box<dyn Instrument>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_connection_state_changed<'life0, 'async_trait>(
        &'life0 self,
        state: ConnectionState,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_error<'life0, 'async_trait>(
        &'life0 self,
        error: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Data event callbacks for real-time streaming

Required Methods§

Source

fn on_trade<'life0, 'async_trait>( &'life0 self, trade: MarketTrade, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a new trade is received

Source

fn on_orderbook_update<'life0, 'async_trait>( &'life0 self, snapshot: OrderBookSnapshot, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when orderbook is updated

Source

fn on_instrument_update<'life0, 'async_trait>( &'life0 self, instrument: Box<dyn Instrument>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an instrument is updated

Source

fn on_connection_state_changed<'life0, 'async_trait>( &'life0 self, state: ConnectionState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when connection state changes

Source

fn on_error<'life0, 'async_trait>( &'life0 self, error: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an error occurs

Implementors§