Struct bybit::ws::Stream

source ·
pub struct Stream {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl Stream

source

pub fn ws_ping(&self, private: bool) -> Result<()>

source

pub fn ws_priv_subscribe<'a, F>( &self, req: Subscription<'a>, handler: F ) -> Result<()>
where F: FnMut(WebsocketEvents) -> Result<()> + 'static + Send,

source

pub fn ws_subscribe<'a, F>( &self, req: Subscription<'a>, category: Category, handler: F ) -> Result<()>
where F: FnMut(WebsocketEvents) -> Result<()> + 'static + Send,

source

pub fn build_subscription(action: Subscription<'_>) -> String

source

pub fn ws_orderbook( &self, subs: Vec<(i32, &str)>, category: Category ) -> Result<()>

Subscribes to the specified order book updates and handles the order book events

§Arguments
  • subs - A vector of tuples containing the order book ID and symbol
  • category - The category of the order book
§Example
use your_crate_name::Category;
let subs = vec![(1, "BTC"), (2, "ETH")];
source

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 subscriptions
  • category - The category of the trades
§Example
use your_crate_name::Category;
let subs = vec!["BTCUSD", "ETHUSD"];
let category = Category::Linear;
ws_trades(subs, category);
source

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);
source

pub fn ws_klines( &self, subs: Vec<(&str, &str)>, category: Category ) -> Result<()>

source

pub fn ws_position(&self, cat: Option<Category>) -> Result<()>

source

pub fn ws_executions(&self, cat: Option<Category>) -> Result<()>

source

pub fn ws_orders(&self, cat: Option<Category>) -> Result<()>

source

pub fn ws_wallet(&self) -> Result<()>

source

pub fn event_loop<H>( stream: WebSocket<MaybeTlsStream<TcpStream>>, handler: H ) -> Result<()>

Trait Implementations§

source§

impl Bybit for Stream

source§

fn new(api_key: Option<String>, secret_key: Option<String>) -> Stream

source§

fn new_with_config( config: &Config, api_key: Option<String>, secret_key: Option<String> ) -> Stream

source§

impl Clone for Stream

source§

fn clone(&self) -> Stream

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more