#rest #rest-client #kraken #api-client #future #api #client

kraken_futures_rest_client

A strongly-typed client for the Kraken Futures REST API

7 releases (breaking)

0.27.0 Nov 28, 2024
0.26.0 Jul 10, 2024
0.25.0 Jan 29, 2024
0.24.0 Jan 4, 2024
0.20.0 Aug 14, 2023

#949 in Magic Beans

Download history 8/week @ 2024-09-15 13/week @ 2024-09-22 1/week @ 2024-09-29 106/week @ 2024-11-24 18/week @ 2024-12-01

124 downloads per month

Apache-2.0

17KB
344 lines

Kraken Futures REST API

A strongly-typed Rust SDK for the Kraken Futures REST API.

This crate is an unofficial, community-driven effort.

Installation

[dependencies]
kraken_futures_client_rest = "0.2"

Usage

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);

FAQ

Why provide both execute and send methods for API endpoint handlers?

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.

Status

The software is under active development and the API is expected to change.

Contributing

Pull requests, issues and comments are welcome! Make sure to add tests for new features and bug fixes.

License

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.

Dependencies

~8–19MB
~253K SLoC