nautilus_kraken/lib.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3// https://nautechsystems.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! [NautilusTrader](https://nautilustrader.io) adapter for the
17//! [Kraken](https://www.kraken.com) exchange.
18//!
19//! The `nautilus-kraken` crate provides separate Spot and Futures data and execution clients over HTTP
20//! and WebSocket. It includes typed API models, instrument loading, order and account updates, and
21//! live-node factories for both markets.
22//!
23//! The official Kraken API reference can be found at <https://docs.kraken.com/>.
24//!
25//! # NautilusTrader
26//!
27//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
28//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
29//!
30//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
31//!
32//! # Features
33//!
34//! - REST API v2 client for market data and account operations.
35//! - WebSocket v2 client for real-time data feeds.
36//! - Support for Spot and Futures markets.
37//! - Instrument, ticker, trade, orderbook, and OHLC data.
38//! - Prepared for execution support (orders, positions, balances).
39//!
40//! # Feature Flags
41//!
42//! Feature flags control code inclusion for Rust builds and Python bindings:
43//!
44//! - `examples`: Enables the crate's example binaries.
45//! - `extension-module`: Builds as a Python extension module.
46//! - `high-precision` (default): Enables
47//! [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
48//! to use 128-bit value types. Keep this default for Futures because Kraken may return instrument
49//! precision above standard-precision mode's nine-decimal limit.
50//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
51//!
52//! # Integrator Attribution
53//!
54//! Spot and Futures HTTP order builders set `broker` to NautilusTrader's integration ID.
55//! Raw HTTP clients preserve caller-provided parameters, and Spot WebSocket orders omit attribution.
56//!
57//! # Documentation
58//!
59//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/kraken/)
60//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/kraken/examples)
61//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/kraken)
62
63// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
64// macro expansion; an item-level `allow` cannot reach the expansion
65#![allow(clippy::clone_on_copy)]
66
67pub mod common;
68pub mod config;
69pub mod data;
70pub mod execution;
71pub mod factories;
72pub mod http;
73pub mod websocket;
74
75#[cfg(feature = "python")]
76pub mod python;
77
78pub use config::{KrakenDataClientConfig, KrakenExecutionClientConfig};
79pub use data::{KrakenFuturesDataClient, KrakenSpotDataClient};
80pub use execution::{KrakenFuturesExecutionClient, KrakenSpotExecutionClient};
81pub use http::{
82 KrakenFuturesHttpClient, KrakenFuturesRawHttpClient, KrakenHttpError, KrakenSpotHttpClient,
83 KrakenSpotRawHttpClient,
84};
85pub use websocket::{
86 futures::client::KrakenFuturesWebSocketClient, spot_v2::client::KrakenSpotWebSocketClient,
87};