a
This commit is contained in:
parent
762e9c4b38
commit
d9270ad6b4
|
|
@ -2878,6 +2878,19 @@ class PositionManager:
|
||||||
should_close = True
|
should_close = True
|
||||||
exit_reason = 'take_profit'
|
exit_reason = 'take_profit'
|
||||||
|
|
||||||
|
# 计算持仓时间(用于日志)
|
||||||
|
entry_time = position_info.get('entryTime')
|
||||||
|
hold_time_minutes = 0
|
||||||
|
if entry_time:
|
||||||
|
try:
|
||||||
|
if isinstance(entry_time, datetime):
|
||||||
|
hold_time_sec = int((get_beijing_time() - entry_time).total_seconds())
|
||||||
|
else:
|
||||||
|
hold_time_sec = int(time.time() - (float(entry_time) if isinstance(entry_time, (int, float)) else 0))
|
||||||
|
hold_time_minutes = hold_time_sec / 60.0
|
||||||
|
except Exception:
|
||||||
|
hold_time_minutes = 0
|
||||||
|
|
||||||
# 详细诊断日志:记录平仓时的所有关键信息
|
# 详细诊断日志:记录平仓时的所有关键信息
|
||||||
logger.info("=" * 80)
|
logger.info("=" * 80)
|
||||||
logger.info(f"{symbol} [实时监控-平仓诊断日志] ===== 触发止盈平仓 =====")
|
logger.info(f"{symbol} [实时监控-平仓诊断日志] ===== 触发止盈平仓 =====")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user