Commit Graph

7 Commits

Author SHA1 Message Date
eb2179809f 重构:统一策略框架和服务命名,修复所有Pylance错误
主要改动:
1. 策略框架重构
   - 统一实盘和回测策略接口
   - 新增 src/core/strategy/ 核心策略模块
   - BaseStrategy、Signal、StrategyContext 统一定义
   - 内置指标库(TA-Lib封装)和策略注册中心
   - 删除旧策略代码

2. 服务重命名
   - strategy_engine -> strategy_service (统一 _service 后缀)
   - 更新所有配置、导入路径、测试文件
   - 23个文件同步更新

3. 回测服务增强
   - 支持多策略-多股票组合回测
   - 为每个策略-股票组合创建独立管理器
   - BacktestConfig schema 添加 strategy_id 字段
   - 数据回放器支持独立频道

4. 代码质量提升
   - 修复所有 src/ 目录下的 Pylance 错误
   - 添加 get_kline_model 函数
   - 修复 K线字段名(trade_date -> time)
   - 修复类型转换(Decimal -> float)
   - 修复 MA_Type 导入路径
   - 统一代码风格
2025-12-11 23:25:16 +08:00
ba6b499b70 fix: 完成 OrderSide/SignalSide 到 TradeSide 的全面迁移
- 移除 data_service/services/kline_service.py 中未使用的导入
- 更新 tests/test_core/test_data_download.py 中 get_kline_model 导入
- 替换所有服务中的 OrderSide/SignalSide 为 TradeSide
- 更新 strategy_engine 中的类型注解
- 更新测试文件中的枚举值(BUY/SELL 统一为小写)
- 验证:所有4个服务启动成功(DataService/CoreService/QMTService/StrategyEngine)
2025-12-11 18:29:51 +08:00
ccdce260d2 feat: 配置系统智能类型转换 + 测试文件迁移到 tests/test_core/ 2025-12-11 09:01:39 +08:00
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
085427959c feat: Phase 4-7 - Core Service, Strategy Engine, QMT Adapter, Tests
Phase 4: Core Service (port 8010)
- Pairing management (symbol-strategy pairs)
- Order service with Redis pub/sub
- Position and balance tracking

Phase 5: Strategy Engine (port 8030)
- BaseStrategy abstract class
- Strategy registry and executor
- Built-in strategies: Grid, MA Cross, Dual MA
- Signal manager with Redis integration

Phase 6: QMT Adapter (port 8040)
- XtQuant SDK wrapper with simulation mode
- Order executor listening to Redis channels
- Quote pusher and account syncer

Phase 7: Testing & Documentation
- Pytest fixtures for all services
- Unit tests for models and strategies
- Windows startup scripts
2025-12-09 00:36:27 +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
be4ee5d41c refactor: 微服务架构重构 - 阶段1核心模块完成
- 新增架构设计文档 (ARCHITECTURE.md)
- 新增构建方案文档 (BUILD_PLAN.md)
- 实现核心模块 (src/core/):
  - config.py: Pydantic Settings + YAML 配置管理
  - redis_client.py: 异步 Redis 客户端
  - database.py: SQLAlchemy 2.0 异步数据库
  - logger.py: 统一日志模块
  - models/: 数据模型 (market, order, position, symbol_strategy)
- 新增服务启动入口 (src/main.py)
- 清理旧代码,准备微服务架构
2025-12-08 17:53:35 +08:00