mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
@@ -688,6 +688,7 @@ CANCEL_REASON = {
|
||||
"CANCELLED_ON_EXCHANGE": "cancelled on exchange",
|
||||
"FORCE_EXIT": "forcesold",
|
||||
"REPLACE": "cancelled to be replaced by new limit order",
|
||||
"REPLACE_FAILED": "failed to replace order, deleting Trade",
|
||||
"USER_CANCEL": "user requested order cancel"
|
||||
}
|
||||
|
||||
|
||||
@@ -1420,6 +1420,13 @@ class FreqtradeBot(LoggingMixin):
|
||||
order_adjust=True,
|
||||
):
|
||||
logger.warning(f"Could not replace order for {trade}.")
|
||||
if trade.nr_of_successful_entries == 0:
|
||||
# this is the first entry and we didn't get filled yet, delete trade
|
||||
logger.warning(f"Removing {trade} from database.")
|
||||
self._notify_enter_cancel(
|
||||
trade, order_type=self.strategy.order_types['entry'],
|
||||
reason=constants.CANCEL_REASON['REPLACE_FAILED'])
|
||||
trade.delete()
|
||||
|
||||
def cancel_all_open_orders(self) -> None:
|
||||
"""
|
||||
|
||||
@@ -563,7 +563,7 @@ def test_dca_order_adjust_entry_replace_fails(
|
||||
|
||||
assert log_has_re(msg, caplog)
|
||||
assert entry_mock.call_count == 2
|
||||
assert len(Trade.get_trades().all()) == 2
|
||||
assert len(Trade.get_trades().all()) == 1
|
||||
assert len(Order.get_open_orders()) == 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user