Commit Graph

3 Commits

Author SHA1 Message Date
1bc3c99482 refactor: 简化服务架构 - 统一HTTP服务模式
- 新增 BaseApp 基类,统一 FastAPI 应用生命周期管理
- 移除 Gateway 服务,各服务直接对外提供 HTTP 接口
- 重命名 qmt_adapter 为 qmt_service
- 移除各服务独立的 health.py,统一由 BaseApp 提供
- 新增 scripts/init_db.py 数据库初始化脚本
- 新增 scripts/download_kline.py K线数据下载示例
- 删除 console 模块(暂不使用)
- 更新 .gitignore 忽略 caches/ 和 learning_materials/
2025-12-10 00:15:19 +08:00
e04da0f51d fix: 修复 Pylance 类型检查错误
修复内容:
- 移除未使用的导入 (database.py, logger.py, main.py, market.py, trading.py, kline.py, kline_service.py, data_player.py)
- 修复字典键重复问题 (trading.py, account.py, backtest.py)
- 修复 SQL 执行类型错误,使用 text() 包装 (health.py, kline.py)
- 修复 Redis 客户端类型推断问题 (redis_client.py)
  - 添加 pyright 忽略指令和 type: ignore
  - 添加 ping(), smembers(), scan_iter() 等方法
  - 修复 lpop/rpop/sismember 返回类型
- 修复 data_player.py 中的 params 类型注解
2025-12-08 23:46:08 +08:00
883d7e6549 feat: 阶段3 Data Service 数据服务
完成数据服务模块:
- data_service/app.py: FastAPI 应用框架,端口 8020
- data_service/routes/: 路由模块
  - health.py: 健康检查 /ping, /health
  - market.py: 行情查询 /market/quote, /market/quotes, /market/snapshot
  - kline.py: K线查询 /kline/history, /kline/latest, /kline/periods
  - backtest.py: 回测控制 /backtest/start, /backtest/stop, /backtest/pause

- data_service/services/: 核心服务
  - market_receiver.py: 行情接收器,订阅 Redis 频道接收 QMT 推送
  - kline_service.py: K线服务,批量存储K线到分周期表
  - data_player.py: 数据回放器,支持回测数据按时间回放

功能特性:
- 行情接收与分发 (Redis Pub/Sub)
- K线数据持久化 (按周期分表存储)
- 回测数据回放 (支持暂停/恢复/调速)
2025-12-08 23:24:08 +08:00