From 9f4f65e45714a5368a6c77530bac904c6b09a9a5 Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 16 Feb 2022 07:26:23 -0600 Subject: [PATCH] exchange.get_balances minor fix --- freqtrade/exchange/exchange.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 4f1202211..6b8a9bd0f 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1175,19 +1175,26 @@ class Exchange: if size > 0: 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: order_amount = 0 if side == 'long' or side == 'buy': currency = market['base'] + free = size - order_amount - if currency in balances: - balances[currency] = { - 'free': size - order_amount, - 'used': order_amount, - 'total': size, - } + balances[currency] = { + 'free': free, + 'used': order_amount, + 'total': size, + } + balances['free'][currency] = free + balances['used'][currency] = order_amount + balances['total'][currency] = size return balances except ccxt.DDoSProtection as e: