diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e43f2a158..99872ff0b 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1358,6 +1358,9 @@ class FreqtradeBot(LoggingMixin): return True order_obj = trade.select_order_by_order_id(order_id) + if not order_obj: + raise DependencyException( + f"Order_obj not found for {order_id}. This should not have happened.") self.handle_order_fee(trade, order_obj, order) trade.update_trade(order_obj) diff --git a/freqtrade/persistence/migrations.py b/freqtrade/persistence/migrations.py index 288345e18..e4ff4bc37 100644 --- a/freqtrade/persistence/migrations.py +++ b/freqtrade/persistence/migrations.py @@ -209,9 +209,6 @@ def check_migrate(engine, decl_base, previous_tables) -> None: f"backup: {table_back_name}, {order_table_bak_name}") migrate_trades_and_orders_table( decl_base, inspector, engine, table_back_name, cols, order_table_bak_name, cols_orders) - # Reread columns - the above recreated the table! - inspector = inspect(engine) - cols = inspector.get_columns('trades') if 'orders' not in previous_tables and 'trades' in previous_tables: logger.info('Moving open orders to Orders table.') diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index 49ce34158..d12a345e0 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -160,7 +160,7 @@ class Order(_DECL_BASE): return (f'Order(id={self.id}, order_id={self.order_id}, trade_id={self.ft_trade_id}, ' f'side={self.side}, order_type={self.order_type}, status={self.status})') - def update_from_ccxt_object(self, order) -> 'Order': + def update_from_ccxt_object(self, order): """ Update Order from ccxt response Only updates if fields are available from ccxt -