Expand description
Parsing utilities for converting dYdX v4 Indexer API responses into Nautilus domain models.
This module contains functions that transform raw JSON data structures from the dYdX Indexer API into strongly-typed Nautilus data types such as instruments, trades, bars, account states, etc.
§Design Principles
- Validation First: All inputs are validated before parsing
- Contextual Errors: All errors include context about what was being parsed
- Zero-Copy When Possible: Uses references and borrows to minimize allocations
- Type Safety: Leverages Rust’s type system to prevent invalid states
§Error Handling
All parsing functions return anyhow::Result<T> with descriptive error messages
that include context about the field being parsed and the value that failed.
This makes debugging API changes or data issues much easier.
Functions§
- calculate_
time_ in_ force - Calculate time-in-force for conditional orders.
- parse_
account_ state - Parse a dYdX subaccount info into a Nautilus AccountState.
- parse_
fill_ report - Parse a dYdX Fill into a Nautilus FillReport.
- parse_
instrument_ any - Parses a dYdX perpetual market into a Nautilus
InstrumentAny. - parse_
order_ status_ report - Parse a dYdX Order into a Nautilus OrderStatusReport.
- parse_
position_ status_ report - Parse a dYdX PerpetualPosition into a Nautilus PositionStatusReport.
- parse_
ticker_ currencies - Parses base and quote currency codes from a ticker.
- validate_
conditional_ order - Validate conditional order parameters.
- validate_
market_ active - Validates that a market is active and tradable.
- validate_
ticker_ format - Validates that a ticker has the correct format (BASE-QUOTE).