pub fn parse_derive_subaccount_to_balances(
subaccount: &DeriveSubaccount,
) -> Result<(Vec<AccountBalance>, Vec<MarginBalance>, Params)>Expand description
Derives [AccountBalance], [MarginBalance], and supplemental info rows
from a DeriveSubaccount snapshot.
Each collateral row becomes one [AccountBalance] in the collateral’s own
units with total = amount and locked = 0: the venue holds margin at the
subaccount level and reports no per-collateral reservation, while
collaterals[].initial_margin is USD credit contributed, not locked funds.
Portfolio requirements collapse into a single account-wide [MarginBalance]
in the subaccount currency: initial = positions_initial_margin + open_orders_margin and maintenance = positions_maintenance_margin. The
subaccount’s initial_margin/maintenance_margin are signed net health
values, not requirements, so they travel in the returned [Params] as
net_initial_margin/net_maintenance_margin alongside the requirement
split and the liquidation flag.
§Errors
Returns an error when a decimal field cannot be represented at the
currency precision used by [Money].