pub trait WebSocketTrader: Send + Sync {
type Config: Send + Sync;
// Required methods
fn connect<'life0, 'async_trait>(
&'life0 self,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_connection_health(&self) -> ConnectionHealth;
fn is_authenticated(&self) -> bool;
fn send_ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_rate_limit_usage(&self) -> (usize, usize);
}Expand description
Common WebSocket trading interface
This trait defines the standard interface that all exchange WebSocket trading implementations should follow for consistent behavior.
Required Associated Types§
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 self,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the exchange WebSocket API
Sourcefn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from the exchange
Sourcefn get_connection_health(&self) -> ConnectionHealth
fn get_connection_health(&self) -> ConnectionHealth
Get current connection health information
Sourcefn is_authenticated(&self) -> bool
fn is_authenticated(&self) -> bool
Check if connected and ready for trading
Sourcefn send_ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a ping message to keep the connection alive
Sourcefn get_rate_limit_usage(&self) -> (usize, usize)
fn get_rate_limit_usage(&self) -> (usize, usize)
Get current rate limit usage