pub struct Stream {
pub client: Client,
}Fields§
§client: ClientImplementations§
source§impl Stream
impl Stream
pub async fn ws_ping(&self, private: bool) -> Result<()>
pub async fn ws_priv_subscribe<'a, F>( &self, req: Subscription<'a>, handler: F ) -> Result<()>
pub async fn ws_subscribe<'a, F>( &self, req: Subscription<'a>, category: Category, handler: F ) -> Result<()>
pub fn build_subscription(action: Subscription<'_>) -> String
sourcepub async fn ws_orderbook(
&self,
subs: Vec<(i32, &str)>,
category: Category,
sender: UnboundedSender<OrderBookUpdate>
) -> Result<()>
pub async fn ws_orderbook( &self, subs: Vec<(i32, &str)>, category: Category, sender: UnboundedSender<OrderBookUpdate> ) -> Result<()>
sourcepub async fn ws_trades(
&self,
subs: Vec<&str>,
category: Category,
sender: UnboundedSender<WsTrade>
) -> Result<()>
pub async fn ws_trades( &self, subs: Vec<&str>, category: Category, sender: UnboundedSender<WsTrade> ) -> Result<()>
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<()>
pub async fn ws_tickers( &self, subs: Vec<&str>, category: Category, sender: UnboundedSender<Tickers> ) -> Result<()>
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<()>
pub async fn ws_klines( &self, subs: Vec<(&str, &str)>, category: Category, sender: UnboundedSender<WsKline> ) -> Result<()>
pub async fn ws_position( &self, cat: Option<Category>, sender: UnboundedSender<PositionData> ) -> Result<()>
pub async fn ws_executions( &self, cat: Option<Category>, sender: UnboundedSender<ExecutionData> ) -> Result<()>
pub async fn ws_orders( &self, cat: Option<Category>, sender: UnboundedSender<OrderData> ) -> Result<()>
pub async fn ws_wallet(&self, sender: UnboundedSender<WalletData>) -> Result<()>
pub async fn event_loop<H>(
stream: WebSocketStream<MaybeTlsStream<TcpStream>>,
handler: H
) -> Result<()>where
H: WebSocketHandler,
Trait Implementations§
Auto Trait Implementations§
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