nautilus_dydx/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 [dYdX](https://dydx.trade/) decentralized derivatives exchange.
17//!
18//! The `nautilus-dydx` crate provides client bindings (HTTP, WebSocket & gRPC) and data
19//! models for the official **dYdX v4 API**.
20//!
21//! The official dYdX API reference can be found at <https://docs.dydx.xyz/>.
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//! - `high-precision` (default): Enables
37//! [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
38//! to use 128-bit value types.
39//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
40//!
41//! # Integrator Attribution
42//!
43//! Orders built by the gRPC `OrderBuilder` set `order_router_address` to NautilusTrader's address.
44//!
45//! # Documentation
46//!
47//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/dydx/)
48//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/dydx/examples)
49//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/dydx)
50
51#![warn(rustc::all)]
52#![deny(unsafe_code)]
53#![deny(nonstandard_style)]
54#![deny(missing_debug_implementations)]
55#![deny(clippy::missing_errors_doc)]
56#![deny(clippy::missing_panics_doc)]
57#![deny(rustdoc::broken_intra_doc_links)]
58// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
59// macro expansion; an item-level `allow` cannot reach the expansion
60#![allow(clippy::clone_on_copy)]
61
62pub mod common;
63pub mod config;
64pub mod data;
65pub mod error;
66pub mod execution;
67pub mod factories;
68pub mod grpc;
69pub mod http;
70pub mod proto;
71pub mod types;
72pub mod websocket;
73
74#[cfg(feature = "python")]
75pub mod python;
76
77pub use crate::{
78 common::{
79 enums::{
80 DydxCandleResolution, DydxMarketStatus, DydxOrderSide, DydxOrderStatus, DydxOrderType,
81 DydxTickerType, DydxTimeInForce,
82 },
83 models::DydxAccount,
84 },
85 data::DydxDataClient,
86 error::DydxError,
87 factories::{DydxDataClientFactory, DydxExecutionClientFactory},
88 http::{
89 client::DydxHttpClient,
90 error::DydxHttpError,
91 models::{MarketsResponse, PerpetualMarket},
92 },
93 types::DydxOraclePrice,
94 websocket::{
95 client::DydxWebSocketClient,
96 enums::{DydxWsChannel, DydxWsOperation},
97 error::DydxWsError,
98 },
99};