refactor(data): 重构交易所适配器,修复 Kline 实体复合主键

- 废弃旧 adapter 体系 (base/binance/types.ts),新增 base_rest/rest.ts
  基于 Binance 官方 SDK 实现 REST K 线拉取
- Kline 实体改为四列复合主键 (exchange/symbol/interval/time),
  修复单列 time PK 导致的跨 symbol 写入冲突
- 新增 filterConsecutive():K 线连续性过滤,首缺口截断策略
- 新增 service/kline.ts:批量 UPSERT K 线入库
- 新增 types/ 共享类型定义、example/ 示例、run/ 运行脚本
This commit is contained in:
Rekey
2026-06-08 18:18:16 +08:00
parent 85a0031a78
commit 5e385547c7
16 changed files with 829 additions and 1043 deletions
+6 -4
View File
@@ -4,13 +4,14 @@
"description": "数字货币量化交易系统 - TypeScript 数据模块",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"dev": "bun run run/main.ts",
"dev:watch": "bun --watch run/main.ts",
"build": "tsc",
"start": "node dist/index.js",
"start": "bun run run/main.ts",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint src/",
"format": "prettier --write src/"
"lint": "eslint .",
"format": "prettier --write ."
},
"dependencies": {
"@timescaledb/typeorm": "^0.0.1",
@@ -19,6 +20,7 @@
"ioredis": "^5.11.1",
"pg": "^8.21.0",
"pino": "^10.3.1",
"pino-pretty": "^13.1.3",
"rxjs": "^7.8.2",
"typeorm": "^1.0.0",
"yaml": "^2.9.0"