nautilus_dydx/http/
query.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//! Query parameter builders for dYdX v4 Indexer REST API endpoints.
17
18use derive_builder::Builder;
19use serde::Serialize;
20
21use crate::common::enums::DydxCandleResolution;
22
23/// Query parameters for fetching orderbook.
24#[derive(Debug, Clone, Default, Serialize, Builder)]
25#[builder(setter(into, strip_option), default)]
26pub struct GetOrderbookParams {
27    pub ticker: String,
28}
29
30/// Query parameters for fetching trades.
31#[derive(Debug, Clone, Default, Serialize, Builder)]
32#[builder(setter(into, strip_option), default)]
33pub struct GetTradesParams {
34    pub ticker: String,
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub limit: Option<u32>,
37}
38
39/// Query parameters for fetching candles.
40#[derive(Debug, Clone, Default, Serialize, Builder)]
41#[builder(setter(into, strip_option), default)]
42pub struct GetCandlesParams {
43    pub ticker: String,
44    pub resolution: DydxCandleResolution,
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub limit: Option<u32>,
47}
48
49/// Query parameters for fetching subaccount.
50#[derive(Debug, Clone, Default, Serialize, Builder)]
51#[builder(setter(into, strip_option), default)]
52pub struct GetSubaccountParams {
53    pub address: String,
54    #[serde(rename = "subaccountNumber")]
55    pub subaccount_number: u32,
56}