nautilus_common/messages/mod.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2025 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//! Message types for system communication.
17//!
18//! This module provides message types used for communication between different
19//! parts of the NautilusTrader system, including data requests, execution commands,
20//! and system control messages.
21
22use nautilus_model::{data::Data, events::OrderEventAny};
23use strum::Display;
24
25pub mod data;
26pub mod execution;
27pub mod system;
28
29#[cfg(feature = "defi")]
30pub mod defi;
31
32// Re-exports
33pub use data::{DataResponse, SubscribeCommand, UnsubscribeCommand};
34pub use execution::ExecutionReport;
35
36// TODO: Refine this to reduce disparity between enum sizes
37#[allow(clippy::large_enum_variant)]
38#[derive(Debug, Display)]
39pub enum DataEvent {
40 Response(DataResponse),
41 Data(Data),
42 #[cfg(feature = "defi")]
43 DeFi(nautilus_model::defi::data::DefiData),
44}
45
46/// Execution event variants for order events and reports.
47#[allow(clippy::large_enum_variant)]
48#[derive(Debug, Display)]
49pub enum ExecutionEvent {
50 Order(OrderEventAny),
51 Report(ExecutionReport),
52}