Skip to main content

get_balance

Input

  exchange: string;
currency: string;

回傳

  balance: Balance;

查看 Balance

範例

取得 base, quote balance,並印出可用、所有資產

exchange, pair, base, quote = CA.get_exchange_pair()
base_balance = CA.get_balance(exchange, base)
quote_balance = CA.get_balance(exchange, quote)
available_base_amount = base_balance.available
available_quote_amount = quote_balance.available
total_base_amount = base_balance.total
total_quote_amount = quote_balance.total

CA.log('available ' + str(base) + ' amount: ' + str(available_base_amount))
CA.log('available ' + str(quote) + ' amount: ' + str(available_quote_amount))
CA.log('total ' + str(base) + ' amount: ' + str(total_base_amount))
CA.log('total ' + str(quote) + ' amount: ' + str(total_quote_amount))