Crates.io | akkorokamui |
lib.rs | akkorokamui |
version | 0.5.0 |
source | src |
created_at | 2020-11-07 11:23:57.969667 |
updated_at | 2021-07-10 10:13:35.043481 |
description | Kraken REST APIs HTTP client |
homepage | |
repository | https://github.com/gliderkite/akkorokamui |
max_upload_size | |
id | 309607 |
size | 55,090 |
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
.
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(())
}