Trait WebSocketTrader

Source
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§

Source

type Config: Send + Sync

Exchange-specific configuration type

Required Methods§

Source

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

Source

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

Source

fn get_connection_health(&self) -> ConnectionHealth

Get current connection health information

Source

fn is_authenticated(&self) -> bool

Check if connected and ready for trading

Source

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

Source

fn get_rate_limit_usage(&self) -> (usize, usize)

Get current rate limit usage

Implementors§