nautilus_blockchain/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//! Blockchain data adapter for [NautilusTrader](https://nautilustrader.io).
17//!
18//! The `nautilus-blockchain` crate loads DEX pools and token definitions and ingests real-time and
19//! historical on-chain data for analytics and trading strategies. It connects RPC and optional
20//! HyperSync sources to NautilusTrader for block, swap, and liquidity-event processing.
21//!
22//! Official API references: [Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/)
23//! and [Envio HyperSync](https://docs.envio.dev/docs/HyperSync/overview).
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//! # Feature Flags
33//!
34//! Feature flags control code inclusion for Rust builds and Python bindings:
35//!
36//! - `extension-module`: Builds as a Python extension module.
37//! - `hypersync`: Enables the
38//! [`hypersync-client`](https://crates.io/crates/hypersync-client) integration.
39//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
40//! - `turmoil`: Enables deterministic network simulation testing with
41//! [turmoil](https://crates.io/crates/turmoil).
42//!
43//! # Documentation
44//!
45//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/blockchain/)
46//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/blockchain/examples)
47//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/blockchain)
48
49#![warn(rustc::all)]
50#![warn(clippy::clone_on_ref_ptr)]
51#![deny(unsafe_code)]
52#![deny(nonstandard_style)]
53#![deny(missing_debug_implementations)]
54#![deny(clippy::missing_errors_doc)]
55#![deny(clippy::missing_panics_doc)]
56#![deny(rustdoc::broken_intra_doc_links)]
57#![allow(
58 clippy::assert_is_empty,
59 reason = "`assert!(x.is_empty())` is clearer than comparing against an empty value"
60)]
61
62pub mod config;
63pub mod constants;
64pub mod contracts;
65pub mod decode;
66pub mod events;
67pub mod math;
68pub mod reporting;
69pub mod rpc;
70
71#[cfg(feature = "hypersync")]
72pub mod cache;
73
74#[cfg(feature = "hypersync")]
75pub mod data;
76
77#[cfg(feature = "hypersync")]
78pub mod exchanges;
79
80#[cfg(feature = "hypersync")]
81pub mod execution;
82
83#[cfg(feature = "hypersync")]
84pub mod factories;
85
86#[cfg(feature = "hypersync")]
87pub mod hypersync;
88
89#[cfg(feature = "python")]
90pub mod python;
91
92#[cfg(feature = "hypersync")]
93pub mod services;