Skip to main content

nautilus_system/
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//! System-level components and orchestration for [NautilusTrader](https://nautilustrader.io).
17//!
18//! The `nautilus-system` crate provides the core system architecture for orchestrating trading systems,
19//! including the kernel that manages all engines, configuration management,
20//! and system-level factories for creating components:
21//!
22//! - `NautilusKernel` - Core system orchestrator managing engines and components.
23//! - `NautilusKernelConfig` - Configuration for kernel initialization.
24//! - System builders and factories for component creation.
25//!
26//! # NautilusTrader
27//!
28//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
29//! engine for multi-asset, multi-venue trading systems.
30//!
31//! The system spans research, deterministic simulation, and live execution within a single
32//! event-driven architecture, providing research-to-live semantic parity.
33//!
34//! # Feature Flags
35//!
36//! This crate provides feature flags to control source code inclusion during compilation,
37//! depending on the intended use case, i.e. whether to provide Python bindings
38//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
39//! or as part of a Rust only build.
40//!
41//! - `defi`: Enables DeFi (Decentralized Finance) support.
42//! - `extension-module`: Builds as a Python extension module.
43//! - `live`: Enables live trading mode dependencies.
44//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs) and auto-enables `streaming`.
45//! - `streaming`: Enables the `nautilus-persistence` dependency for streaming configuration.
46//! - `tracing-bridge`: Enables the `tracing` subscriber bridge for log integration.
47
48#![warn(rustc::all)]
49#![warn(clippy::pedantic)]
50#![allow(
51    clippy::manual_let_else,
52    clippy::option_if_let_else,
53    clippy::or_fun_call,
54    clippy::redundant_else,
55    clippy::similar_names,
56    clippy::single_match_else,
57    reason = "workspace policy; generated by scripts/update-clippy-allowances.py"
58)]
59#![deny(unsafe_code)]
60#![deny(unsafe_op_in_unsafe_fn)]
61#![deny(nonstandard_style)]
62#![deny(missing_debug_implementations)]
63#![deny(clippy::missing_errors_doc)]
64#![deny(clippy::missing_panics_doc)]
65#![deny(rustdoc::broken_intra_doc_links)]
66#![allow(
67    clippy::assert_is_empty,
68    reason = "`assert!(x.is_empty())` is clearer than comparing against an empty value"
69)]
70
71pub mod builder;
72pub mod clock_factory;
73pub mod config;
74pub mod controller;
75pub mod event_store;
76pub mod kernel;
77pub mod messages;
78pub mod trader;
79
80mod registration;
81
82#[cfg(feature = "python")]
83pub mod python;
84
85// Re-exports
86pub use builder::NautilusKernelBuilder;
87pub use clock_factory::ClockFactory;
88pub use config::NautilusKernelConfig;
89#[cfg(feature = "streaming")]
90pub use config::{RotationConfig, StreamingConfig};
91pub use controller::Controller;
92pub use event_store::{EventStoreFactory, KernelEventStore, RegisteredComponents};
93pub use kernel::NautilusKernel;
94pub use messages::{
95    ControllerCommand, CreateActor, CreateStrategy, RemoveActor, RemoveStrategy, StartActor,
96    StartStrategy, StopActor, StopStrategy,
97};
98#[cfg(feature = "python")]
99pub use python::{FactoryRegistry, get_global_pyo3_registry};