pub struct Stream {
pub client: Client,
}Fields§
§client: ClientImplementations§
source§impl Stream
impl Stream
pub fn ws_ping(&self, private: bool) -> Result<()>
pub fn ws_priv_subscribe<'a, F>( &self, req: Subscription<'a>, handler: F ) -> Result<()>
pub fn ws_subscribe<'a, F>( &self, req: Subscription<'a>, category: Category, handler: F ) -> Result<()>
pub fn build_subscription(action: Subscription<'_>) -> String
sourcepub fn ws_trades(&self, subs: Vec<&str>, category: Category) -> Result<()>
pub fn ws_trades(&self, subs: Vec<&str>, category: Category) -> 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 fn ws_tickers(&self, subs: Vec<&str>, category: Category) -> Result<()>
pub fn ws_tickers(&self, subs: Vec<&str>, category: Category) -> 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;
ws_tickers(subs, category);pub fn ws_klines( &self, subs: Vec<(&str, &str)>, category: Category ) -> Result<()>
pub fn ws_position(&self, cat: Option<Category>) -> Result<()>
pub fn ws_executions(&self, cat: Option<Category>) -> Result<()>
pub fn ws_orders(&self, cat: Option<Category>) -> Result<()>
pub fn ws_wallet(&self) -> Result<()>
pub fn event_loop<H>(
stream: WebSocket<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