有效关注独立发布风险监测资格

This commit is contained in:
baobao 2026-11-12 14:04:09 +08:00
parent 70221edb80
commit 71f8278904
3 changed files with 21 additions and 1 deletions

View File

@ -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():

View File

@ -0,0 +1,7 @@
# 人工关注高优先告警发布
2026年11月12日。承接[覆盖缺口巡检](人工关注信号覆盖缺口巡检_2026-11-12.md),用户批准修复并部署,要求人工关注与持仓同等高优先级。第三方股价异动保持原样,集中修复参与择时的现有信号。
PMS快照增加alert_items,仅包含有效沪深关注的身份及到期日。没有有效买方评析仍应有风险监测;原模型研究items资格不变。交易规则、页面和三组择时权重不改。对应ITD分钟worker发布60秒身份快照,告警每分钟同步关注及持仓,补齐既有算法所需基线,先计算并发布该高优先级组,再处理普通候选。移除或到期撤销关注身份;仍有持仓或原候选身份时继续监测。
本次计划仅更新155 worker以及188 ITD告警、分钟缓存两个服务。其他服务、原目录源码及私有环境保持,188真实PMS不操作。候选先断网全量,部署后逐股核对真实覆盖及消息接入。没有自然触发不制造事件,也不补发旧研究。实际发布结果在本记录追加。

View File

@ -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'})