pub struct Stream {
pub client: Client,
}Fields§
§client: ClientImplementations§
source§impl Stream
impl Stream
pub async fn ws_ping(&self, private: bool) -> Result<(), BybitError>
pub async fn ws_priv_subscribe<'a, F>( &self, req: Subscription<'a>, handler: F, ) -> Result<(), BybitError>
pub async fn ws_subscribe<'a, F>( &self, req: Subscription<'a>, category: Category, handler: F, ) -> Result<(), BybitError>
pub fn build_subscription(action: Subscription<'_>) -> String
pub fn build_trade_subscription( orders: RequestType<'_>, recv_window: Option<u64>, ) -> String
sourcepub async fn ws_orderbook(
&self,
subs: Vec<(i32, &str)>,
category: Category,
sender: UnboundedSender<OrderBookUpdate>,
) -> Result<(), BybitError>
pub async fn ws_orderbook( &self, subs: Vec<(i32, &str)>, category: Category, sender: UnboundedSender<OrderBookUpdate>, ) -> Result<(), BybitError>
sourcepub async fn ws_trades(
&self,
subs: Vec<&str>,
category: Category,
sender: UnboundedSender<WsTrade>,
) -> Result<(), BybitError>
pub async fn ws_trades( &self, subs: Vec<&str>, category: Category, sender: UnboundedSender<WsTrade>, ) -> Result<(), BybitError>
This function subscribes to the specified trades and handles the trade events.
§Arguments
subs- A vector of trade subscriptionscategory- The category of the trades
§Example
use your_crate_name::Category;
let subs = vec!["BTCUSD", "ETHUSD"];
let category = Category::Linear;
ws_trades(subs, category);sourcepub async fn ws_tickers(
&self,
subs: Vec<&str>,
category: Category,
sender: UnboundedSender<Tickers>,
) -> Result<(), BybitError>
pub async fn ws_tickers( &self, subs: Vec<&str>, category: Category, sender: UnboundedSender<Tickers>, ) -> Result<(), BybitError>
Subscribes to ticker events for the specified symbols and category.
§Arguments
subs- A vector of symbols for which ticker events are subscribed.category- The category for which ticker events are subscribed.
§Examples
use your_crate_name::Category;
let subs = vec!["BTCUSD", "ETHUSD"];
let category = Category::Linear;
let sender = UnboundedSender<Tickers>;
ws_tickers(subs, category, sender);pub async fn ws_liquidations( &self, subs: Vec<&str>, category: Category, sender: UnboundedSender<LiquidationData>, ) -> Result<(), BybitError>
pub async fn ws_klines( &self, subs: Vec<(&str, &str)>, category: Category, sender: UnboundedSender<WsKline>, ) -> Result<(), BybitError>
pub async fn ws_position( &self, cat: Option<Category>, sender: UnboundedSender<PositionData>, ) -> Result<(), BybitError>
pub async fn ws_executions( &self, cat: Option<Category>, sender: UnboundedSender<ExecutionData>, ) -> Result<(), BybitError>
pub async fn ws_fast_exec( &self, sender: UnboundedSender<FastExecData>, ) -> Result<(), BybitError>
pub async fn ws_orders( &self, cat: Option<Category>, sender: UnboundedSender<OrderData>, ) -> Result<(), BybitError>
pub async fn ws_wallet( &self, sender: UnboundedSender<WalletData>, ) -> Result<(), BybitError>
pub async fn ws_trade_stream<'a, F>( &self, req: UnboundedReceiver<RequestType<'a>>, handler: F, ) -> Result<(), BybitError>
pub async fn event_loop<'a, H>(
stream: WebSocketStream<MaybeTlsStream<TcpStream>>,
handler: H,
order_sender: Option<UnboundedReceiver<RequestType<'a>>>,
) -> Result<(), BybitError>where
H: WebSocketHandler,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stream
impl !RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl !UnwindSafe for Stream
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)