Commit Graph

5 Commits

Author SHA1 Message Date
67b85ab232 Refactor: Implement WebSocket architecture with separated communication and business logic layers
- Implemented WebSocket protocol v1.0 specification with protocol headers, versioning, and batch support
- Renamed qtrade_server.py -> ws_server.py, client_adapter.py -> ws_client.py to reflect WebSocket implementation
- Created pure communication layer (WSClient) with only connect/send/close functionality
- Created business logic layer (BacktestClientAdapter) for protocol construction and signal parsing
- Updated bt_engine.py to use BacktestClientAdapter for strategy communication
- Fixed datetime formatting issues (time.strftime -> datetime.now().strftime for %f support)
- Fixed WebSocket 1000 OK close code logging issue
- Translated all logger output from Chinese to English for better compatibility
- Successfully tested with 242 K-lines data transmission

Architecture changes:
- networks/ layer: Pure WebSocket communication (no business logic)
- backtest/ layer: Business logic (protocol v1.0 message construction)
- Clear separation of concerns between transport and application layers
2025-12-25 16:15:56 +08:00
ab31734097 实现GUI多子图K线图表 - 专业黑色主题
主要改进:
1. K线图改造为4个子图布局(K线+成交量+MACD+RSI)
2. 应用专业黑色主题(#0a0a0a背景)
3. 配色调整为青色上涨(#00ffff)、红色下跌(#ff0000)
4. 增加MA5/10/20/30/60五条均线
5. 实现MACD和RSI指标绘制
6. 修复数据存储的主键冲突和SQL过长问题
7. 完善DownloaderManager参数处理

技术细节:
- 使用matplotlib gridspec控制子图高度比例(6:2:1.5:1.5)
- EMA计算MACD指标(12/26/9)
- RSI多周期显示(6/12/24)
- 数据分批保存(100条/批)
- 保存前删除冲突记录避免主键错误

文件变更:
- simple_kline_viewer.py: 4子图布局+黑色主题+指标计算
- mysql_storage.py: 分批保存+冲突处理+时间范围检查
- downloader_manager.py: 修复Config兼容性
- requirements.txt: 新增项目依赖清单
- docs/tech_designs/gui_design.md: 更新技术设计文档
- src/gui/*: GUI三层架构实现(Presentation/Controller/Adapter)

测试状态:
-  601658.SH 1d数据473条成功显示
-  4个子图正常渲染
-  黑色主题和专业配色生效
-  MACD/RSI指标计算正确
-  数据下载和存储流程完整
2025-12-22 21:10:36 +08:00
5734bf1fd0 feat: 实现XtQuant数据下载器和核心对象系统
- 新增核心对象模型(Tick, Kline, Order, Trade, Position, Account, Signal, Symbol)
- 使用Pydantic BaseModel实现自动验证
- 创建DatabaseManager管理数据库和表结构
- 实现BaseDataDownloader抽象基类
- 实现XtQuantDownloader下载历史K线数据
- 添加Config和Logger工具类
- 清理旧的微服务架构代码
- 更新配置文件为简化版本(去除Redis)
- 所有测试通过
2025-12-15 20:00:47 +08:00
422b26a62a docs: 更新 requirements.txt 添加模块依赖说明 2025-12-09 01:04:49 +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