From 71f82789049debb721f84bc301e126c10e5eab13 Mon Sep 17 00:00:00 2001 From: baobao Date: Thu, 12 Nov 2026 14:04:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E6=95=88=E5=85=B3=E6=B3=A8=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E5=8F=91=E5=B8=83=E9=A3=8E=E9=99=A9=E7=9B=91=E6=B5=8B?= =?UTF-8?q?=E8=B5=84=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/monitor_watch.py | 6 +++++- docs/人工关注高优先告警发布_2026-11-12.md | 7 +++++++ scripts/test_monitor_watch_units.py | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 docs/人工关注高优先告警发布_2026-11-12.md diff --git a/app/services/monitor_watch.py b/app/services/monitor_watch.py index cabc298..a1b68c0 100644 --- a/app/services/monitor_watch.py +++ b/app/services/monitor_watch.py @@ -75,6 +75,10 @@ def build_snapshot(registry, *, now=None, ttl=600): if type(revision) is not int or revision < 0: raise ValueError("人工关注登记版本缺失") items = [] + # 风险监测与买方评析资格分开。有效关注即参加告警;研究仍等有效评析。 + alert_items = [{"ts_code": code_of(row), "watch_id": row.get("id"), + "active": True, "expires_on": row["expires_on"]} + for row in registry["rows"] if isinstance(row, dict) and active(row, now)] for row in registry["rows"]: if not isinstance(row, dict) or not active(row, now) or row.get("review_status") != "completed": continue @@ -99,7 +103,7 @@ def build_snapshot(registry, *, now=None, ttl=600): "review_summary": str(row.get("company_review_text") or review.get("overall") or "")[:2000]}) return {"schema_version": 1, "source_scope": SCOPE, "source_revision": revision, "generated_at": now.isoformat(), "expires_at": (now + timedelta(seconds=ttl)).isoformat(), - "items": items} + "items": items, "alert_items": alert_items} def sync(): diff --git a/docs/人工关注高优先告警发布_2026-11-12.md b/docs/人工关注高优先告警发布_2026-11-12.md new file mode 100644 index 0000000..c751407 --- /dev/null +++ b/docs/人工关注高优先告警发布_2026-11-12.md @@ -0,0 +1,7 @@ +# 人工关注高优先告警发布 + +2026年11月12日。承接[覆盖缺口巡检](人工关注信号覆盖缺口巡检_2026-11-12.md),用户批准修复并部署,要求人工关注与持仓同等高优先级。第三方股价异动保持原样,集中修复参与择时的现有信号。 + +PMS快照增加alert_items,仅包含有效沪深关注的身份及到期日。没有有效买方评析仍应有风险监测;原模型研究items资格不变。交易规则、页面和三组择时权重不改。对应ITD分钟worker发布60秒身份快照,告警每分钟同步关注及持仓,补齐既有算法所需基线,先计算并发布该高优先级组,再处理普通候选。移除或到期撤销关注身份;仍有持仓或原候选身份时继续监测。 + +本次计划仅更新155 worker以及188 ITD告警、分钟缓存两个服务。其他服务、原目录源码及私有环境保持,188真实PMS不操作。候选先断网全量,部署后逐股核对真实覆盖及消息接入。没有自然触发不制造事件,也不补发旧研究。实际发布结果在本记录追加。 diff --git a/scripts/test_monitor_watch_units.py b/scripts/test_monitor_watch_units.py index 2e97317..14d56b6 100644 --- a/scripts/test_monitor_watch_units.py +++ b/scripts/test_monitor_watch_units.py @@ -75,6 +75,15 @@ class MonitorWatchTests(unittest.TestCase): r = row(); r.pop('review_status') self.assertEqual(mw.build_snapshot(registry([r]), now=NOW)['items'], []) + def test_alert_scope_includes_active_without_review_without_expanding_research(self): + result = mw.build_snapshot(registry([row(review_status='missing'), + row(code='SZ300182', id='c'*32, review_status='queued'), + row(code='SZ300364', status='removed'), row(code='BJ920001'), + row(code='SZ300291', expires_on='2026-11-03')]), now=NOW) + self.assertEqual(result['items'], []) + self.assertEqual([r['ts_code'] for r in result['alert_items']], ['300133.SZ','300182.SZ']) + self.assertNotIn('review_summary', result['alert_items'][0]) + def test_default_scope_disabled_makes_no_external_request(self): install_fakes(params={}) self.assertEqual(mw.sync(), {'ok': True, 'skipped': 'disabled'})