diff --git a/DEVLOG.md b/DEVLOG.md index f8a15df..8e77893 100644 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -3120,3 +3120,8 @@ a44c994于10:53:29仅发布155的web,镜像pms:proposal-copy-a44c994。开发 移除宽基信号行的前置范围标签,保留原“宽基观测”来源、内容、级别和详情范围;普通股票标签不变。三道页面护栏及桌面、窄屏隔离浏览器通过。发布范围仅155 web,结果见[接续](docs/宽基查询接口与分时展示接续_2026-11-13.md)。 12:52:36已仅发布155 web `pms:etf-label-ad5b1a6`,候选86组断网全量及251源码核对通过,其他29容器、私有配置与挂载不变。12:53实际页面确认新标签逻辑,宽基自然304正常,数量现金差0,缺口、待入账、孤儿与在途0。展示及后续规则已更新,无新增观察任务。 + + +## 2026-11-13 宽基名称按指数类别统一 + +按用户确认方案,将177只宽基ETF统一显示为8类跟踪指数简称,保留逐条原信号和点击基金详情,去掉名称悬停。未知归属显示代码,不猜测分类。32项专项、三道页面护栏、177成员断网资料回放及桌面/窄屏验收通过。定向发布仅155 web,见[接续](docs/宽基查询接口与分时展示接续_2026-11-13.md)。 diff --git a/app/services/etf_observation.py b/app/services/etf_observation.py index 65fbe3d..4b8425b 100644 --- a/app/services/etf_observation.py +++ b/app/services/etf_observation.py @@ -203,33 +203,33 @@ def consume_once(snapshots=None, events=None, clock=now): return {'status': 'unavailable', 'error': type(exc).__name__, 'processed': processed} +INDEX_LABELS = { + '000016.SH': '上证50', '000300.SH': '沪深300', + '000905.SH': '中证500', '000852.SH': '中证1000', + '932000.CSI': '中证2000', '000510.SH': '中证A500', + '000688.SH': '科创50', '399006.SZ': '创业板指', +} + + def name_map(): - """只读ETF基础资料;缺名显示代码,不借用同代码股票名称。""" + """只读基金全名与跟踪指数;简称按指数代码确定,不从基金名称猜测。""" from app.db import session as db try: rows = db.fetch_all('SELECT ts_code,csname,index_code,index_name FROM gp_etf_basic WHERE ts_code LIKE :sh OR ts_code LIKE :sz', {'sh': '%.SH', 'sz': '%.SZ'}) result = {} for row in rows: code = str(row.get('ts_code') or '') - if subject_allowed('ETF', code): - result[code] = str(row.get('csname') or code) + if not subject_allowed('ETF', code): + continue index = str(row.get('index_code') or '') + result[code] = {'full_name': str(row.get('csname') or code), 'index_code': index} if subject_allowed('INDEX', index): - result[index] = str(row.get('index_name') or index) + result[index] = {'full_name': str(row.get('index_name') or index), 'index_code': index} return result except Exception: return {} -def short_name(name, code): - text = str(name or code) - for old, new in [('工银瑞信', '工银'), ('华泰柏瑞', '华泰'), ('上证科创板50成份增强策略', '科创50'), - ('上证科创板50成份', '科创50'), ('中证A500', 'A500'), ('中证2000', '2000'), ('交易型开放式指数证券投资基金', ''), - ('交易型开放式指数', ''), ('证券投资基金', ''), ('ETF', '')]: - text = text.replace(old, new) - return text if 0 < sum(1 if ord(c) < 128 else 2 for c in text) <= 10 else code.split('.')[0] - - def presentation(state, at, names=None): names = names or {} data = copy.deepcopy(state) @@ -241,9 +241,12 @@ def presentation(state, at, names=None): rows = [] for item in data.get('events', {}).values(): e = item['event'] - full = names.get(e['subject_id']) or ('宽基ETF' if e['subject_type'] == 'MARKET' else e['subject_id']) + profile = names.get(e['subject_id']) or {} + full = profile.get('full_name') or ('宽基ETF' if e['subject_type'] == 'MARKET' else e['subject_id']) + index = e['subject_id'] if e['subject_type'] == 'INDEX' else profile.get('index_code') + label = '宽基' if e['subject_type'] == 'MARKET' else INDEX_LABELS.get(index, e['subject_id'].split('.')[0]) stale = e['event_state'] not in contract.ACTIVE_STATES or at >= datetime.fromisoformat(e['valid_until']) - rows.append({**e, 'name': full if e['subject_type'] == 'INDEX' and len(full) <= 9 else short_name(full, e['subject_id']), 'full_name': full, + rows.append({**e, 'name': label, 'full_name': full, 'observation': item['observation'], 'member_count': item.get('member_count'), 'received_at': item['received_at'], 'stale': stale, 'display_state': 'EXPIRED' if stale and e['event_state'] in contract.ACTIVE_STATES else e['event_state']}) diff --git a/app/web/AGENTS.md b/app/web/AGENTS.md index 2da2152..5649309 100644 --- a/app/web/AGENTS.md +++ b/app/web/AGENTS.md @@ -10,6 +10,6 @@ - 后续页面修改沿用现有布局、字号、间距、配色、组件和交互习惯。新增信息优先融入原有区域,不另起一套视觉样式;整体改版以用户明确要求为准。 - 信号流按已确认原型保持完整单行,顺序为时间、持仓或关注标签、可点击股票名称、原信号系统名称、原信号短内容、原级别。保留“决策系统”“资金分布”等用户可理解的现有名称,不改为内部项目名。持仓标签优先,关注与持仓共用现有信号入口、排序、上限和分类,不另设关注区;无真实信号不占行。研究观察、每日完成、等待和超时均留在原个股详情,不生成信号行。不增加原始读数、长理由、行内折叠或展开按钮;原有效期和其他信号规则保持。 - 看多红、看空绿、中性灰、无读数虚框。指标的冷暖阈值柱图沿用现有蓝、金、灰,不把阈值高低强行解释成看多看空。 -- 宽基信号行不加“宽基”“15分”“日内”等前置标签,保留“宽基观测”来源、信号短内容和级别;观察范围留在悬停或详情中。普通股票的持仓、关注和计划标签保持原规则。 +- 宽基信号行不加“宽基”“15分”“日内”等前置标签,保留“宽基观测”来源、信号短内容和级别;观察范围留在悬停或详情中。宽基名称按跟踪指数显示固定类别简称,不显示基金公司,不从全名删词猜测;同类产品不合并信号,点击仍查看对应基金全名和代码,不增加名称悬停。普通股票的持仓、关注和计划标签保持原规则。 - 策略展示为“主观量化”和“微盘轮动”,持仓分别用标签页。数量和阈值来自当前规则,不能把30或50写死;策略详情新标签页打开,不替换当前管理页。 - 明确区分计划数量、实际委托、受理、成交与入账。没有出口委托不能显示“已下单”,请求失败或旧行情不能显示成正常完成。 diff --git a/app/web/static/index.html b/app/web/static/index.html index 5f581e0..cc0e361 100644 --- a/app/web/static/index.html +++ b/app/web/static/index.html @@ -887,7 +887,7 @@ body.dock-r:not(.r-fold) .side-r .strip{display:none;}
{{ flowTime(g) }} {{ flowLabel(g) }} - + {{ g.cat }} {{ g.direction }} @@ -900,7 +900,7 @@ body.dock-r:not(.r-fold) .side-r .strip{display:none;}
{{ flowTime(g) }} {{ flowLabel(g) }} - + {{ g.cat }} {{ g.direction }} @@ -917,7 +917,7 @@ body.dock-r:not(.r-fold) .side-r .strip{display:none;}
{{ flowTime(g) }} {{ flowLabel(g) }} - + {{ g.cat }} {{ g.direction }} diff --git a/docs/evidence/etf_name_catalog_20261113.json b/docs/evidence/etf_name_catalog_20261113.json new file mode 100644 index 0000000..676ca0c --- /dev/null +++ b/docs/evidence/etf_name_catalog_20261113.json @@ -0,0 +1,1269 @@ +{ + "checked_at": "2026-11-13T13:04:48.752141", + "trade_date": "2026-11-13", + "source": "155模拟PMS当日宽基查询缓存成员与gp_etf_basic只读资料", + "status": "经用户确认的类别简称映射;13:04目录核对", + "total": 177, + "missing": 0, + "labels": { + "000016.SH": "上证50", + "000300.SH": "沪深300", + "000510.SH": "中证A500", + "000688.SH": "科创50", + "000852.SH": "中证1000", + "000905.SH": "中证500", + "399006.SZ": "创业板指", + "932000.CSI": "中证2000" + }, + "counts": { + "创业板指": 17, + "中证A500": 40, + "沪深300": 30, + "中证500": 29, + "中证2000": 14, + "中证1000": 15, + "上证50": 12, + "科创50": 20 + }, + "rows": [ + { + "ts_code": "159205.SZ", + "csname": "东财创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159215.SZ", + "csname": "平安中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159226.SZ", + "csname": "国泰中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159238.SZ", + "csname": "景顺长城沪深300增强策略ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159240.SZ", + "csname": "天弘中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159247.SZ", + "csname": "汇添富创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159249.SZ", + "csname": "工银瑞信中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159300.SZ", + "csname": "富国沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159330.SZ", + "csname": "东财沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159337.SZ", + "csname": "东财中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159338.SZ", + "csname": "国泰中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159339.SZ", + "csname": "银华中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159351.SZ", + "csname": "嘉实中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159352.SZ", + "csname": "南方中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159353.SZ", + "csname": "景顺长城中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159356.SZ", + "csname": "万家中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159357.SZ", + "csname": "博时中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159358.SZ", + "csname": "大成中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159359.SZ", + "csname": "华安中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159360.SZ", + "csname": "天弘中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159361.SZ", + "csname": "易方达中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159362.SZ", + "csname": "工银瑞信中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159376.SZ", + "csname": "浦银中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159379.SZ", + "csname": "融通中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159380.SZ", + "csname": "东财中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159386.SZ", + "csname": "永赢中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "159393.SZ", + "csname": "万家沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159500.SZ", + "csname": "富国中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159531.SZ", + "csname": "南方中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159532.SZ", + "csname": "易方达中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159533.SZ", + "csname": "博时中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159535.SZ", + "csname": "嘉实中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159536.SZ", + "csname": "汇添富中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159552.SZ", + "csname": "招商中证2000增强策略ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159553.SZ", + "csname": "海富通中证2000增强策略ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159555.SZ", + "csname": "银华中证2000增强策略ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159556.SZ", + "csname": "平安中证2000增强策略ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "159610.SZ", + "csname": "景顺长城中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159629.SZ", + "csname": "富国中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159633.SZ", + "csname": "易方达中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159673.SZ", + "csname": "鹏华沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159675.SZ", + "csname": "嘉实创业板增强策略ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159676.SZ", + "csname": "富国创业板增强策略ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159677.SZ", + "csname": "银华中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159678.SZ", + "csname": "博时中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159679.SZ", + "csname": "国泰中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159680.SZ", + "csname": "招商中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159685.SZ", + "csname": "天弘中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159808.SZ", + "csname": "融通创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159810.SZ", + "csname": "浦银创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159820.SZ", + "csname": "天弘中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159821.SZ", + "csname": "中银证券创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159845.SZ", + "csname": "华夏中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "159908.SZ", + "csname": "博时创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159915.SZ", + "csname": "易方达创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159919.SZ", + "csname": "嘉实沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159922.SZ", + "csname": "嘉实中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159925.SZ", + "csname": "南方沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "159935.SZ", + "csname": "景顺长城中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159948.SZ", + "csname": "南方创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159952.SZ", + "csname": "广发创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159956.SZ", + "csname": "建信创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159957.SZ", + "csname": "华夏创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159958.SZ", + "csname": "工银瑞信创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159964.SZ", + "csname": "平安创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159968.SZ", + "csname": "博时中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "159971.SZ", + "csname": "富国创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159977.SZ", + "csname": "天弘创业板ETF", + "index_code": "399006.SZ", + "index_name": "创业板指", + "proposed_label": "创业板指" + }, + { + "ts_code": "159982.SZ", + "csname": "鹏华中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510050.SH", + "csname": "华夏上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510100.SH", + "csname": "易方达上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510190.SH", + "csname": "华安上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510300.SH", + "csname": "华泰柏瑞沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510310.SH", + "csname": "易方达沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510320.SH", + "csname": "中金沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510330.SH", + "csname": "华夏沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510350.SH", + "csname": "工银瑞信沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510360.SH", + "csname": "广发沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510370.SH", + "csname": "兴业沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510380.SH", + "csname": "国寿安保沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510390.SH", + "csname": "平安沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "510500.SH", + "csname": "南方中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510510.SH", + "csname": "广发中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510530.SH", + "csname": "工银瑞信中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510550.SH", + "csname": "方正富邦中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510560.SH", + "csname": "国寿安保中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510570.SH", + "csname": "兴业中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510580.SH", + "csname": "易方达中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510590.SH", + "csname": "平安中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "510600.SH", + "csname": "申万菱信上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510680.SH", + "csname": "万家上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510710.SH", + "csname": "博时上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510800.SH", + "csname": "建信上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510850.SH", + "csname": "工银瑞信上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "510950.SH", + "csname": "广发上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "512020.SH", + "csname": "鹏华中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "512050.SH", + "csname": "华夏中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "512080.SH", + "csname": "中金中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "512100.SH", + "csname": "南方中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "512370.SH", + "csname": "华夏中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "512500.SH", + "csname": "华夏中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "512510.SH", + "csname": "华泰柏瑞中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "515130.SH", + "csname": "博时沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515190.SH", + "csname": "中银证券中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "515310.SH", + "csname": "汇添富沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515330.SH", + "csname": "天弘沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515350.SH", + "csname": "民生加银沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515360.SH", + "csname": "方正富邦沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515380.SH", + "csname": "泰康沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515390.SH", + "csname": "华安沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "515530.SH", + "csname": "泰康中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "515550.SH", + "csname": "国联中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "515660.SH", + "csname": "国联安沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "516300.SH", + "csname": "华泰柏瑞中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "530000.SH", + "csname": "天弘上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "530050.SH", + "csname": "东财上证50ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "560010.SH", + "csname": "广发中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "560100.SH", + "csname": "南方中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "560110.SH", + "csname": "汇添富中证1000ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "560220.SH", + "csname": "广发中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "560510.SH", + "csname": "泰康中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "560530.SH", + "csname": "摩根中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "560590.SH", + "csname": "鹏华中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "560610.SH", + "csname": "招商中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "560750.SH", + "csname": "申万菱信中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "560950.SH", + "csname": "汇添富中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "561000.SH", + "csname": "华安沪深300增强策略ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "561090.SH", + "csname": "华安中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "561280.SH", + "csname": "工银瑞信中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "561300.SH", + "csname": "国泰沪深300增强策略ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "561350.SH", + "csname": "国泰中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "561370.SH", + "csname": "国泰中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "561550.SH", + "csname": "华泰柏瑞中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "561590.SH", + "csname": "华泰柏瑞中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "561780.SH", + "csname": "博时中证1000增强策略ETF", + "index_code": "000852.SH", + "index_name": "中证1000", + "proposed_label": "中证1000" + }, + { + "ts_code": "561930.SH", + "csname": "招商沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "561950.SH", + "csname": "招商中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "561990.SH", + "csname": "招商沪深300增强策略ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "562070.SH", + "csname": "华宝沪深300增强策略ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "562660.SH", + "csname": "华夏中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "563030.SH", + "csname": "易方达中证500增强策略ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "563090.SH", + "csname": "易方达上证50增强策略ETF", + "index_code": "000016.SH", + "index_name": "上证50", + "proposed_label": "上证50" + }, + { + "ts_code": "563200.SH", + "csname": "富国中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "563220.SH", + "csname": "富国中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563300.SH", + "csname": "华泰柏瑞中证2000ETF", + "index_code": "932000.CSI", + "index_name": "中证2000", + "proposed_label": "中证2000" + }, + { + "ts_code": "563360.SH", + "csname": "华泰柏瑞中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563500.SH", + "csname": "华宝中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563520.SH", + "csname": "永赢沪深300ETF", + "index_code": "000300.SH", + "index_name": "沪深300", + "proposed_label": "沪深300" + }, + { + "ts_code": "563550.SH", + "csname": "摩根中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563600.SH", + "csname": "易方达中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563630.SH", + "csname": "国联安中证A500增强策略ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563650.SH", + "csname": "兴业中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563660.SH", + "csname": "银河中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563750.SH", + "csname": "汇添富中证500ETF", + "index_code": "000905.SH", + "index_name": "中证500", + "proposed_label": "中证500" + }, + { + "ts_code": "563800.SH", + "csname": "广发中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563860.SH", + "csname": "海富通中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "563880.SH", + "csname": "汇添富中证A500ETF", + "index_code": "000510.SH", + "index_name": "中证A500", + "proposed_label": "中证A500" + }, + { + "ts_code": "588000.SH", + "csname": "华夏上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588040.SH", + "csname": "鹏华上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588050.SH", + "csname": "工银瑞信上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588060.SH", + "csname": "广发上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588080.SH", + "csname": "易方达上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588090.SH", + "csname": "华泰柏瑞上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588150.SH", + "csname": "南方上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588180.SH", + "csname": "国联安上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588280.SH", + "csname": "华安上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588370.SH", + "csname": "南方上证科创板50成份增强策略ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588450.SH", + "csname": "招商上证科创板50成份增强策略ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588460.SH", + "csname": "鹏华上证科创板50成份增强策略ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588720.SH", + "csname": "中银上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588840.SH", + "csname": "万家上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588870.SH", + "csname": "汇添富上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588940.SH", + "csname": "富国上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "588950.SH", + "csname": "景顺长城上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "589150.SH", + "csname": "平安上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "589360.SH", + "csname": "国泰上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + }, + { + "ts_code": "589850.SH", + "csname": "东财上证科创板50成份ETF", + "index_code": "000688.SH", + "index_name": "科创50", + "proposed_label": "科创50" + } + ] +} diff --git a/docs/宽基查询接口与分时展示接续_2026-11-13.md b/docs/宽基查询接口与分时展示接续_2026-11-13.md index 58d97a7..6937abd 100644 --- a/docs/宽基查询接口与分时展示接续_2026-11-13.md +++ b/docs/宽基查询接口与分时展示接续_2026-11-13.md @@ -92,3 +92,14 @@ 12:53:04实际页面及health均HTTP200,服务返回页面与候选逐字一致,已确认宽基前置标签为空。运行中三条宽基信号仍按原有效期淡色显示,未为验收延长或制造新信号;观察服务12:52:57自然304正常。12:53:08连续确认1826683,缺口、待入账、孤儿及在途委托均0,数量差异为空、现金差0,资金快照4.6秒。 证据见[信号标签发布](evidence/etf_label_release_20261113.json)。备份`/home/factor/project/tradingSystem/backups/etf-label-20261113-ad5b1a6`,候选日志`/tmp/pms-etf-label-offline-ad5b1a6.log`。回退仅将web镜像恢复`pms:etf-today-654577f`并定向重建,不用完整旧覆盖文件覆盖其他服务后续修改。代码已推送并核对远程;本次无待完成事项,不新增观察任务。 + + +## 按跟踪指数统一宽基简称 + +用户确认名称以ETF类别为主,不保留基金公司、不新增名称悬停,点击保持原基金详情。13:04:48只读核对155当日宽基监测池177只成员及`gp_etf_basic`,全部有跟踪指数:上证50 12只、沪深300 30只、中证500 29只、中证1000 15只、中证2000 14只、中证A500 40只、科创50 20只、创业板指17只。这里只覆盖已接入的沪深宽基监测池,不扩展其他ETF或北交所证券。 + +简称直接按指数代码映射,去掉旧的基金名称删词及超长回退规则。未知或缺少指数资料时保留代码,不根据名称猜测类别。资料沿用原小时缓存与只读查询,不增加采集任务。相同类别的基金仍按原事件ID逐条保留,点击仍显示对应基金全名和代码,不把个别基金告警合并为指数组结论。增强产品的具体身份留在原详情。名称悬停移除,其他股票交互及宽基观察范围详情保持。 + +开发机32项ETF专项、页面三道护栏通过;新增50类区分、同类双事件及原始详情保留、未知归属不猜测、基础资料范围等边界用例。实际177只资料在断网环境回放,映射全部命中;当前三条自然事件除展示简称外字段不变。1440和390隔离浏览器验证单行无溢出、无前置标签及名称悬停,点击中证500仍打开嘉实159922详情,控制台无错误。账号区域为预览样例,不将预览中的“无后端”提示当作运行故障。 + +全量目录见[简称核对清单](evidence/etf_name_catalog_20261113.json)。修改仅用于web展示读取,独立观测消费与交易worker无需追平版本。候选断网及实际发布结果随后登记。 diff --git a/scripts/test_etf_observation.py b/scripts/test_etf_observation.py index bc7fd9b..4a4e615 100644 --- a/scripts/test_etf_observation.py +++ b/scripts/test_etf_observation.py @@ -125,6 +125,56 @@ class ETFTests(TestCase): path=Path(contract.__file__).parent;manifest=json.loads((path/'PROVENANCE.json').read_text()) for name,digest in manifest['sha256'].items():self.assertEqual(hashlib.sha256((path/name).read_bytes()).hexdigest(),digest) + +class DisplayNameTests(TestCase): + def state(self, codes): + state = svc.initial(DAY) + for i, code in enumerate(codes): + event, _, _ = fixture() + event.update(subject_type='ETF', subject_id=code, event_id='name-test-'+str(i)) + state['events'][event['event_id']] = {'event': event, 'observation': {}, 'received_at': NOW.isoformat()} + return state + + def test_index_code_decides_label_not_fund_name(self): + names = {'510050.SH': {'full_name': '合成科创50名称', 'index_code': '000016.SH'}, + '588000.SH': {'full_name': '合成上证50增强名称', 'index_code': '000688.SH'}} + rows = svc.presentation(self.state(names), NOW, names)['events'] + self.assertEqual({r['subject_id']: r['name'] for r in rows}, + {'510050.SH': '上证50', '588000.SH': '科创50'}) + + def test_same_category_keeps_two_events_and_original_details(self): + names = {'510300.SH': {'full_name': '合成甲基金', 'index_code': '000300.SH'}, + '159300.SZ': {'full_name': '合成乙增强基金', 'index_code': '000300.SH'}} + state = self.state(names); before = copy.deepcopy(state) + rows = svc.presentation(state, NOW, names)['events'] + self.assertEqual(len(rows), 2) + self.assertEqual({r['name'] for r in rows}, {'沪深300'}) + for row in rows: + self.assertEqual(row['full_name'], names[row['subject_id']]['full_name']) + self.assertEqual(row['event_id'], state['events'][row['event_id']]['event']['event_id']) + self.assertEqual(state, before) + + def test_missing_or_unknown_index_does_not_guess_from_name(self): + names = {'159001.SZ': {'full_name': '合成中证500ETF', 'index_code': 'UNKNOWN'}} + rows = svc.presentation(self.state(['159001.SZ', '159002.SZ']), NOW, names)['events'] + self.assertEqual({r['subject_id']: r['name'] for r in rows}, + {'159001.SZ': '159001', '159002.SZ': '159002'}) + state = self.state(['159001.SZ']) + state['events']['name-test-0']['event'].update(subject_type='INDEX', subject_id='000688.SH') + self.assertEqual(svc.presentation(state, NOW)['events'][0]['name'], '科创50') + + def test_catalog_preserves_index_metadata_and_excludes_disallowed_exchange(self): + from app.db import session as db + rows = [{'ts_code': '159001.SZ', 'csname': '合成基金', 'index_code': '000905.SH', 'index_name': '中证500'}, + {'ts_code': '920001.BJ', 'csname': '不纳入范围', 'index_code': '000688.SH', 'index_name': '科创50'}] + with patch.object(db, 'fetch_all', return_value=rows) as fetch: + names = svc.name_map() + fetch.assert_called_once() + self.assertEqual(names['159001.SZ'], {'full_name': '合成基金', 'index_code': '000905.SH'}) + self.assertEqual(names['000905.SH']['full_name'], '中证500') + self.assertNotIn('920001.BJ', names) + self.assertNotIn('000688.SH', names) + class IntradayViewTests(TestCase): def row(self, hm='10:00', value=.3, direction='BUY', revision=0): return {'trade_date': DAY, 'window_end': DAY+'T'+hm+':00+08:00',