a
This commit is contained in:
parent
86b85c2609
commit
4c640f780b
|
|
@ -1200,8 +1200,10 @@ class PositionManager:
|
||||||
# 做多:当前价 <= 止损价,说明已触发止损
|
# 做多:当前价 <= 止损价,说明已触发止损
|
||||||
if current_price_val <= stop_loss_val:
|
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'
|
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(
|
||||||
logger.error(f" 入场价: {entry_price_str}")
|
f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!"
|
||||||
|
f" | 入场价: {entry_price_str}"
|
||||||
|
)
|
||||||
# 立即执行市价平仓
|
# 立即执行市价平仓
|
||||||
await self.close_position(symbol, reason='stop_loss')
|
await self.close_position(symbol, reason='stop_loss')
|
||||||
return
|
return
|
||||||
|
|
@ -1218,8 +1220,10 @@ class PositionManager:
|
||||||
# 做空:当前价 >= 止损价,说明已触发止损
|
# 做空:当前价 >= 止损价,说明已触发止损
|
||||||
if current_price_val >= stop_loss_val:
|
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'
|
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(
|
||||||
logger.error(f" 入场价: {entry_price_str}")
|
f"{symbol} ⚠️ 当前价格({current_price_val:.8f})已触发止损价({stop_loss_val:.8f}),无法挂止损单,立即执行市价平仓保护!"
|
||||||
|
f" | 入场价: {entry_price_str}"
|
||||||
|
)
|
||||||
# 立即执行市价平仓
|
# 立即执行市价平仓
|
||||||
await self.close_position(symbol, reason='stop_loss')
|
await self.close_position(symbol, reason='stop_loss')
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user