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 & 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.exchange/api_integration-indexer/indexer_api> |
27//! | Indexer WebSocket API | <https://docs.dydx.trade/developers/indexer/websockets> |
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.exchange/api_integration-clients/validator_client> |
31//!
32//! # Platform
33//!
34//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
35//! algorithmic trading platform, providing quantitative traders with the ability to backtest
36//! portfolios of automated trading strategies on historical data with an event-driven engine,
37//! and also deploy those same strategies live, with no code changes.
38//!
39//! NautilusTrader's design, architecture, and implementation philosophy prioritizes software
40//! correctness and safety at the highest level, with the aim of supporting mission-critical trading
41//! system backtesting and live deployment workloads.
42//!
43//! # Feature flags
44//!
45//! This crate provides feature flags to control source code inclusion during compilation,
46//! depending on the intended use case, i.e. whether to provide Python bindings
47//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
48//! or as part of a Rust only build.
49//!
50//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
51//! - `extension-module`: Builds as a Python extension module (used with `python`).
52
53#![warn(rustc::all)]
54#![deny(unsafe_code)]
55#![deny(nonstandard_style)]
56#![deny(missing_debug_implementations)]
57#![deny(clippy::missing_errors_doc)]
58#![deny(clippy::missing_panics_doc)]
59#![deny(rustdoc::broken_intra_doc_links)]
60
61pub mod common;
62pub mod config;
63pub mod data;
64pub mod error;
65pub mod execution;
66pub mod grpc;
67pub mod http;
68pub mod proto;
69pub mod types;
70pub mod websocket;
71
72#[cfg(feature = "python")]
73pub mod python;
74
75// Re-exports
76pub use crate::{
77 common::{
78 enums::{
79 DydxCandleResolution, DydxMarketStatus, DydxOrderSide, DydxOrderStatus, DydxOrderType,
80 DydxTickerType, DydxTimeInForce,
81 },
82 models::DydxAccount,
83 },
84 data::DydxDataClient,
85 error::DydxError,
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};