Skip to main content

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), data
19//! models, and helper utilities that wrap the official **dYdX v4 API**.
20//!
21//! # Official Documentation
22//!
23//! | Resource                             | Reference                                              |
24//! |--------------------------------------|--------------------------------------------------------|
25//! | Main documentation                   | <https://docs.dydx.xyz>                                |
26//! | Indexer HTTP API                     | <https://docs.dydx.xyz/api_integration-indexer/indexer_api> |
27//! | Indexer WebSocket API                | <https://docs.dydx.xyz/api_integration-indexer/indexer_websocket> |
28//! | Order types                          | <https://docs.dydx.xyz/concepts/trading/orders>        |
29//! | Permissioned keys                    | <https://docs.dydx.xyz/concepts/trading/authenticators> |
30//! | Validator client (gRPC)              | <https://docs.dydx.xyz/api_integration-clients/validator_client> |
31//!
32//! # NautilusTrader
33//!
34//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
35//! engine for multi-asset, multi-venue trading systems.
36//!
37//! The system spans research, deterministic simulation, and live execution within a single
38//! event-driven architecture, providing research-to-live semantic parity.
39//!
40//! # Feature Flags
41//!
42//! This crate provides feature flags to control source code inclusion during compilation,
43//! depending on the intended use case, i.e. whether to provide Python bindings
44//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
45//! or as part of a Rust only build.
46//!
47//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
48//! - `extension-module`: Builds as a Python extension module.
49//!
50//! [High-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation#precision-mode) (128-bit value types) is enabled by default.
51
52#![warn(rustc::all)]
53#![deny(unsafe_code)]
54#![deny(nonstandard_style)]
55#![deny(missing_debug_implementations)]
56#![deny(clippy::missing_errors_doc)]
57#![deny(clippy::missing_panics_doc)]
58#![deny(rustdoc::broken_intra_doc_links)]
59
60pub mod common;
61pub mod config;
62pub mod data;
63pub mod error;
64pub mod execution;
65pub mod factories;
66pub mod grpc;
67pub mod http;
68pub mod proto;
69pub mod types;
70pub mod websocket;
71
72#[cfg(feature = "python")]
73pub mod python;
74
75pub use crate::{
76    common::{
77        enums::{
78            DydxCandleResolution, DydxMarketStatus, DydxOrderSide, DydxOrderStatus, DydxOrderType,
79            DydxTickerType, DydxTimeInForce,
80        },
81        models::DydxAccount,
82    },
83    data::DydxDataClient,
84    error::DydxError,
85    factories::{DydxDataClientFactory, DydxExecutionClientFactory},
86    http::{
87        client::DydxHttpClient,
88        error::DydxHttpError,
89        models::{MarketsResponse, PerpetualMarket},
90    },
91    types::DydxOraclePrice,
92    websocket::{
93        client::DydxWebSocketClient,
94        enums::{DydxWsChannel, DydxWsOperation},
95        error::DydxWsError,
96    },
97};