nautilus_derive/lib.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//! [NautilusTrader](https://nautilustrader.io) adapter for
17//! [Derive](https://www.derive.xyz).
18//!
19//! The `nautilus-derive` crate provides integration with the Derive self-custodial onchain
20//! options, perpetuals, and spot exchange. Authentication uses the owner's EOA or multisig
21//! together with a session-key signer; orders are EIP-712 typed-data
22//! signed against the venue's per-action module contracts.
23//!
24//! The official Derive API reference can be found at <https://docs.derive.xyz/>.
25//!
26//! # NautilusTrader
27//!
28//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
29//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
30//!
31//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
32//!
33//! # Feature Flags
34//!
35//! Feature flags control code inclusion for Rust builds and Python bindings:
36//!
37//! - `examples`: Enables the crate's example binaries.
38//! - `extension-module`: Builds as a Python extension module.
39//! - `fuzz`: Enables libFuzzer integration for fuzz targets.
40//! - `high-precision` (default): Enables
41//! [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
42//! to use 128-bit value types.
43//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
44//! - `simulation`: Enables deterministic simulation with `cfg(madsim)`.
45//!
46//! # Integrator Attribution
47//!
48//! Signed order, replace, and trigger-order payloads set `referral_code` to `nautilus`,
49//! with no additional trading cost.
50//!
51//! See [attribution details](https://nautilustrader.io/docs/nightly/integrations/derive/#referral-code-attribution).
52//!
53//! # Documentation
54//!
55//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/derive/)
56//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/derive/examples)
57//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/derive)
58
59#![warn(rustc::all)]
60#![deny(unsafe_code)]
61#![deny(nonstandard_style)]
62#![deny(missing_debug_implementations)]
63#![deny(clippy::missing_panics_doc)]
64#![deny(rustdoc::broken_intra_doc_links)]
65// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
66// macro expansion; an item-level `allow` cannot reach the expansion
67#![allow(clippy::clone_on_copy)]
68
69pub mod common;
70pub mod config;
71pub mod data;
72pub mod execution;
73pub mod factories;
74pub mod http;
75pub mod providers;
76pub mod signing;
77pub mod websocket;
78
79mod book;
80
81#[cfg(feature = "python")]
82pub mod python;
83
84pub use crate::{
85 config::{DeriveDataClientConfig, DeriveExecutionClientConfig},
86 execution::DeriveExecutionClient,
87 factories::{DeriveDataClientFactory, DeriveExecutionClientFactory},
88};
89
90#[cfg(test)]
91#[allow(
92 dead_code,
93 reason = "shared logging fixture also provides integration-only WebSocket servers"
94)]
95mod client_logging {
96 include!("../../../network/tests/integration/common/client_logging.rs");
97}