feat: price_monitor交易时段双市场——改用is_trading_now(A股9:30-15:00/港股9:30-16:00),港股持仓15:00-16:00最后一小时破止损止盈监控不再漏(A股收盘后价格不变不误报,集合竞价保护保留)

This commit is contained in:
hmo
2026-08-14 19:18:56 +08:00
parent 1f6f461bab
commit 7e37fec704
+5 -5
View File
@@ -704,12 +704,12 @@ def run_once(round_label=""):
outputs.append(f"📋 进区事件{len(_zone_entries)}只(仅记日志不推送): {'; '.join(_zone_entries[:5])}")
# === 第三步:买入区偏离检测 + 自动重评 ===
# 2026-08-11 修复:告警/重评只在 A股连续竞价时段执行。
# 9:15-9:25 集合竞价,API 返回虚拟撮合价(非真实成交)——9:17 曾误报
# 688002 暴跌-20%(竞价期 API 误返回 52周低 135.2),造成假告警
# 连续竞价 = 9:30-11:30 + 13:00-15:00;非此时段(竞价/午休/盘后)跳过告警+重评。
# 2026-08-11 修复:告警/重评只在连续竞价时段执行(避开集合竞价虚拟撮合价误报)
# 2026-08-14 港股接入:时段判断按市场——A股 9:30-11:30/13:00-15:00,港股 9:30-12:00/13:00-16:00。
# 港股16:00收盘,15:00-16:00 仍需监控持仓(A股已收盘价格不变,不会误报)
from market_config import is_trading_now
_now_hm = datetime.now().strftime("%H:%M")
_trading = (_now_hm >= "09:30" and _now_hm <= "11:30") or (_now_hm >= "13:00" and _now_hm <= "15:00")
_trading = is_trading_now('a') or is_trading_now('hk')
if not _trading:
print(f"[时段] {_now_hm} 非连续竞价时段(集合竞价/午休/盘后),跳过告警与重评(价格已刷新)", flush=True)
# 仍提交状态(防止告警标记滞留)