Skip to main content

parse_account_state

Function parse_account_state 

Source
pub fn parse_account_state(
    response: &AxBalancesResponse,
    risk: Option<&AxRiskSnapshot>,
    account_id: AccountId,
    ts_event: UnixNanos,
    ts_init: UnixNanos,
) -> Result<AccountState>
Expand description

Parses an Ax balances response into a Nautilus [AccountState].

Ax provides a simple balance structure with symbol and amount. When a AxRiskSnapshot is supplied, its USD margin requirements populate the USD balance’s locked funds and the account’s margin balances; without one, locked stays zero for every currency.

§Errors

Returns an error if balance amount parsing fails.