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 API for trading
19//! perpetual futures and spot markets on a zk-rollup decentralized exchange.
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//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
37//! - `extension-module`: Builds as a Python extension module.
38//!
39//! Python bindings for the Lighter adapter are intentionally scoped to configuration,
40//! enums, factory wiring, and integrator revocation. Data and execution
41//! clients are consumed directly through the Rust trait surface.
42//!
43//! [High-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation#precision-mode) (128-bit value types) is enabled by default.
44//!
45//! # Integrator attribution
46//!
47//! Submitted create and modify order transactions carry the NautilusTrader integrator account index
48//! in Lighter's `L2TxAttributes`. This helps us gauge real usage of the integration and prioritize
49//! ongoing maintenance. Maker and taker integrator fees are set to zero, so attribution adds no
50//! trading cost.
51//!
52//! Lighter requires an `ApproveIntegrator` approval before these attributes can be attached to
53//! orders. During startup, the execution client submits the required zero-fee approval for the
54//! configured L2 account. See the
55//! [Lighter integration guide](https://nautilustrader.io/docs/nightly/integrations/lighter.html#integrator-attribution)
56//! for approval and revocation details.
57
58#![warn(rustc::all)]
59#![deny(unsafe_code)]
60#![deny(nonstandard_style)]
61#![deny(missing_debug_implementations)]
62#![deny(clippy::missing_panics_doc)]
63#![deny(rustdoc::broken_intra_doc_links)]
64
65pub mod common;
66pub mod config;
67pub mod data;
68pub mod execution;
69pub mod factories;
70pub mod http;
71pub mod signing;
72pub mod websocket;
73
74#[cfg(feature = "python")]
75pub mod python;