Files
one_divine_lot/docs/02-计划/计划-归属候选纳入清仓持仓.md
kyugao 22ec732607 迭代15: 委托归属候选纳入近期清仓持仓(R-017)
- 交易记录 tab 归属候选只回当前持仓 → 清仓后当日委托失去下拉锚点无法补关联
  (2026-09-07 大连热电实际发生: 盘中归属后被清为未关联,下拉已无做T候选)
- SqliteStore.getAttributionCandidates: 候选 = 该 code 当前持仓 + 近 7 天清仓的持仓
  (closed 标记 + closedAt,排序 当前持仓在前 → 清仓行 closed_at DESC)
- AttributionSelect: 下拉 value 改 holdingId 键控(同策略多轮持仓不撞值)、
  清仓选项「(已清仓 MM-DD)」后缀、已归属但候选缺失显示「当前归属」占位
- 回归: test-r017-candidates 12/12 + 存量回归全绿
2026-09-07 18:15:20 +08:00

28 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 计划:委托归属候选纳入近期清仓持仓(阶段航点)
> 编号:PLAN-016 | 粒度:阶段航点 创建:2026-09-07 | 状态:**已实施(待验收)**
> 派生自终极目标:目标-008(真实交易系统接入)
> 依据需求:**R-017(已定稿,2026-09-07,老师指令确认方向)** —— 符合入范围门槛
> 设计约束:技术约束-013 语义延伸(候选窗口 + holdingId 键控);不新增约束条目
## 目标
清仓后当日委托可补关联:归属候选 = 该 code 当前持仓 + 近 7 天清仓持仓(closed 标记),下拉锚点改 holdingId 键控。
## 范围
**做**getAttributionCandidates 扩展(closed_at IS NULL OR ≥ 7 天前;closed/closedAt 字段;当前在前/清仓 closed_at DESC+ AttributionSelect holdingId 键控 + 「(已清仓 MM-DD)」后缀 + 「当前归属」占位选项 + 回归 test-r017-candidates.mjs。
**不做**:候选窗口可配置;自动归属;其他候选消费方调整;历史数据修复工具(一次性修复走 set-attribution)。
## 涉及文件
src/storage/SqliteStore.jsgetAttributionCandidates)、src/client/views/TradeRecordsTab.jsxAttributionSelect)、scripts/test-r017-candidates.mjs(新增)。
## 实现步骤
1. R-017 + 本计划 + 三件套;2. 存储扩展;3. UI 重构;4. 回归 + typecheck + build + 存量回归;5. 复盘。
## 验收要点
`docs/04-迭代记录/15-归属候选纳入清仓持仓/验收标准.md`