nautilus_lighter/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 the [Lighter](https://lighter.xyz) DEX.
17//!
18//! The `nautilus-lighter` crate provides integration with the Lighter protocol for trading
19//! perpetual futures and spot markets on the Lighter and Robinhood Chain deployments.
20//!
21//! The official Lighter API reference can be found at <https://docs.lighter.xyz/api>.
22//!
23//! # NautilusTrader
24//!
25//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
26//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
27//!
28//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
29//!
30//! # Feature Flags
31//!
32//! Feature flags control code inclusion for Rust builds and Python bindings:
33//!
34//! - `examples`: Enables the crate's example binaries.
35//! - `extension-module`: Builds as a Python extension module.
36//! - `fuzz`: Enables libFuzzer integration for fuzz targets.
37//! - `high-precision` (default): Enables
38//! [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
39//! to use 128-bit value types.
40//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
41//!
42//! Python bindings for the Lighter adapter are intentionally scoped to configuration,
43//! enums, factory wiring, and integrator revocation. Data and execution
44//! clients are consumed directly through the Rust trait surface.
45//!
46//! # Integrator Attribution
47//!
48//! On Lighter and Robinhood mainnets, the execution client adds NautilusTrader's integrator account index
49//! to create and modify transactions with zero integrator fees. At startup it attempts to approve the
50//! integrator and apply the `NAUTILUS` referral code. Both testnets omit attribution.
51//!
52//! See [attribution details](https://nautilustrader.io/docs/nightly/integrations/lighter/#integrator-attribution)
53//! for approval, maker-only keys, and revocation.
54//!
55//! # Documentation
56//!
57//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/lighter/)
58//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/lighter/examples)
59//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/lighter)
60
61#![warn(rustc::all)]
62#![deny(unsafe_code)]
63#![deny(nonstandard_style)]
64#![deny(missing_debug_implementations)]
65#![deny(clippy::missing_panics_doc)]
66#![deny(rustdoc::broken_intra_doc_links)]
67// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
68// macro expansion; an item-level `allow` cannot reach the expansion
69#![allow(clippy::clone_on_copy)]
70
71pub mod common;
72pub mod config;
73pub mod data;
74pub mod execution;
75pub mod factories;
76pub mod http;
77pub mod signing;
78pub mod websocket;
79
80pub(crate) mod book;
81
82#[cfg(feature = "python")]
83pub mod python;
84
85#[cfg(test)]
86mod tests;