Unified account balance across currencies.
Balances are stored as maps of currency => amount for each category
(free, used, total).
Fields
free- Available balance per currencyused- Balance locked in orders per currencytotal- Total balance per currency (free + used)timestamp- Exchange timestamp in millisecondsdatetime- ISO 8601 datetime stringinfo- Raw exchange response
Examples
balance = %CCXT.Balance{
free: %{"BTC" => 1.5, "USDT" => 10000.0},
used: %{"BTC" => 0.5},
total: %{"BTC" => 2.0, "USDT" => 10000.0}
}
CCXT.Balance.get(balance, "BTC")
#=> %{free: 1.5, used: 0.5, total: 2.0}
Summary
Functions
Returns a sorted list of all currencies in the balance.
Returns the balance for a specific currency.
JSON Schema for the Balance unified type.
Types
Functions
Returns a sorted list of all currencies in the balance.
Examples
CCXT.Balance.currencies(balance)
#=> ["BTC", "ETH", "USDT"]
Returns the balance for a specific currency.
Returns a map with :free, :used, and :total keys, defaulting
missing values to 0.0. Returns nil if the currency has no entries.
Examples
CCXT.Balance.get(balance, "BTC")
#=> %{free: 1.5, used: 0.5, total: 2.0}
CCXT.Balance.get(balance, "UNKNOWN")
#=> nil
@spec schema() :: map()
JSON Schema for the Balance unified type.