a
This commit is contained in:
parent
10fd7a7d60
commit
096b838769
|
|
@ -1199,8 +1199,9 @@ class PositionManager:
|
|||
if side == "BUY":
|
||||
# 做多:当前价 <= 止损价,说明已触发止损
|
||||
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_val:.8f if entry_price_val else 'N/A'}")
|
||||
logger.error(f" 入场价: {entry_price_str}")
|
||||
# 立即执行市价平仓
|
||||
await self.close_position(symbol, reason='stop_loss')
|
||||
return
|
||||
|
|
@ -1216,8 +1217,9 @@ class PositionManager:
|
|||
elif side == "SELL":
|
||||
# 做空:当前价 >= 止损价,说明已触发止损
|
||||
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_val:.8f if entry_price_val else 'N/A'}")
|
||||
logger.error(f" 入场价: {entry_price_str}")
|
||||
# 立即执行市价平仓
|
||||
await self.close_position(symbol, reason='stop_loss')
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user