Skip to main content

parse_account_state

Function parse_account_state 

Source
pub fn parse_account_state(
    accounts: &[Account],
    account_id: AccountId,
    is_reported: bool,
    ts_event: UnixNanos,
    ts_init: UnixNanos,
) -> Result<AccountState>
Expand description

Parses a list of Coinbase Account entries into a Nautilus [AccountState].

Builds one [AccountBalance] per currency where total = available_balance + hold, free = available_balance, and locked = hold. Accounts with invalid balances are skipped with a debug log. Always emits at least one balance so the resulting [AccountState] is valid.

ยงErrors

Returns an error when building a balance fails after all accounts have been exhausted (i.e. every entry was malformed).