Trait StreamProvider

Source
pub trait StreamProvider:
    Send
    + Sync
    + Debug {
    type Handler: ExchangeHandler + Send + Sync + 'static;

    // Required methods
    fn name(&self) -> &'static str;
    fn venue(&self) -> Venue;
    fn websocket_config(&self) -> WebSocketConfig;
    fn create_handler(
        &self,
        event_handler: Arc<dyn DataEventHandler>,
    ) -> Self::Handler;
    fn subscribe_trades<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 WebSocketClient,
        symbols: SmallVec<[String; 8]>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_orderbook<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 WebSocketClient,
        symbols: SmallVec<[String; 8]>,
        depth: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_instruments<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 WebSocketClient,
    ) -> 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 self,
        client: &'life1 WebSocketClient,
        symbols: SmallVec<[String; 8]>,
    ) -> 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 self,
        client: &'life1 WebSocketClient,
        symbols: SmallVec<[String; 8]>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ConnectionStats> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Real-time streaming provider using WebSocket This trait handles live market data streaming

Required Associated Types§

Source

type Handler: ExchangeHandler + Send + Sync + 'static

Exchange-specific handler type

Required Methods§

Source

fn name(&self) -> &'static str

Returns the exchange name as a static string

Source

fn venue(&self) -> Venue

Returns the venue enum value for this provider

Source

fn websocket_config(&self) -> WebSocketConfig

Get WebSocket configuration for this exchange

Source

fn create_handler( &self, event_handler: Arc<dyn DataEventHandler>, ) -> Self::Handler

Create a message handler for this exchange

Source

fn subscribe_trades<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 WebSocketClient, symbols: SmallVec<[String; 8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to trade data for multiple symbols

Source

fn subscribe_orderbook<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 WebSocketClient, symbols: SmallVec<[String; 8]>, depth: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to orderbook data for multiple symbols

Source

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

Subscribe to instrument updates

Source

fn unsubscribe_trades<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 WebSocketClient, symbols: SmallVec<[String; 8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unsubscribe from trade data

Source

fn unsubscribe_orderbook<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 WebSocketClient, symbols: SmallVec<[String; 8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unsubscribe from orderbook data

Source

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

Get connection statistics

Implementors§