bb3f8bd28d
- R-004 QMT连接配置:多配置管理 + 会话头部快捷切换(03-QMT连接配置) - R-005 WS盘中价格实时更新:服务端中转+缓存+前端轮询(04-WS盘中价格实时更新) - R-006 策略数据 JSON data store 标准化(store.json/market.json/schema.json) - R-007 交易记录接入:当日订单+成交单表合并(委托主行+展开成交明细)、时间段查询(今日/本周/本月+手动起止)、费用计算(佣金费率万m_dCommission+最低5元、印花税卖出万5、过户费双向万0.1) - 架构治理:api 按领域拆分、component 目录、QmtHealthMonitor
41 lines
2.1 KiB
Markdown
41 lines
2.1 KiB
Markdown
# 计划:策略数据 JSON data store schema 标准化(阶段航点)
|
||
|
||
> 编号:PLAN-005 | 粒度:阶段航点(大粒度) | 创建:2026-08-31 | 状态:**已完成(2026-09-01 迭代 04 验收通过,R-006 已实现)**
|
||
> 派生自终极目标:目标-001(DSH 插件形态)
|
||
> 依据需求:**R-006(已定稿,2026-08-31)** —— 符合入范围门槛
|
||
> 设计约束:技术约束-011(测试数据隔离)、技术约束-012(新增:JSON data store schema)
|
||
|
||
## 目标
|
||
|
||
将策略份额分配数据(现 allocations.json,code 为中心)标准化为 **JSON data store schema**:
|
||
- store.schema.json:描述数据集(dataset)的标准字段(类 JSON Schema);
|
||
- store.json:实际数据文件,策略为中心(strategies[].dataset = [{code, shares}]);
|
||
- 策略定义仍留 DSH settings(设置页交互不变);
|
||
- 旧 allocations.json 启动时自动迁移(保留备份)。
|
||
|
||
## 范围
|
||
|
||
**做**:
|
||
1. 新增 DataStore 模块(src/component/DataStore.js):
|
||
- 定义 store.schema.json 与 store.json 结构;
|
||
- 读写 store.json(schema 校验 + 原子写);
|
||
- 迁移:启动时检测旧 allocations.json → 转换为 store.json(code 为中心 → 策略为中心),保留 allocations.json.bak;
|
||
- 数据集 CRUD:getDataset(strategyId) / setDataset(strategyId, items) / removeDataset(strategyId)。
|
||
2. PositionManager / api 改造:
|
||
- 份额读写改走 DataStore(替代 AllocationStorage);
|
||
- strategies/remove 联动删 store dataset(同现状联清份额模式);
|
||
- 现有端点(add-shares/remove-shares/strategy-positions/summary 等)行为不变。
|
||
3. 删除/归档 AllocationStorage(迁移完成后)。
|
||
|
||
**不做**:
|
||
- 策略定义迁移(保留 settings);
|
||
- 不引入数据库(数据量少,JSON 足够)。
|
||
|
||
## 实现步骤
|
||
|
||
1. DataStore 模块(schema + 读写 + 迁移 + dataset CRUD);
|
||
2. PositionManager 改接 DataStore;
|
||
3. api 编排(strategies/remove 联动删 dataset);
|
||
4. 构建 + 测试隔离模式验证迁移;
|
||
5. 验收 + 记录迭代。
|