kraken-sdk

Crates.iokraken-sdk
lib.rskraken-sdk
version0.1.1
created_at2025-12-24 12:33:34.943115+00
updated_at2025-12-27 10:57:44.766767+00
descriptionHigh-level SDK for Kraken WebSocket API v2
homepage
repositoryhttps://github.com/hitakshiA/Havklo_sdk
max_upload_size
id2003119
size296,814
Hitakshi Arora (hitakshiA)

documentation

README

kraken-sdk

High-level Rust SDK for Kraken WebSocket API v2 with sub-microsecond orderbook operations.

Quick Start

Add to Cargo.toml:

[dependencies]
kraken-sdk = "0.1"
tokio = { version = "1", features = ["full"] }

Example code:

use kraken_sdk::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = KrakenClient::builder(vec!["BTC/USD".into()])
        .with_depth(Depth::D10)
        .with_book(true)
        .connect()
        .await?;

    loop {
        tokio::time::sleep(std::time::Duration::from_secs(1)).await;

        if let Some(spread) = client.spread("BTC/USD") {
            println!("Spread: {}", spread);
        }
    }
}

Features

  • Sub-microsecond orderbook — 3.5ns spread calculation, 100ns delta updates
  • L2 + L3 orderbooks — Price levels and individual order tracking
  • CRC32 validation — Automatic checksum verification on every update
  • Auto-reconnect — Exponential backoff with circuit breaker
  • Financial precision — rust_decimal throughout (no floating point errors)

Optional Features

# Prometheus metrics
kraken-sdk = { version = "0.1", features = ["metrics"] }

# Authenticated trading
kraken-sdk = { version = "0.1", features = ["auth"] }

Documentation & Examples

Part of Havklo

This crate is part of the Havklo SDK workspace.

License

MIT

Commit count: 0

cargo fmt