MCPInstall
lzwme avatar

miniqmt

MiniQMT 迅投量化交易接口,基于 XtQuant Python 库(xtdata 行情 / xttrader 交易),供外部 Python 程序连接 MiniQMT 客户端,支持 A 股/期货/期权的行情获取(K线、分笔、财务数据等)和交易下单(报单、撤单、查询资产/委托/持仓)。当用户提及 miniqmt、xtquant、获取实时行情、量化交易下单、回测数据获取,或需要用外部 Python 程序连接 MiniQMT 客户端进行程序化交易时使用。若需在 QMT 客户端内编写/回测内置策略(ContextInfo/passorder),请用 qmt-strategy 技能。

Installs
226
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/lzwme/finance-quant-skills --skill miniqmt
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads miniqmt automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

MiniQMT 量化交易技能

任务目标

  • 本 Skill 用于:通过 XtQuant 库连接 MiniQMT 客户端,获取 A 股/期货/期权行情数据,执行量化交易操作
  • 能力包含:
    • 行情模块 (xtdata):K线数据、分笔数据、实时行情订阅、财务数据、板块分类、ETF信息、新股申购、交易日历
    • 交易模块 (xttrader):股票/期货/期权下单、撤单、查询资产/委托/持仓、资金划拨、信用交易、约券
  • 触发条件:用户提及 miniqmt、xtquant、获取行情、量化交易、下单交易时使用

与 qmt-strategy 的区别:本技能通过 xtquant 库在外部 Python 程序中连接 MiniQMT 客户端(xtdata 行情 / xttrader 交易);若需在 QMT 客户端内编写内置策略(ContextInfo/passorder、#coding:gbk),请使用 qmt-strategy 技能。

前置准备

MiniQMT 环境要求

  • 客户端安装:需安装迅投极速交易终端,并启动 MiniQMT(支持模拟/实盘)
  • Python 库:pip install xtquant
  • 路径配置:MiniQMT 安装目录下的 userdata_mini 路径用于 xttrader 连接

目录结构

QMT安装目录\
├── bin.x64\XtMiniQmt.exe # MiniQMT 主程序
├── userdata_mini\        # 用户数据目录(xttrader 连接路径)
│   ├── xqtrader.ini      # 交易配置
│   └── xtdatacenter.ini  # 行情配置

核心概念

证券代码格式

  • 股票:6位数字 + 市场后缀,如 600000.SH(上海)、000001.SZ(深圳)
  • 期货:品种代码 + 合约月份,如 rb2405.SF(螺纹钢)
  • 期权:标的代码 + 行权月份,如 510050.SH(上证50ETF期权)

周期类型 (period)

周期说明周期说明
tick分笔数据1q季度线
1m1分钟线1hy半年线
5m5分钟线1y年线
15m15分钟线1w周线
30m30分钟线1d日线
1h1小时线1mon月线

复权类型 (dividend_type)

  • none - 不复权
  • front - 前复权
  • back - 后复权
  • front_ratio - 等比前复权
  • back_ratio - 等比后复权

交易市场 (market)

市场常量市场常量
上海xtconstant.SH_MARKET中金所xtconstant.MARKET_ENUM_INDEX_FUTURE
深圳xtconstant.SZ_MARKET上期所xtconstant.MARKET_ENUM_SHANGHAI_FUTURE
北交所xtconstant.MARKET_ENUM_BEIJING郑商所xtconstant.MARKET_ENUM_ZHENGZHOU_FUTURE
大商所xtconstant.MARKET_ENUM_DALIANG_FUTURE广期所xtconstant.MARKET_ENUM_GUANGZHOU_FUTURE

账号类型 (account_type)

类型常量类型常量
股票xtconstant.SECURITY_ACCOUNT沪港通xtconstant.HUGANGTONG_ACCOUNT
期货xtconstant.FUTURE_ACCOUNT深港通xtconstant.SHENGANGTONG_ACCOUNT
信用xtconstant.CREDIT_ACCOUNT期货期权xtconstant.FUTURE_OPTION_ACCOUNT
股票期权xtconstant.STOCK_OPTION_ACCOUNT--

操作步骤

  1. 确定需求 — 识别是行情数据获取还是交易操作
  2. 选择模块 — xtdata 用于行情,xttrader 用于交易
  3. 调用脚本 — 根据数据类型选择对应脚本
  4. 解析结果 — 智能体分析返回的 JSON 格式数据

意图识别映射示例

用户提问对应功能调用方式
"贵州茅台实时股价"实时行情快照xtdata.get_full_tick
"平安银行K线数据"K线数据xtdata.get_market_data
"招商银行财务指标"财务报表xtdata.get_financial_data
"半导体板块成分股"板块成分股xtdata.get_stock_list_in_sector
"今日可转债信息"ETF/可转债数据xtdata.get_cb_info
"新股申购"新股信息xtdata.get_ipo_info
"下单买入平安银行"交易下单xttrader.order_stock
"查询持仓"持仓查询xttrader.query_stock_positions
"撤单"撤单操作xttrader.cancel_order_stock

使用示例

示例1:获取股票实时行情

import xtdata

# 获取全推行情快照
ticks = xtdata.get_full_tick(['600519.SH', '000001.SZ'])

# 订阅单股实时行情
def on_data(datas):
    for code in datas:
        print(code, datas[code])

xtdata.subscribe_quote('600519.SH', period='tick', callback=on_data)
xtdata.run()

示例2:获取K线历史数据

import xtdata

# 下载历史K线数据
xtdata.download_history_data2(['600519.SH'], period='1d', start_time='')

# 获取K线数据
data = xtdata.get_market_data(
    field_list=['open', 'high', 'low', 'close', 'volume'],
    stock_list=['600519.SH'],
    period='1d',
    start_time='20240101',
    end_time='',
    count=100,
    dividend_type='front'
)

示例3:交易下单

from xtquant.xttrader import XtQuantTrader, XtQuantTraderCallback
from xtquant.xttype import StockAccount
from xtquant import xtconstant

# 配置路径和会话
path = 'D:\\迅投极速交易终端\\userdata_mini'
session_id = 123456
xt_trader = XtQuantTrader(path, session_id)

# 创建账号对象
acc = StockAccount('1000000365')  # 替换为实际账号

# 连接交易
xt_trader.start()
connect_result = xt_trader.connect()
subscribe_result = xt_trader.subscribe(acc)

# 下单买入
order_id = xt_trader.order_stock(
    acc,
    '600519.SH',
    xtconstant.STOCK_BUY,
    100,  # 100股
    xtconstant.FIX_PRICE,
    1800.0,  # 价格
    'strategy1',
    'remark'
)

# 查询资产
asset = xt_trader.query_stock_asset(acc)
print(f"可用资金: {asset.cash}")

示例4:订阅行情并实时处理

import xtdata

def on_tick_data(datas):
    for code in datas:
        tick = datas[code]
        print(f"{code}: 现价={tick['lastPrice']}, 成交量={tick['volume']}")

# 订阅多只股票
xtdata.subscribe_whole_quote(['SH', 'SZ'], callback=on_tick_data)
xtdata.run()

资源索引

行情数据脚本

  • 行情快照:python scripts/market_data.py snapshot --code 600519.SH
  • K线数据:python scripts/market_data.py kline --code 600519.SH --period 1d --count 100
  • 分笔数据:python scripts/market_data.py tick --code 600519.SH --count 100
  • 实时行情:python scripts/market_data.py full_tick --codes 600519.SH,000001.SZ

板块与财务脚本

  • 板块列表:python scripts/sector_data.py sector_list
  • 板块成分股:python scripts/sector_data.py sector_stocks --sector 半导体
  • 财务数据:python scripts/financial_data.py financial --code 600519.SH --tables Balance,Income

交易脚本

  • 下单:python scripts/trade.py order --code 600519.SH --type buy --volume 100 --price 1800.0
  • 撤单:python scripts/trade.py cancel --order_id 12345
  • 查询持仓:python scripts/trade.py positions
  • 查询委托:python scripts/trade.py orders
  • 查询资产:python scripts/trade.py asset
  • 查询成交:python scripts/trade.py trades

参考文档

  • xtdata 行情模块 API(何时读取:需要查看行情数据接口时)
  • xtdata行情数据字段与数据字典 (何时读取:需要查看行情数据字段、数据字典时)
  • xttrader 交易模块 API(何时读取:需要查看交易接口、数据结构说明时)
  • 安装与下载指南(何时读取:首次安装 XtQuant 或遇到安装问题时)
  • 常见问题(何时读取:遇到常见问题时)
  • 代码示例(何时读取:需要参考完整代码示例时)
  • 更新日志(何时读取:查看版本更新历史时)

注意事项

环境要求

  • 必须运行 MiniQMT:xttrader 交易模块需要 MiniQMT 客户端在后台运行
  • 路径配置:确保 userdata_mini 路径正确,否则连接会失败
  • 行情订阅限制:单股订阅建议不超过 50 只,较多时建议使用全推数据

数据获取注意

  • 数据补下载:历史数据需先通过 download_history_data2 下载
  • 权限限制:Level2 数据需要终端有相应权限
  • 时间格式:K线时间参数格式为 '20240101' 或 '20240101000000'

交易注意

  • 账号格式:股票账号直接使用资金账号字符串,期货账号需指定 'FUTURE'
  • 委托数量:股票以"股"为单位,债券以"张"为单位,期货以"手"为单位
  • 订单编号:下单成功后返回正整数 order_id,-1 表示失败
  • 异步操作:交易操作支持同步/异步两种模式,异步模式需配合回调使用

性能优化

  • 批量请求:多只股票数据建议使用 get_market_data 批量获取
  • 缓存利用:已订阅的数据会自动缓存,无需重复订阅
  • 线程安全:xttrader 支持多策略,但需使用不同的 session_id

FAQ

What does the miniqmt skill do?

MiniQMT 迅投量化交易接口,基于 XtQuant Python 库(xtdata 行情 / xttrader 交易),供外部 Python 程序连接 MiniQMT 客户端,支持 A 股/期货/期权的行情获取(K线、分笔、财务数据等)和交易下单(报单、撤单、查询资产/委托/持仓)。当用户提及 miniqmt、xtquant、获取实时行情、量化交易下单、回测数据获取,或需要用外部 Python 程序连接 MiniQMT 客户端进行程序化交易时使用。若需在 QMT 客户端内编写/回测内置策略(ContextInfo/passorder),请用 qmt-strategy 技能。

How do I install miniqmt?

Run npx skills add https://github.com/lzwme/finance-quant-skills --skill miniqmt in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/miniqmt/ (personal) or .claude/skills/miniqmt/ (project).

Which AI agents can use miniqmt?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is miniqmt safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains miniqmt?

It is published by lzwme in lzwme/finance-quant-skills. It has 226 recorded installs.

More from lzwme/finance-quant-skills

View all →
lzwme avatar

pywencai

lzwme/finance-quant-skills

同花顺问财数据查询:使用中文自然语言查询A股、指数、基金、港美股、可转债等市场数据;当用户需要通过自然语言从问财获取选股、财务、资金流、技术指标等数据时使用。

Business & Finance299 installs
lzwme avatar

akshare

lzwme/finance-quant-skills

AKShare 开源金融数据接口库,提供股票、期货、期权、基金、外汇、债券、指数、加密货币等全品类金融数据;当用户需要获取各类金融市场数据时使用

Business & Finance280 installs
lzwme avatar

baostock

lzwme/finance-quant-skills

BaoStock 免费开源 A 股数据平台,无需注册、无需 API Key,支持股票行情、K线、财务数据、行业分类、指数成分股查询。当用户提及 baostock、需要获取A股历史行情、财务报表、交易日历,或需要免费、免注册的A股数据时使用。与 tushare(数据更全但需注册)和 jqdatasdk(聚宽数据)不同,baostock 完全免费无限制,适合快速入门和低成本数据需求。

Backend & APIs278 installs
lzwme avatar

tdxquant

lzwme/finance-quant-skills

通达信量化数据获取技能。当用户提及 tdxquant、通达信、TdxQuant、tqcenter,并且需要获取A股数据(行情快照、K线、财务、板块、可转债、新股、交易数据等)、查询交易日历、执行通达信公式、订阅行情、交易下单时使用

Business & Finance238 installs
lzwme avatar

backtrader

lzwme/finance-quant-skills

Backtrader 开源量化回测框架,支持多数据源、多策略、多周期回测与实盘交易,纯Python实现。当用户需要开发量化策略、进行回测分析、编写交易逻辑、回测参数优化,或提及 backtrader、量化回测框架时使用。若用户仅需数据获取而无回测需求,引导使用 baostock/akshare/tushare 等数据 Skill。

Business & Finance229 installs
lzwme avatar

rqalpha

lzwme/finance-quant-skills

RQAlpha 米筐开源事件驱动回测框架。支持A股和期货,模块化架构,可自由扩展;当用户需要快速回测A股/期货策略、使用内置数据(download-bundle)、开发Mod插件,或提及 rqalpha、米筐时使用。与 backtrader 相比,rqalpha 内置A股日线数据、安装更简便,适合快速验证;backtrader 更灵活、社区更大。若用户仅需数据获取而无回测需求,引导使用 baostock/akshare/tushare 等数据 Skill。

Business & Finance209 installs

Popular business & finance skills

View category →
flowkit-labs avatar

website-builder

flowkit-labs/skills

Build and preview a hosted website for a business from a plain-language brief. Use for a new business homepage, landing page, service showcase, portfolio, online store, or customer portal, and for updates to sites hosted by this builder. Add bookings, checkout, or member accounts as needed and automate reminders, customer follow-ups, and reports after launch. Follow the user's choice when they specify another host or ask to edit an existing codebase.

Business & Finance160.9K installs
autonnel avatar

sales-funnel-blueprint

autonnel/autonnel-skills

Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.

Business & Finance134.8K installs
coreyhaines31 avatar

sales-enablement

coreyhaines31/marketingskills

When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),

Business & Finance134.2K installs
coreyhaines31 avatar

revops

coreyhaines31/marketingskills

When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.

Business & Finance127.9K installs
coreyhaines31 avatar

pricing

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.

Business & Finance96.4K installs
coreyhaines31 avatar

offers

coreyhaines31/marketingskills

When the user wants to design, construct, or improve an offer — the thing they actually sell — including value framing, bonus stacking, guarantee design, scarcity/urgency, naming, and payment structure. Also use when the user mentions 'offer,' 'offer design,' 'build an offer,' 'grand slam offer,' 'irresistible offer,' 'value stack,' 'bonus stack,' 'guarantee,' 'risk reversal,' 'money-back guarantee,' 'scarcity,' 'urgency,' 'high-ticket offer,' 'productize a service,' 'naming an offer,' 'payment plan,' 'down-sell,' 'upsell offer,' or 'why isn't my offer converting.' Best for services, agencies, courses, coaching, info products, high-ticket B2B, and direct-response. If you run pure self-serve SaaS, read pricing first — tiers and packaging do more work there. For price level itself (tiers, freemium, value metric), see pricing. For the page that presents the offer, see copywriting. For the launch moment, see launch. For sales collateral, see sales-enablement.

Business & Finance74.2K installs