5 releases (breaking)

0.5.0 Jul 10, 2021
0.4.0 Apr 25, 2021
0.3.0 Dec 6, 2020
0.2.0 Nov 13, 2020
0.1.0 Nov 7, 2020

#22 in #kraken

MIT license

51KB
1K SLoC

🐙 akkorokamui

docs.rs crates.io License: MIT

akkorokamui is a HTTP client written in Rust that allows to query the Kraken REST APIs.

The main goal of this project is to provide a flexible interface and a safe implementation.

Check out the crate documentation to learn how to use akkorokamui.

Example: account balance (async version)

use akkorokamui::{api, Asset, Client, Credentials, Response};
use anyhow::{bail, Result};
use std::collections::HashMap;

type Amount = String;
type Balance<'a> = HashMap<Asset<'a>, Amount>;

#[tokio::main]
async fn main() -> Result<()> {
    let keys_path = "kraken.key";
    let credentials = Credentials::read(keys_path)?;

    let user_agent = "<product>/<product-version>";
    let client = Client::with_credentials(user_agent, credentials)?;

    let api = api::private::balance();
    let resp: Response<Balance> = client.send(api).await?;
    println!("{:?}", resp);

    if let Some(result) = resp.result {
        println!("GBP: {:?}", result.get(&Asset::new("ZGBP")));
    } else {
        bail!("Cannot get balance: {:?}", resp.error);
    }

    Ok(())
}

Dependencies

~5–18MB
~271K SLoC