nautilus_common/clients/mod.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2026 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//! Client trait definitions for data and execution clients.
17//!
18//! Provides the core trait interfaces that define how clients interact with
19//! data providers and execution venues.
20
21mod data;
22mod execution;
23
24use std::{
25 any::type_name,
26 fmt::{Debug, Display},
27};
28
29pub use data::DataClient;
30pub use execution::{
31 DEFAULT_POSITION_RECONCILIATION_TOLERANCE, ExecutionClient, ExecutionReportTask,
32 generate_mass_status,
33};
34use nautilus_model::identifiers::ClientId;
35
36#[inline(always)]
37fn log_not_implemented<T>(client_id: ClientId, _cmd: &T) {
38 log::warn!(
39 "Handler not implemented: client {client_id}, command {}",
40 type_name::<T>()
41 );
42}
43
44/// Logs trusted command context without formatting the provider error.
45///
46/// Pass only public command metadata; omit credentials and free-form parameters.
47/// Retains the error parameter for caller compatibility; its text is not logged.
48#[inline(always)]
49pub fn log_command_error<C: Debug, E: Display>(cmd: &C, _e: &E) {
50 log::error!("Client command failed: {cmd:?}");
51}