Remove filled if amount is modified to suit fee structure

This commit is contained in:
Matthias 2020-03-24 20:05:25 +01:00
parent 1e2fadbc02
commit 3c1b155e9f

View File

@ -1122,6 +1122,7 @@ class FreqtradeBot:
"""
Checks trades with open orders and updates the amount if necessary
Handles closing both buy and sell orders.
:return: True if order has been cancelled without being filled partially, False otherwise
"""
# Get order details for actual price per unit
if trade.open_order_id:
@ -1131,12 +1132,13 @@ class FreqtradeBot:
order = action_order or self.exchange.get_order(trade.open_order_id, trade.pair)
except InvalidOrderException as exception:
logger.warning('Unable to fetch order %s: %s', trade.open_order_id, exception)
return
return False
# Try update amount (binance-fix)
try:
new_amount = self.get_real_amount(trade, order, order_amount)
if not isclose(order['amount'], new_amount, abs_tol=constants.MATH_CLOSE_PREC):
order['amount'] = new_amount
del order['filled']
# Fee was applied, so set to 0
trade.fee_open = 0
trade.recalc_open_trade_price()