High performance cryptocurrency trading API with support for user defined networking.
Add dependencies in Cargo.toml
:
toml
[dependencies]
ecbt = "0.1"
ecbt-exchange = "0.1"
ecbt-binance = "0.1"
tokio = { version = "1", features = ["full"] }
```rust use std::borrow::Borrow;
use ecbt::{ prelude::{ marketpair::{Currency, MarketPair}, GetPriceTickerRequest, }, Ecbt, }; use ecbtbinance::{Binance, BinanceParameters}; use ecbt_exchange::ExchangeMarketData;
async fn main() {
let ecbt = Ecbt::http::
```rust use ecbt::{ prelude::{ marketpair::{Currency, MarketPair}, websocket::{EcbtWebSocketMessage, Subscription, WebSocketResponse}, ExchangeStream, }, Ecbt, }; use ecbtbinance::{BinanceParameters, BinanceWebsocket};
async fn main() {
let ecbt = Ecbt::ws::
ecbt.subscribe(Subscription::OrderBookUpdates(market), move |m| {
let r = m.as_ref();
if let Ok(WebSocketResponse::Generic(EcbtWebSocketMessage::OrderBook(order_book))) = r {
println!("{:?}", order_book)
} else if let Err(err) = r {
println!("{:#?}", err);
}
})
.await
.expect("Failed to subscribe to orderbook on Binance");
std::thread::sleep(std::time::Duration::from_millis(5000));
} ```
Because there are many exchanges, if ecbt has not been implemented, you may need to implement it yourself.
Contact or join us @oss-jtyd.