binance_ws_client 0.2.0

A Rust client for the Binance WebSocket API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use binance_ws_client::{api::subscribe::Levels, Client};
use futures::StreamExt;

#[tokio::main]
async fn main() {
    let mut client = Client::connect_market_data().await.expect("cannot connect");

    client.subscribe_depth("btcusdt", Levels::L10).await;

    let mut depth_events = client.depth_events.unwrap();

    while let Some(msg) = depth_events.next().await {
        dbg!(&msg);
    }
}