From 7718e8e1e940f51cac81f998010d2adef706ad7c Mon Sep 17 00:00:00 2001 From: matstedt Date: Wed, 14 Jan 2026 20:10:36 +0100 Subject: [PATCH] krakenfutures: fix fetch_order to raise exception instead of returning pseudo order --- freqtrade/exchange/krakenfutures.py | 30 ++--------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/freqtrade/exchange/krakenfutures.py b/freqtrade/exchange/krakenfutures.py index 63e421673..530e521ff 100644 --- a/freqtrade/exchange/krakenfutures.py +++ b/freqtrade/exchange/krakenfutures.py @@ -10,7 +10,7 @@ from ccxt.base.errors import NotSupported, OrderNotFound from freqtrade.constants import BuySell from freqtrade.enums import MarginMode, PriceType, TradingMode -from freqtrade.exceptions import OperationalException +from freqtrade.exceptions import InvalidOrderException, OperationalException from freqtrade.exchange.common import retrier from freqtrade.exchange.exchange import Exchange from freqtrade.exchange.exchange_types import FtHas @@ -188,33 +188,7 @@ class Krakenfutures(Exchange): if order is not None: return self._normalize_fetched_order(order) - # Do not crash the bot during startup if the exchange cannot find the order. - now_ms = int(getattr(self._api, "milliseconds", lambda: int(time.time() * 1000))()) - try: - iso = self._api.iso8601(now_ms) - except Exception: - iso = None - - logger.warning( - "Order not found on exchange, returning pseudo order to avoid crash. id=%s pair=%s", - order_id, - pair, - ) - - return { - "id": order_id, - "symbol": pair, - "status": "open", - "side": None, - "type": None, - "price": 0.0, - "amount": 0.0, - "filled": 0.0, - "remaining": 0.0, - "timestamp": now_ms, - "datetime": iso, - "info": {"_ft_note": "Order not found via API, pseudo order returned"}, - } + raise InvalidOrderException(f"Order {order_id} not found on exchange for pair {pair}.") def get_funding_fees(self, pair: str, amount: float, is_short: bool, open_date): try: