Crates.io | kraken_sdk_ws |
lib.rs | kraken_sdk_ws |
version | 0.19.0 |
source | src |
created_at | 2021-08-28 07:02:35.908782 |
updated_at | 2023-08-01 17:18:15.154841 |
description | A strongly-typed client for the Kraken WebSocket API |
homepage | |
repository | https://github.com/gmosx/kraken_sdk_rust/tree/main/kraken_sdk_ws |
max_upload_size | |
id | 443353 |
size | 73,388 |
A strongly-typed Rust SDK for the Kraken WebSocket API.
This crate is an unofficial, community-driven effort.
[dependencies]
kraken_sdk_ws = "0.18"
use futures::StreamExt;
use kraken_sdk_ws::{api::SubscribeTickerRequest, client::WS_URL, Client};
#[tokio::main]
async fn main() {
let mut client = Client::connect(WS_URL, None).await.expect("cannot connect");
let req = SubscribeTickerRequest::new(&["BTC/USD"]);
client.send(req).await.expect("cannot send request");
loop {
if let Some(msg) = client.messages.next().await {
dbg!(&msg);
}
}
}
or run the example:
cargo run --example ticker
The software is under active development and the API is expected to change.
Pull requests, issues and comments are welcome! Make sure to add tests for new features and bug fixes.
This work is licensed under the Apache-2.0 License. See LICENSE.txt or https://spdx.org/licenses/Apache-2.0.html for details.
Copyright © 2022 Georgios Moschovitis.