nautilus_trading/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//! Trading strategy machinery and orchestration [NautilusTrader](https://nautilustrader.io).
17//!
18//! The `nautilus-trading` crate provides core trading capabilities including:
19//!
20//! - **Forex sessions**: Market session time calculations and timezone handling.
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//! - `examples`: Enables example strategies (e.g. `EmaCross`) for backtesting and demos.
38//! - `defi`: Enables DeFi (Decentralized Finance) support.
39//! - `high-precision`: Enables [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation#precision-mode) to use 128-bit value types.
40//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
41//! - `extension-module`: Builds the crate as a Python extension module.
42
43#![warn(rustc::all)]
44#![deny(unsafe_code)]
45#![deny(unsafe_op_in_unsafe_fn)]
46#![deny(nonstandard_style)]
47#![deny(missing_debug_implementations)]
48#![deny(clippy::missing_errors_doc)]
49#![deny(clippy::missing_panics_doc)]
50#![deny(rustdoc::broken_intra_doc_links)]
51
52mod macros;
53
54#[doc(hidden)]
55pub mod _macro_reexports {
56 pub use nautilus_common::actor::DataActorCore;
57}
58
59pub mod algorithm;
60pub mod sessions;
61pub mod strategy;
62
63#[cfg(feature = "examples")]
64pub mod examples;
65
66pub use algorithm::{
67 ExecutionAlgorithm, ExecutionAlgorithmConfig, ExecutionAlgorithmCore,
68 ImportableExecAlgorithmConfig, TwapAlgorithm, TwapAlgorithmConfig,
69};
70pub use strategy::{ImportableStrategyConfig, Strategy, StrategyConfig, StrategyCore};
71
72#[cfg(feature = "python")]
73pub mod python;