QTrade/configs/global.yaml
cuizhan 9d11f64c08 fix: 修复导入路径和配置文件语法错误
修复问题:
1. main.py 导入路径修复
   - 支持直接运行: python src/main.py
   - 添加项目根目录到 sys.path
   - 改用绝对导入: from src.core.config import ...

2. downloader_factory.py 导入修复
   - 错误: from .data_downloader import BaseDataDownloader
   - 正确: from .base_downloader import BaseDataDownloader
   - 正确: from .xtquant_downloader import XtQuantDownloader

3. global.yaml 语法修复
   - 删除文件末尾的非法字符

4. data_provider.py 格式化
   - 修正缩进问题

测试结果:
 程序成功运行
 配置加载正常
 DataProvider 实例化成功
 数据库连接正常
 XtQuant 初始化成功
 完整的端到端流程验证通过
2025-12-17 16:01:43 +08:00

90 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# QTrade 全局公共配置
# 说明: 此文件包含所有服务共用的配置项
# 环境变量配置(对应 .env 文件内容)
environment:
# 当前环境: backtest, simulation, production
env: "backtest"
# 配置文件路径
config_file: "configs/backtest.yaml"
# 环境对应的配置文件映射
config_mapping:
backtest: "configs/backtest.yaml"
simulation: "configs/simulation.yaml"
production: "configs/production.yaml"
# 应用配置
app:
version: "2.0.0" # 公用版本号
# MySQL 配置(公用)
database:
host: "127.0.0.1"
port: 3306
user: "root"
password: "1234"
pool_size: 5
pool_recycle: 3600
echo: false
# 日志配置(公用)
logging:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
file:
enabled: true
max_size: 10485760 # 10MB
backup_count: 5
# 数据源配置(公用)
data_source:
# 数据下载器类型: xtquant, qmt, tushare, akshare 等
downloader: "xtquant"
# XtQuant 下载器配置
xtquant:
xtquant_path: "C:\\Program Files\\国金证券QMT交易端\\userdata_mini\\datadir"
xtquant_token: "e83d8eec5226c0b4db4a1d40830e09e4ffe73e15" # XtQuant 数据接口 token(需要申请)
# XtQuant 优化地址(可选,用于提升数据下载速度)
optimize_addresses:
- "115.231.218.73:55310"
- "115.231.218.79:55310"
- "218.16.123.11:55310"
- "218.16.123.27:55310"
# 未来扩展:其他下载器配置
# qmt:
# ...
# tushare:
# token: "your_token_here"
# 行情配置(公用)
market:
kline_periods:
- "1m"
- "5m"
- "15m"
- "30m"
- "60m"
- "1d"
- "1w"
cache_ttl: 60
# 交易配置(公用)
trading:
sessions:
morning:
start: "09:30"
end: "11:30"
afternoon:
start: "13:00"
end: "15:00"
# 服务端口配置(公用)
services:
trading_service:
host: "0.0.0.0"
# QMT交易配置(公用部分)
qmt:
account_type: "STOCK" # STOCK-股票账户, CREDIT-信用账户