exchange.get_balances minor fix

This commit is contained in:
Sam Germain 2022-02-16 07:26:23 -06:00 committed by Matthias
parent f336e7fc5b
commit 9f4f65e457

View File

@ -1175,19 +1175,26 @@ class Exchange:
if size > 0: if size > 0:
if symbol in open_orders: if symbol in open_orders:
order_amount: float = open_orders[symbol]['remaining'] order = open_orders[symbol]
order_amount: float = order['remaining']
order_side: str = order['side']
if order_side == 'buy' or order_side == 'long':
order_amount = 0
else: else:
order_amount = 0 order_amount = 0
if side == 'long' or side == 'buy': if side == 'long' or side == 'buy':
currency = market['base'] currency = market['base']
free = size - order_amount
if currency in balances: balances[currency] = {
balances[currency] = { 'free': free,
'free': size - order_amount, 'used': order_amount,
'used': order_amount, 'total': size,
'total': size, }
} balances['free'][currency] = free
balances['used'][currency] = order_amount
balances['total'][currency] = size
return balances return balances
except ccxt.DDoSProtection as e: except ccxt.DDoSProtection as e: