Back to Registry
View Author Profile
Official Verified
qmt
QMT迅投量化交易终端 - 内置Python策略开发、回测引擎和实盘交易,支持中国证券市场全品种。
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/coderwpf/qmtOr
QMT(迅投量化交易终端)
QMT(Quant Market Trading)是迅投科技开发的专业量化交易平台。提供完整的桌面客户端,内置Python策略开发、回测引擎和实盘交易功能,支持中国证券市场全品种。
⚠️ 需要通过券商开通QMT权限。QMT仅在Windows上运行。可通过国金、华鑫、中泰、东方财富等券商获取。
两种运行模式
| 模式 | 说明 |
|---|---|
| QMT(完整版) | 完整桌面GUI,内置Python编辑器、图表和回测引擎 |
| miniQMT | 极简模式 — 通过外部Python使用xtquant SDK(参见 miniqmt skill) |
内置Python策略框架
QMT提供事件驱动策略框架,内置Python运行时(类似聚宽/米筐)。
策略生命周期
def init(ContextInfo):
"""初始化函数 - 策略启动时调用一次,用于设置股票池和参数"""
ContextInfo.set_universe(['000001.SZ', '600519.SH'])
def handlebar(ContextInfo):
"""K线处理函数 - 每根K线触发一次(tick/1m/5m/1d等),在此编写交易逻辑"""
close = ContextInfo.get_market_data(['close'], stock_code='000001.SZ', period='1d', count=20)
# 在此编写交易逻辑
def stop(ContextInfo):
"""停止函数 - 策略停止时调用"""
pass
获取行情数据(内置)
def handlebar(ContextInfo):
# 获取最近20根K线的收盘价
data = ContextInfo.get_market_data(
['open', 'high', 'low', 'close', 'volume'],
stock_code='000001.SZ',
period='1d',
count=20
)
# 获取历史数据
history = ContextInfo.get_history_data(
20, '1d', 'close', stock_code='000001.SZ'
)
# 获取板块股票列表
stocks = ContextInfo.get_stock_list_in_sector('沪深A股')
# 获取财务数据
fin = ContextInfo.get_financial_data('000001.SZ')
下单(内置)
def handlebar(ContextInfo):
# 限价买入100股,价格11.50
order_shares('000001.SZ', 100, 'fix', 11.50, ContextInfo)
# 限价卖出100股,价格12.00
order_shares('000001.SZ', -100, 'fix', 12.00, ContextInfo)
# 按目标金额买入(10万元)
order_target_value('000001.SZ', 100000, 'fix', 11.50, ContextInfo)
# 撤单
cancel('order_id', ContextInfo)
查询持仓与账户
def handlebar(ContextInfo):
# 获取持仓信息
positions = get_trade_detail_data('your_account', 'stock', 'position')
for pos in positions:
print(pos.m_strInstrumentID, pos.m_nVolume, pos.m_dMarketValue)
# 获取委托信息
orders = get_trade_detail_data('your_account', 'stock', 'order')
# 获取账户资产信息
account = get_trade_detail_data('your_account', 'stock', 'account')
回测
QMT内置回测引擎:
- 在内置Python编辑器中编写策略
- 设置回测参数(日期范围、初始资金、手续费、滑点)
- 点击"运行回测"
- 查看结果:资金曲线、最大回撤、夏普比率、交易记录
回测参数设置
def init(ContextInfo):
ContextInfo.capital = 1000000 # 初始资金
ContextInfo.set_commission(0.0003) # 手续费率
ContextInfo.set_slippage(0.01) # 滑点
ContextInfo.set_benchmark('000300.SH') # 基准指数
完整示例:双均线策略
import numpy as np
def init(ContextInfo):
ContextInfo.stock = '000001.SZ'
ContextInfo.set_universe([ContextInfo.stock])
ContextInfo.fast = 5 # 快速均线周期
ContextInfo.slow = 20 # 慢速均线周期
def handlebar(ContextInfo):
stock = ContextInfo.stock
# 获取最近slow+1根K线的收盘价
closes = ContextInfo.get_history_data(ContextInfo.slow + 1, '1d', 'close', stock_code=stock)
if len(closes) < ContextInfo.slow:
return # 数据不足,跳过
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-coderwpf-qmt": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.
Related Skills
backtrader
Backtrader 开源量化回测框架 - 支持多数据源、多策略、多周期回测与实盘交易,纯Python实现。
coderwpf 3409
pywencai
同花顺问财自然语言数据查询工具 - 使用中文自然语言查询A股、指数、基金、港美股、可转债等市场数据。
coderwpf 3409
tqsdk
天勤量化TqSdk - 开源Python期货/期权交易SDK,提供实时行情、回测和实盘交易功能。
coderwpf 3409
rqalpha
RQAlpha 米筐开源事件驱动回测框架 - 支持A股和期货,模块化架构,可自由扩展。
coderwpf 3409
baostock
BaoStock 免费A股数据平台 - 支持K线、财务数据、行业分类查询,无需注册即可使用。
coderwpf 3409