This commit is contained in:
薇薇安 2026-01-25 12:51:14 +08:00
parent 86b85c2609
commit 4c640f780b

View File

@ -1200,8 +1200,10 @@ class PositionManager:
# 做多:当前价 <= 止损价,说明已触发止损
if current_price_val <= stop_loss_val:
entry_price_str = f"{entry_price_val:.8f}" if entry_price_val is not None else 'N/A'
logger.error(f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!")
logger.error(f" 入场价: {entry_price_str}")
logger.error(
f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!"
f" | 入场价: {entry_price_str}"
)
# 立即执行市价平仓
await self.close_position(symbol, reason='stop_loss')
return
@ -1218,8 +1220,10 @@ class PositionManager:
# 做空:当前价 >= 止损价,说明已触发止损
if current_price_val >= stop_loss_val:
entry_price_str = f"{entry_price_val:.8f}" if entry_price_val is not None else 'N/A'
logger.error(f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!")
logger.error(f" 入场价: {entry_price_str}")
logger.error(
f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!"
f" | 入场价: {entry_price_str}"
)
# 立即执行市价平仓
await self.close_position(symbol, reason='stop_loss')
return