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§
Sourcetype Handler: ExchangeHandler + Send + Sync + 'static
type Handler: ExchangeHandler + Send + Sync + 'static
Exchange-specific handler type
Required Methods§
Sourcefn websocket_config(&self) -> WebSocketConfig
fn websocket_config(&self) -> WebSocketConfig
Get WebSocket configuration for this exchange
Sourcefn create_handler(
&self,
event_handler: Arc<dyn DataEventHandler>,
) -> Self::Handler
fn create_handler( &self, event_handler: Arc<dyn DataEventHandler>, ) -> Self::Handler
Create a message handler for this exchange
Sourcefn 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_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
Sourcefn 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_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
Sourcefn 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 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
Sourcefn 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_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
Sourcefn 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 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