Struct bitsors::websocket::BitsoWebSocket[][src]

pub struct BitsoWebSocket { /* fields omitted */ }
Expand description

Bitso WebSocket object.

For more info see: https://bitso.com/api_info?#websocket-api

Check all the possible options in Books and Subscription

Examples

use bitsors::websocket::*;
let mut socket = BitsoWebSocket::new().await.unwrap();

// You can subscribe to a specific orders channel
socket.subscribe(Subscription::Orders, Books::BtcMxn).await.unwrap();
                                                         
// You can also iterate over all the Books and Subscription channels
for book in Books::iter() {
    for subs in Subscription::iter() {
        socket.subscribe(subs, book).await.unwrap();
    }
}

loop {
    match socket.read().await.unwrap() {
        Response::Orders(r) => println!("{:?}", r),
        Response::Trades(r) => println!("{:?}", r),
        Response::DiffOrders(r) => println!("{:?}", r),
    }
}

Implementations

Creates a new WebSocket connection.

Closes an existing WebSocket connection.

Creates a subscription request to a given channel.

Reads the response from the WebSocket connection.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.