Skip to main content

parse_account_state_from_http

Function parse_account_state_from_http 

Source
pub fn parse_account_state_from_http(
    subaccount: &Subaccount,
    account_id: AccountId,
    instruments: &HashMap<InstrumentId, InstrumentAny>,
    oracle_prices: &HashMap<InstrumentId, Decimal>,
    ts_event: UnixNanos,
    ts_init: UnixNanos,
) -> Result<AccountState>
Expand description

Parse a dYdX HTTP Subaccount response into a Nautilus [AccountState].

This is the HTTP variant of parse_account_state which takes the WebSocket DydxSubaccountInfo type (String fields). The HTTP Subaccount type uses Decimal fields directly (parsed via serde_as), so no string-to-decimal conversion is needed.

ยงErrors

Returns an error if balance or margin calculation fails.