Skip to main content

parse_derive_subaccount_to_balances

Function parse_derive_subaccount_to_balances 

Source
pub fn parse_derive_subaccount_to_balances(
    subaccount: &DeriveSubaccount,
) -> Result<(Vec<AccountBalance>, Vec<MarginBalance>)>
Expand description

Derives [AccountBalance] and [MarginBalance] rows from a DeriveSubaccount snapshot.

Each collateral row becomes one [AccountBalance]; the subaccount’s initial/maintenance margin requirements collapse into a single [MarginBalance] without an instrument scoping.

§Errors

Returns an error when a decimal field cannot be represented at the currency precision used by [Money].