#rest #trading #kraken #rest-client #api-client #api #client

kraken_rest_client

A strongly-typed client for the Kraken REST API

5 releases (breaking)

0.25.0 Jan 29, 2024
0.24.0 Jan 4, 2024
0.23.0 Sep 6, 2023
0.22.0 Aug 27, 2023
0.20.0 Aug 14, 2023

#2486 in Magic Beans

Download history 5/week @ 2023-12-30 7/week @ 2024-01-27 25/week @ 2024-02-10 47/week @ 2024-02-17 34/week @ 2024-02-24 8/week @ 2024-03-02 24/week @ 2024-03-09 21/week @ 2024-03-16 4/week @ 2024-03-23 27/week @ 2024-03-30 4/week @ 2024-04-06

63 downloads per month

Apache-2.0

96KB
2.5K SLoC

Kraken REST API Client

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

This crate is an unofficial, community-driven effort.

Installation

[dependencies]
kraken_rest_client = "0.20"

Usage

use kraken_rest_client::{Client, PairName, OrderSide};

let client = Client::new(
    "YOUR-API-KEY",
    "YOUR_API-SECRET",
);

let resp = client.get_server_time().send().await?;

println!("{}", resp.unixtime);

let pair = PairName::from("BTC", "USD");
let req = client.get_ohlc_data(&pair).interval(Interval::Day1);
let resp = req.send().await;

println!("{:?}", resp);

let pair = "XXRPZUSD";
let resp = client
    .add_limit_order(pair, OrderSide::Buy, "20", "0.10")
    .expire_after(60 * 60)
    .userref(123)
    .validate_only()
    .send()
    .await?;

println!("{:?}", resp);

let resp = client.cancel_order("O6CIT1-NABRS-TMVZ1X").send().await?;

println!("{}", resp.count);

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

~7–21MB
~302K SLoC