nautilus_execution/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//! Order execution engine for [PoseiTrader](http://poseitrader.io).
17//!
18//! The *execution* crate provides a comprehensive order execution system that handles the complete
19//! order lifecycle from submission to fill processing. This includes sophisticated order matching,
20//! execution venue integration, and advanced order type emulation:
21//!
22//! - **Execution engine**: Central orchestration of order routing and position management.
23//! - **Order matching engine**: High-fidelity market simulation for backtesting and paper trading.
24//! - **Order emulator**: Advanced order types not natively supported by venues (trailing stops, contingent orders).
25//! - **Execution clients**: Abstract interfaces for connecting to trading venues and brokers.
26//! - **Order manager**: Local order lifecycle management and state tracking.
27//! - **Matching core**: Low-level order book and price-time priority matching algorithms.
28//! - **Fee and fill models**: Configurable execution cost simulation and realistic fill behavior.
29//!
30//! The crate supports both live trading environments (with real execution clients) and simulated
31//! environments (with matching engines), making it suitable for production trading, strategy
32//! development, and comprehensive backtesting.
33//!
34//! # Platform
35//!
36//! [PoseiTrader](http://poseitrader.io) is an open-source, high-performance, production-grade
37//! algorithmic trading platform, providing quantitative traders with the ability to backtest
38//! portfolios of automated trading strategies on historical data with an event-driven engine,
39//! and also deploy those same strategies live, with no code changes.
40//!
41//! PoseiTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the
42//! highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
43//!
44//! # Feature flags
45//!
46//! This crate provides feature flags to control source code inclusion during compilation,
47//! depending on the intended use case, i.e. whether to provide Python bindings
48//! for the [posei_trader](https://pypi.org/project/posei_trader) Python package,
49//! or as part of a Rust only build.
50//!
51//! - `ffi`: Enables the C foreign function interface (FFI) from [cbindgen](https://github.com/mozilla/cbindgen).
52//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
53
54#![warn(rustc::all)]
55#![deny(unsafe_code)]
56#![deny(nonstandard_style)]
57#![deny(missing_debug_implementations)]
58#![deny(clippy::missing_errors_doc)]
59#![deny(clippy::missing_panics_doc)]
60#![deny(rustdoc::broken_intra_doc_links)]
61
62pub mod client;
63pub mod engine;
64pub mod matching_core;
65pub mod matching_engine;
66pub mod models;
67pub mod order_emulator;
68pub mod order_manager;
69pub mod trailing;