Skip to main content

Crate nautilus_core

Crate nautilus_core 

Source
Expand description

Core foundational types and utilities for NautilusTrader.

The nautilus-core crate is designed to be lightweight, efficient, and to provide zero-cost abstractions wherever possible. It supplies the essential building blocks used across the NautilusTrader ecosystem, including:

  • Time handling and atomic clock functionality.
  • UUID generation and management.
  • Mathematical functions and interpolation utilities.
  • Correctness validation functions.
  • Serialization traits and codecs.
  • Cross-platform environment utilities.
  • Abstractions over common collections.

§NautilusTrader

NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.

The system spans research, deterministic simulation, and live execution within a single event-driven architecture, providing research-to-live semantic parity.

§Feature Flags

This crate provides feature flags to control source code inclusion during compilation, depending on the intended use case, i.e. whether to provide Python bindings for the nautilus_trader Python package, or as part of a Rust only build.

  • extension-module: Builds as a Python extension module.
  • ffi: Enables the C foreign function interface (FFI) from cbindgen.
  • python: Enables Python bindings from PyO3.
  • simulation: Enables deterministic simulation testing with MadSim.

Re-exports§

pub use interval::ClosedInterval;
pub use crate::params::from_pydict;
pub use crate::collections::AtomicMap;
pub use crate::collections::AtomicSet;
pub use crate::nanos::DurationNanos;
pub use crate::nanos::DurationNanosOutOfRangeError;
pub use crate::nanos::UnixNanos;
pub use crate::params::Params;
pub use crate::shared::SharedCell;
pub use crate::shared::WeakCell;
pub use crate::string::stack_str::STACKSTR_CAPACITY;
pub use crate::string::stack_str::StackStr;
pub use crate::time::AtomicTime;
pub use crate::uuid::UUID4;

Modules§

collections
Abstraction layer over common hash-based containers.
consts
Core constants.
correctness
Functions for correctness checks similar to the design by contract philosophy.
datetime
Common data and time functions.
env
Cross-platform environment variable utilities.
ffi
C foreign function interface (FFI) from cbindgen.
hex
Hexadecimal encoding and decoding for byte slices.
interval
Closed interval types shared across request planning and persistence coverage.
math
Mathematical functions and interpolation utilities.
nanos
Nanosecond timestamp and duration types.
params
Generic parameter storage using IndexMap<String, Value>.
paths
Utility functions for resolving project and workspace directory paths.
python
Python bindings and interoperability built using PyO3.
serialization
Common serialization traits and functions.
shared
Wrappers around shared, interior-mutable cell pairs.
string
String types, operations, parsing, and encodings.
time
The core AtomicTime for real-time and static clocks.
uuid
A UUID4 Universally Unique Identifier (UUID) version 4 (RFC 4122).

Macros§

approx_eq
Macro for approximate floating-point equality comparison.
impl_pyo3_config_getters
Implements read-only Python getters for cloneable configuration fields.