feat(存储): JSON data store 升级 SQLite(迭代 06,R-008)

- 新增 SqliteStore(node:sqlite 封装):strategy_holdings 持仓生命周期表 + market_quotes_cache 行情缓存表
- DataStore 改造为门面委托 SqliteStore,保留兼容 API,启动检测自动迁移(幂等)
- PositionManager 适配单票生命周期(openHolding/addShares/reduceShares/closeHolding),清仓转历史保留
- 新增一次性迁移脚本 scripts/migrate-json-to-sqlite.mjs + pnpm migrate 命令
- 修复 addToStrategy 语义 Bug(新增量 vs 绝对目标量),真实 API CRUD 回归通过
- 移除策略 tab 一键清零按钮及 remove-all-shares 端点(clearStrategyShares 保留供删除策略联动)
- 插件 dispose 补充 storage.close() 关闭 SQLite 连接
This commit is contained in:
2026-09-01 18:04:12 +08:00
parent aef27dcd3f
commit 9b719f13ba
10 changed files with 555 additions and 299 deletions
+1
View File
@@ -86,6 +86,7 @@ async function apply(ctx, config) {
return () => {
marketFeed.stop();
qmtHealthMonitor.stop();
storage.close(); // 关闭 SQLite 连接(迭代 06
logger.info('[one-divine-lot] 插件已释放');
};
}, 'one-divine-lot.dispose');