Module client

Module client 

Source
Expand description

Provides an ergonomic wrapper around the dYdX v4 Indexer REST APIhttps://docs.dydx.exchange/api_integration-indexer/indexer_api.

This module exports two complementary HTTP clients following the standardized two-layer architecture pattern established in OKX, Bybit, and BitMEX adapters:

  • DydxRawHttpClient: Low-level HTTP methods matching dYdX Indexer API endpoints.
  • DydxHttpClient: High-level methods using Nautilus domain types with instrument caching.

§Two-Layer Architecture

The raw client handles HTTP communication, rate limiting, retries, and basic response parsing. The domain client wraps the raw client in an Arc, maintains an instrument cache using DashMap, and provides high-level methods that work with Nautilus domain types.

§Key Responsibilities

  • Rate-limiting based on the public dYdX specification.
  • Zero-copy deserialization of large JSON payloads into domain models.
  • Conversion of raw exchange errors into the rich DydxHttpError enum.
  • Instrument caching with standard methods: cache_instruments(), cache_instrument(), get_instrument().

§Important Note

The dYdX v4 Indexer REST API does NOT require authentication or request signing. All endpoints are publicly accessible using only wallet addresses and subaccount numbers as query parameters. Order submission and trading operations use gRPC with blockchain transaction signing, not REST API.

§Official documentation

Structs§

DydxHttpClient
Provides a higher-level HTTP client for the dYdX v4 Indexer REST API.
DydxRawHttpClient
Provides a raw HTTP client for interacting with the dYdX v4 Indexer REST API.
DydxResponse
Represents a dYdX HTTP response wrapper.

Statics§

DYDX_REST_QUOTA
Default dYdX Indexer REST API rate limit.