mirror of
https://github.com/silencesdg/mt5_python_ea_suite.git
synced 2026-07-28 11:17:43 +00:00
4cb4f4a15e
- 重构核心模块:DataProvider 依赖注入、RiskController 门面、信号注册表 - 新增 FastAPI 代理服务 (run/server.py),支持局域网远程调用 MT5 - 新增 RemoteDataProvider + AttrDict,远端无缝替代 LiveDataProvider - 新增序列化模块,MT5 对象转 JSON 兼容格式 - 重构入口点至 run/ 包,支持 python -m run.realtime/server/backtest/optimize - 更新 CLAUDE.md 文档 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
45 lines
878 B
Python
45 lines
878 B
Python
# MT5 时间周期常量映射
|
|
# 参考: https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes
|
|
|
|
PERIOD_M1 = 1
|
|
PERIOD_M5 = 5
|
|
PERIOD_M15 = 15
|
|
PERIOD_M30 = 30
|
|
PERIOD_H1 = 16385
|
|
PERIOD_H4 = 16386
|
|
PERIOD_D1 = 16408
|
|
PERIOD_W1 = 32769
|
|
PERIOD_MN1 = 49153
|
|
|
|
# MT5 timeframe → 分钟数
|
|
TIMEFRAME_TO_MINUTES = {
|
|
PERIOD_M1: 1,
|
|
PERIOD_M5: 5,
|
|
PERIOD_M15: 15,
|
|
PERIOD_M30: 30,
|
|
PERIOD_H1: 60,
|
|
PERIOD_H4: 240,
|
|
PERIOD_D1: 1440,
|
|
PERIOD_W1: 10080,
|
|
PERIOD_MN1: 43200,
|
|
}
|
|
|
|
# MT5 timeframe → pandas resample rule
|
|
RESAMPLE_RULES = {
|
|
PERIOD_M1: '1min',
|
|
PERIOD_M5: '5min',
|
|
PERIOD_M15: '15min',
|
|
PERIOD_M30: '30min',
|
|
PERIOD_H1: '1h',
|
|
PERIOD_H4: '4h',
|
|
PERIOD_D1: '1D',
|
|
PERIOD_W1: '1W',
|
|
PERIOD_MN1: '1ME',
|
|
}
|
|
|
|
# MT5 交易方向常量
|
|
ORDER_TYPE_BUY = 0
|
|
ORDER_TYPE_SELL = 1
|
|
POSITION_TYPE_BUY = 0
|
|
POSITION_TYPE_SELL = 1
|