QMT-MCP 模块化量化交易助手
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"qmt-mcp": {
"url": "http://127.0.0.1:8000/sse",
"type": "sse",
"timeout": 60,
"autoApprove": []
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
一个基于FastMCP和XTQuant的模块化量化交易系统,提供智能策略生成、实时交易执行和回测分析功能。
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in finance
Real-time financial market data: stocks, forex, crypto, commodities, and economic indicators
A Model Context Protocol (MCP) server that provides AI assistants with direct access to the Spreedly payments API. Enables LLMs to manage gateways, process transactions, tokenize payment methods, and more, through structured, validated tool calls.
MCP server for InsightSentry financial data API - market data, options, screeners, and more
AI agents get on-chain identity, credentials, reputation, escrow, and persistent memory on XRPL.
MCP Security Weekly
Get CVE alerts and security updates for QMT MCP and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
一个基于FastMCP和XTQuant的模块化量化交易系统,提供智能策略生成、实时交易执行和回测分析功能。
📺 点击封面图或链接即可在 Bilibili 观看完整演示
https://www.bilibili.com/video/BV1SFGjz6EKN/?vd_source=26053b834f0ddd4f57b22169d74b6f78
国金QMT-MCP/
├── main.py # FastMCP服务器主入口
├── config.json # 系统配置文件
├── requirements.txt # 项目依赖
├── src/
│ ├── config.py # 配置管理模块(支持环境变量)
│ ├── tools/ # MCP工具实现
│ │ ├── trading_tool.py # 交易执行工具
│ │ └── qmt_tool.py # QMT策略工具
│ ├── strategies/ # 策略模块
│ │ ├── ma_strategy.py # 双均线策略
│ │ └── strategy_generator.py # 策略生成器
│ └── utils/ # 工具模块
│ ├── xtquant_client.py # XTQuant客户端
│ └── data_handler.py # 数据处理器
└── logs/ # 日志文件目录
git clone <repository-url>
cd Nondescript-MCP
pip install -r requirements.txt
创建 .env 文件并配置以下参数:
# =====================================================
# 国金QMT-MCP 环境配置文件
# 请根据你的实际环境修改下面的配置参数
# =====================================================
# 服务器配置
QUANTMCP_HOST=127.0.0.1 # MCP服务器监听地址,通常保持127.0.0.1
QUANTMCP_PORT=8000 # MCP服务器端口号,可根据需要修改
QUANTMCP_TRANSPORT=sse # 传输协议,保持sse即可
# XTQuant/QMT 交易客户端配置
# 重要:请修改为你的QMT安装路径和账户信息
QMT_PATH=你的QMT安装路径\userdata_mini # QMT客户端数据目录,如: D:\QMT\userdata_mini
QMT_SESSION_ID=你的会话ID # QMT会话ID,整数,如: 12345
QMT_ACCOUNT_ID=你的交易账户ID # 你的模拟或实盘交易账户ID
# QMT策略保存目录
QMT_STRATEGY_DIR=你的QMT策略目录\mpython # QMT策略文件保存目录,如: D:\QMT\mpython
# 交易风险控制配置
MAX_ORDER_VALUE=100000.0 # 单笔订单最大金额(元),防止误操作大额下单
MAX_POSITION_VALUE=500000.0 # 单只股票最大持仓金额(元),控制单股风险
MIN_ORDER_QUANTITY=100 # 最小下单数量(股),通常为100的整数倍
MARKET_ORDER_SPREAD=0.1 # 市价单价差比例(0.1=10%),避免成交价偏离过大
# 策略默认参数配置
DEFAULT_SYMBOL=000001.SZ # 默认股票代码,用于测试和演示
DEFAULT_START_DATE=20240101 # 默认回测开始日期,格式YYYYMMDD
DEFAULT_END_DATE=20241201 # 默认回测结束日期,格式YYYYMMDD
DEFAULT_SHORT_PERIOD=5 # 默认短期均线天数
DEFAULT_LONG_PERIOD=20 # 默认长期均线天数
# 日志配置
LOG_LEVEL=INFO # 日志级别: DEBUG/INFO/WARNING/ERROR
LOG_FILE=logs/quantmcp.log # 日志文件路径
python main.py
服务启动后将在 http://127.0.0.1:8000 提供MCP服务。
# 通过MCP接口调用
place_order(
symbol="000001.SZ", # 股票代码
quantity=100, # 买入股数
price=10.5, # 下单价格
direction="BUY" # 交易方向
)
cancel_order(order_id="12345") # 撤销指定订单
generate_ma_strategy(
symbol="000001.SZ", # 目标股票
short_period=5, # 短期均线
long_period=20, # 长期均线
strategy_name="my_ma" # 策略名称
)
save_qmt_strategy(
strategy_name="custom_strategy",
code="""
def init(context):
# 策略初始化
pass
def handle_bar(context, bar_dict):
# 策略执行逻辑
pass
"""
)
系统提供完整的策略回测功能,包括:
[OK] 双均线
... [View full README on GitHub](https://github.com/guangxiangdebizi/QMT-MCP#readme)