nautilus_core/
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//! Core foundational types and utilities for [PoseiTrader](http://poseitrader.io).
17//!
18//! The *core* crate is designed to be lightweight, efficient, and to provide zero-cost abstractions
19//! wherever possible. It supplies the essential building blocks used across the PoseiTrader
20//! ecosystem, including:
21//!
22//! - Time handling and atomic clock functionality.
23//! - UUID generation and management.
24//! - Mathematical functions and interpolation utilities.
25//! - Correctness validation functions.
26//! - Serialization traits and helpers.
27//! - Cross-platform environment utilities.
28//! - Abstractions over common collections.
29//!
30//! # Platform
31//!
32//! [PoseiTrader](http://poseitrader.io) is an open-source, high-performance, production-grade
33//! algorithmic trading platform, providing quantitative traders with the ability to backtest
34//! portfolios of automated trading strategies on historical data with an event-driven engine,
35//! and also deploy those same strategies live, with no code changes.
36//!
37//! PoseiTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the
38//! highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
39//!
40//! # Feature flags
41//!
42//! This crate provides feature flags to control source code inclusion during compilation,
43//! depending on the intended use case, i.e. whether to provide Python bindings
44//! for the [posei_trader](https://pypi.org/project/posei_trader) Python package,
45//! or as part of a Rust only build.
46//!
47//! - `ffi`: Enables the C foreign function interface (FFI) from [cbindgen](https://github.com/mozilla/cbindgen).
48//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
49
50#![warn(rustc::all)]
51#![deny(unsafe_code)]
52#![deny(nonstandard_style)]
53#![deny(missing_debug_implementations)]
54#![deny(missing_docs)]
55#![deny(rustdoc::broken_intra_doc_links)]
56
57pub mod collections;
58pub mod consts;
59pub mod correctness;
60pub mod datetime;
61pub mod env;
62pub mod math;
63pub mod message;
64pub mod nanos;
65pub mod parsing;
66pub mod paths;
67pub mod serialization;
68pub mod time;
69pub mod uuid;
70
71#[cfg(feature = "ffi")]
72pub mod ffi;
73
74#[cfg(feature = "python")]
75pub mod python;
76
77#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
78compile_error!("Unsupported platform: Posei supports only Linux, macOS, and Windows");
79
80// Re-exports
81pub use crate::{nanos::UnixNanos, time::AtomicTime, uuid::UUID4};