Skip to main content

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//! # NautilusTrader
22//!
23//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
24//! engine for multi-asset, multi-venue trading systems.
25//!
26//! The system spans research, deterministic simulation, and live execution within a single
27//! event-driven architecture, providing research-to-live semantic parity.
28//!
29//! # Feature Flags
30//!
31//! This crate provides feature flags to control source code inclusion during compilation,
32//! depending on the intended use case, i.e. whether to provide Python bindings
33//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
34//! or as part of a Rust only build.
35//!
36//! - `examples`: Enables the crate's example binaries.
37//! - `extension-module`: Builds as a Python extension module.
38//! - `fuzz`: Enables libFuzzer integration for fuzz targets.
39//! - `high-precision` (default): Enables
40//!   [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
41//!   to use 128-bit value types.
42//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
43//!
44//! Python bindings for the Lighter adapter are intentionally scoped to configuration,
45//! enums, factory wiring, and integrator revocation. Data and execution
46//! clients are consumed directly through the Rust trait surface.
47//!
48//! # Integrator attribution
49//!
50//! NautilusTrader participates in [Lighter's partner program](https://apidocs.lighter.xyz/docs/partner-integration).
51//! On Lighter Mainnet, create and modify order transactions from the execution client carry the
52//! NautilusTrader integrator account index in `L2TxAttributes` across all account tiers, including
53//! Standard. Maker and taker integrator fees are zero. Lighter Testnet and both Robinhood environments
54//! leave `L2TxAttributes` empty.
55//!
56//! Lighter requires an `ApproveIntegrator` approval before these attributes can be attached to
57//! Lighter Mainnet orders. During startup, the execution client submits the required zero-fee
58//! approval for a configured L2 account with a non-maker-only API key. Lighter Testnet and both
59//! Robinhood environments do not submit an approval.
60//!
61//! Robinhood Mainnet instead applies the `NAUTILUS` referral to the account's public L1 address
62//! during execution-client startup. Application failures log a warning and do not block trading.
63//! Robinhood Testnet does not apply a referral. See the [Lighter integration guide](https://nautilustrader.io/docs/nightly/integrations/lighter/#integrator-attribution)
64//! for attribution and revocation details.
65
66#![warn(rustc::all)]
67#![deny(unsafe_code)]
68#![deny(nonstandard_style)]
69#![deny(missing_debug_implementations)]
70#![deny(clippy::missing_panics_doc)]
71#![deny(rustdoc::broken_intra_doc_links)]
72// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
73// macro expansion; an item-level `allow` cannot reach the expansion
74#![allow(clippy::clone_on_copy)]
75
76pub mod common;
77pub mod config;
78pub mod data;
79pub mod execution;
80pub mod factories;
81pub mod http;
82pub mod signing;
83pub mod websocket;
84
85pub(crate) mod book;
86
87#[cfg(feature = "python")]
88pub mod python;
89
90#[cfg(test)]
91mod tests;