Back to Nautilus Trader

nautilus-kraken

crates/adapters/kraken/README.md

1.226.04.4 KB
Original Source

nautilus-kraken

NautilusTrader adapter for the Kraken exchange.

The nautilus-kraken crate provides client bindings (HTTP & WebSocket), data models, and helper utilities that wrap the official Kraken API v2.

The official Kraken API reference can be found at https://docs.kraken.com/api/.

NautilusTrader

NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.

The system spans research, deterministic simulation, and live execution within a single event-driven architecture, providing research-to-live semantic parity.

Features

  • HTTP REST API clients for market data (Spot v2, Futures v3).
  • WebSocket clients for real-time data feeds (Spot v2, Futures).
  • Support for both Spot and Futures markets.
  • Instrument, ticker, trade, orderbook, and OHLC data.
  • Prepared for execution support (orders, positions, balances) - WIP.

Architecture

This crate provides separate HTTP and WebSocket clients for Spot and Futures markets. This design reflects fundamental differences between the two APIs:

AspectSpotFutures
API VersionREST API v2Derivatives API v3
Base URLapi.kraken.comfutures.kraken.com
Auth HeadersAPI-Key, API-SignAPIKey, Authent, Nonce
Request FormatURL-encoded formJSON body
WebSocketv2 protocolFutures-specific protocol

Kraken Futures was originally a separate platform (Crypto Facilities) acquired by Kraken, which explains why the APIs remain distinct rather than unified.

Client Types

  • KrakenSpotHttpClient / KrakenSpotWebSocketClient: For spot trading pairs (e.g., BTC/USD, ETH/EUR).
  • KrakenFuturesHttpClient / KrakenFuturesWebSocketClient: For perpetual and fixed-maturity futures (e.g., PF_XBTUSD, PI_ETHUSD).

Bitcoin symbol format

MarketFormatExampleNotes
SpotBTCBTC/USDXBT normalized to BTC (base or quote position).
FuturesXBTPI_XBTUSDUses Kraken's native XBT format.

Examples

See the bin/ directory for example usage:

bash
cargo run --bin kraken-http-spot-raw
cargo run --bin kraken-http-spot-public
cargo run --bin kraken-ws-spot-data

Feature flags

This crate provides feature flags to control source code inclusion during compilation:

  • python: Enables Python bindings from PyO3.
  • extension-module: Builds as a Python extension module.

High-precision mode (128-bit value types) is enabled by default.

Documentation

See the docs for more detailed usage.

License

The source code for NautilusTrader is available on GitHub under the GNU Lesser General Public License v3.0.


NautilusTrader™ is developed and maintained by Nautech Systems, a technology company specializing in the development of high-performance trading systems. For more information, visit https://nautilustrader.io.

Use of this software is subject to the Disclaimer.

© 2015-2026 Nautech Systems Pty Ltd. All rights reserved.