nautilus_dydx/lib.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2025 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](http://nautilustrader.io) adapter for the [dYdX](https://dydx.trade/) decentralized derivatives exchange.
17//!
18//! The `nautilus-dydx` crate provides client bindings (HTTP & WebSocket), data
19//! models, and helper utilities that wrap the official **dYdX v4 API**.
20//!
21//! The official dYdX v4 documentation can be found at <https://docs.dydx.trade/>.
22//! All public links inside this crate reference the official documentation.
23//!
24//! # Platform
25//!
26//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
27//! algorithmic trading platform, providing quantitative traders with the ability to backtest
28//! portfolios of automated trading strategies on historical data with an event-driven engine,
29//! and also deploy those same strategies live, with no code changes.
30//!
31//! NautilusTrader's design, architecture, and implementation philosophy prioritizes software
32//! correctness and safety at the highest level, with the aim of supporting mission-critical trading
33//! system backtesting and live deployment workloads.
34//!
35//! # Feature flags
36//!
37//! This crate provides feature flags to control source code inclusion during compilation,
38//! depending on the intended use case, i.e. whether to provide Python bindings
39//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
40//! or as part of a Rust only build.
41//!
42//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
43//! - `extension-module`: Builds as a Python extension module (used with `python`).
44
45#![warn(rustc::all)]
46#![deny(unsafe_code)]
47#![deny(nonstandard_style)]
48#![deny(missing_debug_implementations)]
49#![deny(clippy::missing_errors_doc)]
50#![deny(clippy::missing_panics_doc)]
51#![deny(rustdoc::broken_intra_doc_links)]
52
53pub mod common;
54pub mod config;
55pub mod data;
56pub mod error;
57pub mod execution;
58pub mod grpc;
59pub mod http;
60// pub mod proto;
61pub mod schemas;
62pub mod types;
63pub mod websocket;
64
65#[cfg(feature = "python")]
66pub mod python;
67
68// Re-exports
69pub use crate::{
70 common::{
71 enums::{
72 DydxCandleResolution, DydxMarketStatus, DydxOrderSide, DydxOrderStatus, DydxOrderType,
73 DydxTickerType, DydxTimeInForce,
74 },
75 models::DydxAccount,
76 },
77 data::DydxDataClient,
78 error::DydxError,
79 http::{
80 client::DydxHttpClient,
81 error::DydxHttpError,
82 models::{MarketsResponse, PerpetualMarket},
83 },
84 types::DydxOraclePrice,
85 websocket::{
86 client::DydxWebSocketClient,
87 enums::{DydxWsChannel, DydxWsOperation},
88 error::DydxWsError,
89 },
90};