Use correct order id

This commit is contained in:
Matthias 2022-02-11 07:43:45 +01:00
parent 874c161f78
commit e9f451406c
2 changed files with 4 additions and 4 deletions

View File

@ -1358,10 +1358,10 @@ class FreqtradeBot(LoggingMixin):
return True return True
order = self.handle_order_fee(trade, order) 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: if not order_obj:
# TODO: this can't happen! # 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) trade.update_trade(order_obj)
# TODO: is the below necessary? it's already done in update_trade for filled buys # TODO: is the below necessary? it's already done in update_trade for filled buys
trade.recalc_trade_from_orders() trade.recalc_trade_from_orders()

View File

@ -1786,7 +1786,7 @@ def test_update_trade_state_sell(default_conf_usdt, trades_for_order, limit_sell
fee_open=0.0025, fee_open=0.0025,
fee_close=0.0025, fee_close=0.0025,
open_date=arrow.utcnow().datetime, open_date=arrow.utcnow().datetime,
open_order_id="123456", open_order_id=limit_sell_order_usdt_open['id'],
is_open=True, is_open=True,
) )
order = Order.parse_from_ccxt_object(limit_sell_order_usdt_open, 'LTC/ETH', 'sell') 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, def test_check_handle_timedout_buy_usercustom(default_conf_usdt, ticker_usdt, limit_buy_order_old,
open_trade, fee, mocker) -> None: open_trade, fee, mocker) -> None:
default_conf_usdt["unfilledtimeout"] = {"buy": 1400, "sell": 30} default_conf_usdt["unfilledtimeout"] = {"buy": 1400, "sell": 30}
limit_buy_order_old['id'] = open_trade.open_order_id
rpc_mock = patch_RPCManager(mocker) rpc_mock = patch_RPCManager(mocker)
cancel_order_mock = MagicMock(return_value=limit_buy_order_old) cancel_order_mock = MagicMock(return_value=limit_buy_order_old)
cancel_buy_order = deepcopy(limit_buy_order_old) cancel_buy_order = deepcopy(limit_buy_order_old)