diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 06fcb8a9a..f2b076532 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1358,10 +1358,10 @@ class FreqtradeBot(LoggingMixin): return True order = self.handle_order_fee(trade, order) - order_obj = trade.select_order_by_order_id(order['id']) + order_obj = trade.select_order_by_order_id(order_id) if not order_obj: # TODO: this can't happen! - raise OperationalException(f"order-obj for {order['id']} not found!") + raise OperationalException(f"order-obj for {order_id} not found!") trade.update_trade(order_obj) # TODO: is the below necessary? it's already done in update_trade for filled buys trade.recalc_trade_from_orders() diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 79f297bff..3effce2f5 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -1786,7 +1786,7 @@ def test_update_trade_state_sell(default_conf_usdt, trades_for_order, limit_sell fee_open=0.0025, fee_close=0.0025, open_date=arrow.utcnow().datetime, - open_order_id="123456", + open_order_id=limit_sell_order_usdt_open['id'], is_open=True, ) order = Order.parse_from_ccxt_object(limit_sell_order_usdt_open, 'LTC/ETH', 'sell') @@ -2016,7 +2016,7 @@ def test_bot_loop_start_called_once(mocker, default_conf_usdt, caplog): def test_check_handle_timedout_buy_usercustom(default_conf_usdt, ticker_usdt, limit_buy_order_old, open_trade, fee, mocker) -> None: default_conf_usdt["unfilledtimeout"] = {"buy": 1400, "sell": 30} - + limit_buy_order_old['id'] = open_trade.open_order_id rpc_mock = patch_RPCManager(mocker) cancel_order_mock = MagicMock(return_value=limit_buy_order_old) cancel_buy_order = deepcopy(limit_buy_order_old)