Trait ProviderExt

Source
pub trait ProviderExt {
    // Required methods
    fn connect<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn disconnect<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe_orderbook<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        instrument_id: &'life1 InstrumentId,
        depth: usize,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_trades<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        instrument_id: &'life1 InstrumentId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unsubscribe_orderbook<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        instrument_id: &'life1 InstrumentId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unsubscribe_trades<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        instrument_id: &'life1 InstrumentId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_connected(&self) -> bool;
    fn connection_stats(&self) -> ConnectionStats;
    fn run_with_handler<'life0, 'async_trait>(
        &'life0 mut self,
        handler: Box<dyn DataHandler + Send + Sync>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn fetch_instruments<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Instrument>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Extension trait for new provider implementations

Required Methods§

Source

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

Connect to the exchange

Source

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

Disconnect from the exchange

Source

fn subscribe_orderbook<'life0, 'life1, 'async_trait>( &'life0 mut self, instrument_id: &'life1 InstrumentId, depth: usize, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to orderbook updates for an instrument

Source

fn subscribe_trades<'life0, 'life1, 'async_trait>( &'life0 mut self, instrument_id: &'life1 InstrumentId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to trade updates for an instrument

Source

fn unsubscribe_orderbook<'life0, 'life1, 'async_trait>( &'life0 mut self, instrument_id: &'life1 InstrumentId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unsubscribe from orderbook updates

Source

fn unsubscribe_trades<'life0, 'life1, 'async_trait>( &'life0 mut self, instrument_id: &'life1 InstrumentId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unsubscribe from trade updates

Source

fn is_connected(&self) -> bool

Check if connected

Source

fn connection_stats(&self) -> ConnectionStats

Get connection statistics

Source

fn run_with_handler<'life0, 'async_trait>( &'life0 mut self, handler: Box<dyn DataHandler + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run the provider with a data handler

Source

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

Fetch available instruments

Implementors§