Struct tokio_binance::UserDataClient[][src]

pub struct UserDataClient { /* fields omitted */ }

Client for dealing with the user data stream.

Implementations

impl UserDataClient[src]

pub fn connect<A, U>(api_key: A, url: U) -> Result<Self> where
    A: Into<String>,
    U: Into<String>, 
[src]

Creates new client instance

Example

use tokio_binance::{UserDataClient, BINANCE_US_URL};
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = UserDataClient::connect("<api-key>", BINANCE_US_URL)?;
    Ok(())
}

pub fn start_stream(&self) -> ParamBuilder<'_, '_, StartStreamParams>[src]

Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent.

Example

use serde_json::Value;
 
let response = client
    .start_stream()
    .json::<Value>()
    .await?;

pub fn keep_alive<'a>(
    &self,
    listen_key: &'a str
) -> ParamBuilder<'a, '_, KeepAliveStreamParams>
[src]

Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes.

Example

use serde_json::Value;
 
let response = client
    .keep_alive("<listen-key>")
    .json::<Value>()
    .await?;

pub fn close_stream<'a>(
    &self,
    listen_key: &'a str
) -> ParamBuilder<'a, '_, CloseStreamParams>
[src]

Close out a user data stream.

Example

use serde_json::Value;
 
let response = client
    .close_stream("<listen-key>")
    .json::<Value>()
    .await?;

Trait Implementations

impl Clone for UserDataClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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