nautilus_model/
lib.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3//  https://poseitrader.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 domain model for [PoseiTrader](http://poseitrader.io).
17//!
18//! The *model* crate provides a type-safe domain model that forms the backbone of PoseiTrader
19//! and can serve as the foundation for other algorithmic trading systems.
20//!
21//! # Platform
22//!
23//! [PoseiTrader](http://poseitrader.io) is an open-source, high-performance, production-grade
24//! algorithmic trading platform, providing quantitative traders with the ability to backtest
25//! portfolios of automated trading strategies on historical data with an event-driven engine,
26//! and also deploy those same strategies live, with no code changes.
27//!
28//! PoseiTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the
29//! highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
30//!
31//! # Feature flags
32//!
33//! This crate provides feature flags to control source code inclusion during compilation,
34//! depending on the intended use case, i.e. whether to provide Python bindings
35//! for the [posei_trader](https://pypi.org/project/posei_trader) Python package,
36//! or as part of a Rust only build.
37//!
38//! - `ffi`: Enables the C foreign function interface (FFI) from [cbindgen](https://github.com/mozilla/cbindgen).
39//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
40//! - `stubs`: Enables type stubs for use in testing scenarios.
41//! - `high-precision`: Enables [high-precision mode](docs/latestnightly/getting_started/installation#precision-mode) to use 128-bit value types.
42
43#![warn(rustc::all)]
44#![deny(unsafe_code)]
45#![deny(nonstandard_style)]
46#![deny(missing_debug_implementations)]
47#![deny(clippy::missing_errors_doc)]
48#![deny(clippy::missing_panics_doc)]
49#![deny(rustdoc::broken_intra_doc_links)]
50
51pub mod accounts;
52pub mod currencies;
53pub mod data;
54pub mod enums;
55pub mod events;
56pub mod identifiers;
57pub mod instruments;
58pub mod macros;
59pub mod orderbook;
60pub mod orders;
61pub mod position;
62pub mod reports;
63pub mod types;
64pub mod venues;
65
66#[cfg(feature = "ffi")]
67pub mod ffi;
68
69#[cfg(feature = "python")]
70pub mod python;
71
72#[cfg(any(test, feature = "stubs"))]
73pub mod stubs;
74
75#[cfg(feature = "defi")]
76pub mod defi;