feat: record dry-run stop_price price separately

This commit is contained in:
Matthias
2025-11-18 20:29:39 +01:00
parent 1770a68457
commit cd7b267171

View File

@@ -1119,6 +1119,7 @@ class Exchange:
leverage: float, leverage: float,
params: dict | None = None, params: dict | None = None,
stop_loss: bool = False, stop_loss: bool = False,
stop_price: float | None = None,
) -> CcxtOrder: ) -> CcxtOrder:
now = dt_now() now = dt_now()
order_id = f"dry_run_{side}_{pair}_{now.timestamp()}" order_id = f"dry_run_{side}_{pair}_{now.timestamp()}"
@@ -1145,7 +1146,7 @@ class Exchange:
} }
if stop_loss: if stop_loss:
dry_order["info"] = {"stopPrice": dry_order["price"]} dry_order["info"] = {"stopPrice": dry_order["price"]}
dry_order[self._ft_has["stop_price_prop"]] = dry_order["price"] dry_order[self._ft_has["stop_price_prop"]] = stop_price or dry_order["price"]
# Workaround to avoid filling stoploss orders immediately # Workaround to avoid filling stoploss orders immediately
dry_order["ft_order_type"] = "stoploss" dry_order["ft_order_type"] = "stoploss"
orderbook: OrderBook | None = None orderbook: OrderBook | None = None
@@ -1517,8 +1518,9 @@ class Exchange:
ordertype, ordertype,
side, side,
amount, amount,
stop_price_norm, limit_rate or stop_price_norm,
stop_loss=True, stop_loss=True,
stop_price=stop_price_norm,
leverage=leverage, leverage=leverage,
) )
return dry_order return dry_order