mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-14 11:51:19 +00:00
chore: Improve fetch_dry_run_order
This commit is contained in:
@@ -1303,7 +1303,7 @@ class Exchange:
|
|||||||
|
|
||||||
return order
|
return order
|
||||||
|
|
||||||
def fetch_dry_run_order(self, order_id) -> CcxtOrder:
|
def fetch_dry_run_order(self, order_id: str) -> CcxtOrder:
|
||||||
"""
|
"""
|
||||||
Return dry-run order
|
Return dry-run order
|
||||||
Only call if running in dry-run mode.
|
Only call if running in dry-run mode.
|
||||||
@@ -1315,11 +1315,12 @@ class Exchange:
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
from freqtrade.persistence import Order
|
from freqtrade.persistence import Order
|
||||||
|
|
||||||
order = Order.order_by_id(order_id)
|
order_obj = Order.order_by_id(order_id)
|
||||||
if order:
|
if order_obj:
|
||||||
ccxt_order = order.to_ccxt_object(self._ft_has["stop_price_prop"])
|
order = order_obj.to_ccxt_object(self._ft_has["stop_price_prop"])
|
||||||
self._dry_run_open_orders[order_id] = ccxt_order
|
order = self.check_dry_limit_order_filled(order)
|
||||||
return ccxt_order
|
self._dry_run_open_orders[order_id] = order
|
||||||
|
return order
|
||||||
# Gracefully handle errors with dry-run orders.
|
# Gracefully handle errors with dry-run orders.
|
||||||
raise InvalidOrderException(
|
raise InvalidOrderException(
|
||||||
f"Tried to get an invalid dry-run-order (id: {order_id}). Message: {e}"
|
f"Tried to get an invalid dry-run-order (id: {order_id}). Message: {e}"
|
||||||
|
|||||||
Reference in New Issue
Block a user