mt-数据-MCP | mt-data-mcp
MetaTrader5 的 MCP 服务器,提供市场数据和技术指标
mtdata
mtdata是MetaTrader 5(MT5)的研究与自动化工具包。它提供预测、体制检测、信号处理、风险分析和报告工具——将原始市场数据与数据科学相结合。它以模型上下文协议(MCP)服务器还是独立服务器CLI.
这是给谁的?
- 新手交易者/学习者:遵循指导的工作流程(无需定量背景)。
- 系统性交易者:原型想法,快速回测,并通过CLI/MCP实现自动化。
- 数据专家:将MT5市场数据导入可重复的分析流程。
平台支持(重要)
- 必须有窗户 to run MetaTrader 5 (and therefore to run
mtdataagainst MT5). - If you're on macOS/Linux, run
mtdataon a Windows 虚拟机或 Windows 机器并实现远程连接(MCP/Web API)。 - Python 3.14 是支持的运行时对于该仓库中的封装依赖集合。
安全第一
mtdataincludestrade_*commands that can 下放/修改/关闭真实订单在目前登录MT5的账户上。- Use a 演示账户直到你了解工具和经纪人设置。
- mtdata 没有内置的“纸币交易”模式;使用MT5演示账号进行模拟执行。
- If you only want research, stick to
data_,forecast_,regime_,patterns_, andreport_*commands.
Capabilities
| Category | 它的作用 | 关键工具 |
|---|---|---|
| Data | 从MT5获取蜡烛、tick、市场深度和排名市场扫描 | data_fetch_candles, data_fetch_ticks, market_depth_fetch, market_ticker, symbols_top_markets |
| Forecasting | 用经典模型、机器学习模型或基础模型预测价格路径 | forecast_generate, forecast_backtest_run |
| Volatility | 估算未来价格变动幅度 | forecast_volatility_estimate |
| Regimes | 检测趋势、波动或危机市场状态 | regime_detect |
| Barriers | 通过模拟计算TP/SL命中概率 | forecast_barrier_prob, forecast_barrier_optimize |
| Patterns | 识别烛台和图表模式 | patterns_detect |
| Indicators | 计算100+技术指标 | data_fetch_candles --indicators |
| Denoising | 平滑价格数据以揭示趋势 | --denoise option |
| Temporal | 发现会话效果和季节性模式 | temporal_analyze |
| Trading | 下单,管理仓位 | trade_place, trade_close |
| Fundamentals | 美国股市数据、筛选、新闻、日历 | finviz_fundamentals, finviz_screen, finviz_calendar |
| Options | 期权链与量化自由障碍定价 | forecast_options_chain, forecast_quantlib_barrier_price |
快速入门
Prerequisites: Windows + Python 3.14 + MetaTrader 5 installed and running (demo account recommended).
# Lean core install
pip install -e .
# Full research/web install
pip install -r requirements.txt
# Verify MT5 connection (lists symbols from the running terminal)
mtdata-cli symbols_list --limit 5
# Scan the current MT5 watchlist for top markets
mtdata-cli symbols_top_markets --rank-by all --limit 5 --timeframe H1
# Fetch recent candles
mtdata-cli data_fetch_candles EURUSD --timeframe H1 --limit 50
# Generate a baseline price forecast
mtdata-cli forecast_generate EURUSD --timeframe H1 --horizon 12 --method theta
Notes:
pip install -e .now installs the lean core package only.pip install -r requirements.txtinstalls the full validated Python 3.14 stack, including Chronos/TimesFM, StatsForecast, sktime, mlforecast, and the Web API.gluonts/Lag-Llama,hnswlib, andtsdownsampleare intentionally excluded from the default 3.14 environment because current wheel support is incomplete or incompatible.
Documentation
新来的?请遵循以下学习路径:docs/SETUP.md → docs/GLOSSARY.md → docs/CLI.md → docs/SAMPLE-TRADE.md (then docs/SAMPLE-TRADE-ADVANCED.md and deep dives).
入门指南
核心主题
- Forecasting— 价格预测方法(Theta、ARIMA、Chronos等)
- Volatility——估算价格变动幅度
- 政权检测— 识别市场状态(趋势与波动)
- 障碍分析— TP/SL命中概率计算
- 技术指标— 可用指标和使用情况
- Denoising— 平滑滤波器以揭示趋势
- 模式检测—— 蜡烛和图表图案
- 时间分析— 会话效应、星期几和季节模式
外部数据与选项
Tutorials
Reference
- Web API— Web 界面和集成的 REST 端点
- Troubleshooting——常见问题与修复方法
Configuration
Create a .env file in the project root:
MT5_LOGIN=12345678
MT5_PASSWORD=your_password
MT5_SERVER=your_broker_server
MT5_TIME_OFFSET_MINUTES=0 # Adjust if broker server time differs from UTC
Architecture
mtdata/
├── src/mtdata/
│ ├── core/ # Tool registry, schemas, server logic, all 52 MCP tools
│ ├── forecast/ # Forecasting methods, engines, and method registry
│ ├── patterns/ # Pattern detection algorithms
│ ├── services/ # MT5 data access, Finviz, options data
│ └── utils/ # Shared utilities (indicators, denoising, etc.)
├── webui/ # React + Vite frontend
├── docs/ # Documentation
└── tests/ # Test suite
License
MIT
💡 精彩内容推荐
✍️ 楼主最新发布
- •
- •
- •
- •
- •
- •
🔗 您可能感兴趣
- •
- •
- •
- •
- •
- •
🔐
请登录后参与评论
注册满12小时后评论,即可解锁附件下载
立即登录
