Skip to main content

account_balance_from_lighter_asset

Function account_balance_from_lighter_asset 

Source
pub fn account_balance_from_lighter_asset(
    asset: &LighterAsset,
) -> Result<AccountBalance>
Expand description

Builds the per-asset [AccountBalance] before applying user_stats.available_balance.

The total is balance + margin_balance, and locked_balance reserves resting spot orders. The account-state reconciler then caps settlement-currency free funds at max(user_stats.available_balance, 0). [MarginBalance] reports account-wide margin separately.

ยงErrors

Returns an error if AccountBalance::from_total_and_locked rejects the computed values.