nautilus_common/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//! Common componentry for [NautilusTrader](https://nautilustrader.io).
17//!
18//! The `nautilus-common` crate provides shared components and utilities that form the system foundation for
19//! NautilusTrader applications. This includes the actor system, message bus, caching layer, and other
20//! essential services.
21//!
22//! # NautilusTrader
23//!
24//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
25//! engine for multi-asset, multi-venue trading systems.
26//!
27//! The system spans research, deterministic simulation, and live execution within a single
28//! event-driven architecture, providing research-to-live semantic parity.
29//!
30//! # Feature Flags
31//!
32//! This crate provides feature flags to control source code inclusion during compilation,
33//! depending on the intended use case, i.e. whether to provide Python bindings
34//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
35//! or as part of a Rust only build.
36//!
37//! - `ffi`: Enables the C foreign function interface (FFI) from [cbindgen](https://github.com/mozilla/cbindgen).
38//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
39//! - `defi`: Enables DeFi (Decentralized Finance) support.
40//! - `indicators`: Includes the `nautilus-indicators` crate and indicator utilities.
41//! - `capnp`: Enables [Cap'n Proto](https://capnproto.org/) serialization support.
42//! - `live`: Enables the Tokio async runtime for live trading.
43//! - `tracing-bridge`: Enables the `tracing` subscriber bridge for log integration.
44//! - `extension-module`: Builds the crate as a Python extension module.
45
46#![warn(rustc::all)]
47#![deny(unsafe_code)]
48#![deny(unsafe_op_in_unsafe_fn)]
49#![deny(nonstandard_style)]
50#![deny(missing_debug_implementations)]
51#![deny(clippy::missing_errors_doc)]
52#![deny(clippy::missing_panics_doc)]
53#![deny(rustdoc::broken_intra_doc_links)]
54
55pub mod actor;
56pub mod cache;
57pub mod clients;
58pub mod clock;
59pub mod component;
60pub mod custom;
61pub mod enums;
62pub mod factories;
63pub mod generators;
64pub mod greeks;
65pub mod logging;
66mod macros;
67pub mod messages;
68pub mod msgbus;
69pub mod providers;
70pub mod runner;
71pub mod signal;
72pub mod testing;
73pub mod throttler;
74pub mod timer;
75pub mod xrate;
76
77#[cfg(feature = "live")]
78pub mod live;
79
80#[cfg(feature = "defi")]
81pub mod defi;
82
83#[cfg(feature = "ffi")]
84pub mod ffi;
85
86#[cfg(feature = "python")]
87pub mod python;
88
89#[cfg(feature = "capnp")]
90pub mod serialization;