Crates.io | kraken_futures_rest_client |
lib.rs | kraken_futures_rest_client |
version | 0.26.0 |
source | src |
created_at | 2023-08-14 08:27:39.648992 |
updated_at | 2024-07-10 17:42:30.095228 |
description | A strongly-typed client for the Kraken Futures REST API |
homepage | |
repository | https://github.com/gmosx/kraken-sdk-rust/tree/main/kraken_sdk_futures_rest |
max_upload_size | |
id | 943953 |
size | 25,846 |
A strongly-typed Rust SDK for the Kraken Futures REST API.
This crate is an unofficial, community-driven effort.
[dependencies]
kraken_futures_client_rest = "0.2"
let client = Client::default();
let symbol = "PI_XBTUSD";
let interval = Interval::Min1;
let now = chrono::Local::now();
let from = now - chrono::Duration::minutes(6_000);
let to = from + (1_000 * 60);
let res = client
.get_ohlc(symbol, interval, price_type)
.from(from)
.to(i64::min(now, to))
.send()
.await?;
println!("{}", res.candles);
Providing the lower-level execute
method allows for more flexibility. Since execute
is generic you can pass any type of object to deserialize the response to, e.g. you could deserialize to a HashMap
instead of the 'default' response for each API call. Or you could use a custom struct with only the fields you are interested in.
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.