Skip to main content

parse_account_balances_and_margins

Function parse_account_balances_and_margins 

Source
pub fn parse_account_balances_and_margins(
    state: &ClearinghouseState,
) -> Result<(Vec<AccountBalance>, Vec<MarginBalance>)>
Expand description

Parses Hyperliquid clearinghouse state into Nautilus account balances and margins.

Uses the same field selection as the HTTP account-state path (cross_margin_summary.total_raw_usd for total, top-level state.withdrawable for free) so the execution adapter and the HTTP client emit consistent balances for the same clearinghouse snapshot.

ยงErrors

Returns an error if the data cannot be parsed.