crypto-ws-client 0.5.0

A versatile websocket client that supports many cryptocurrency exchanges.
Documentation

crypto-ws-client

A versatile websocket client that supports many cryptocurrency exchanges.

Usage

use crypto_ws_client::{BinanceSpotWSClient, WSClient};

fn main() {
    let mut ws_client = BinanceSpotWSClient::new(Box::new(|msg| println!("{}", msg)), None);
    let channels = vec!["btcusdt@aggTrade".to_string(), "btcusdt@depth".to_string(),];
    ws_client.subscribe(&channels);
    ws_client.run(None);
    ws_client.close();
}

Contribution

How to add support for a new exchange

1. Add a new file under src/clients/

Define a struct in the file, with the same name as the file.

Define a customized serialize_command().

Define a customized on_misc_msg() to handle misc messages.

Use define_client! macro to implement the WSClient trait.

2. Add exchange specific handling logic in handle_msg() of ws_client_internal.rs

3. Add a new file under tests/

Add a new file under tests/ and put some integration tests in it.