pub struct BybitWebSocketTrader { /* private fields */ }Expand description
Bybit WebSocket Trading Client
Implementations§
Source§impl BybitWebSocketTrader
impl BybitWebSocketTrader
Sourcepub fn new(
auth: Arc<BybitAuth>,
testnet: bool,
instrument_registry: Arc<dyn InstrumentRegistry>,
) -> Self
pub fn new( auth: Arc<BybitAuth>, testnet: bool, instrument_registry: Arc<dyn InstrumentRegistry>, ) -> Self
Create a new Bybit WebSocket trader
Sourcepub fn get_connection_health(&self) -> ConnectionHealth
pub fn get_connection_health(&self) -> ConnectionHealth
Get connection health status
Sourcepub async fn connect(&self, report_tx: Sender<ExecutionReport>) -> Result<()>
pub async fn connect(&self, report_tx: Sender<ExecutionReport>) -> Result<()>
Connect to Bybit WebSocket trading endpoint
Sourcepub async fn create_order(&self, order: &BybitOrderRequest) -> Result<()>
pub async fn create_order(&self, order: &BybitOrderRequest) -> Result<()>
Create a single order with tracking
Sourcepub async fn create_batch_orders(
&self,
batch: &BybitBatchOrderRequest,
) -> Result<()>
pub async fn create_batch_orders( &self, batch: &BybitBatchOrderRequest, ) -> Result<()>
Create multiple orders in a batch with tracking
Sourcepub async fn cancel_order(
&self,
category: BybitCategory,
order_id: &str,
) -> Result<()>
pub async fn cancel_order( &self, category: BybitCategory, order_id: &str, ) -> Result<()>
Cancel a single order with tracking
Sourcepub async fn cancel_batch_orders(
&self,
category: BybitCategory,
order_ids: &[&str],
) -> Result<()>
pub async fn cancel_batch_orders( &self, category: BybitCategory, order_ids: &[&str], ) -> Result<()>
Cancel multiple orders in a batch with tracking
Sourcepub async fn amend_order(&self, request: &BybitAmendOrderRequest) -> Result<()>
pub async fn amend_order(&self, request: &BybitAmendOrderRequest) -> Result<()>
Amend an existing order
Sourcepub async fn cancel_all_orders_internal(
&self,
request: &BybitCancelAllRequest,
) -> Result<()>
pub async fn cancel_all_orders_internal( &self, request: &BybitCancelAllRequest, ) -> Result<()>
Cancel all orders for a category
Sourcepub async fn disconnect(&self) -> Result<()>
pub async fn disconnect(&self) -> Result<()>
Disconnect from WebSocket
Trait Implementations§
Source§impl Exchange for BybitWebSocketTrader
impl Exchange for BybitWebSocketTrader
Source§fn place_order<'life0, 'async_trait>(
&'life0 self,
order: Order,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn place_order<'life0, 'async_trait>(
&'life0 self,
order: Order,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Places a new order on the exchange
Source§fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancels an existing order
Source§fn modify_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
new_price: Option<Decimal>,
new_quantity: Option<Decimal>,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn modify_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
new_price: Option<Decimal>,
new_quantity: Option<Decimal>,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Modifies an existing order
Source§fn cancel_all_orders<'life0, 'async_trait>(
&'life0 self,
instrument_id: Option<InstrumentId>,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_all_orders<'life0, 'async_trait>(
&'life0 self,
instrument_id: Option<InstrumentId>,
report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancels all open orders, optionally filtered by instrument
Source§fn get_order_status<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<OrderStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_order_status<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<OrderStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the status of an order
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
report_sender: 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_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connects to the exchange
Source§fn 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,
Disconnects from the exchange
Source§fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if connected to the exchange
Source§fn get_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SmallVec<[InstrumentId; 32]>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SmallVec<[InstrumentId; 32]>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a list of instruments supported by this exchange
Auto Trait Implementations§
impl !Freeze for BybitWebSocketTrader
impl !RefUnwindSafe for BybitWebSocketTrader
impl Send for BybitWebSocketTrader
impl Sync for BybitWebSocketTrader
impl Unpin for BybitWebSocketTrader
impl !UnwindSafe for BybitWebSocketTrader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more