Qmt Strategy logo

Qmt Strategy

Organization
lzwme
qmt-strategy

QMT 客户端(迅投极速策略交易系统)内置 Python 策略引擎开发指南,涵盖策略编写、回测、实盘交易、内置 API 参考与代码示例(基于 ContextInfo/passorder/get_trade_detail_data 等,非 xtquant 库)。当用户需要在 QMT 客户端中编写/回测/运行策略、查询 QMT 内置 API、从聚宽迁移至 QMT,或提及 QMT 策略、迅投策略、QMT 回测时使用。若需用外部 Python 程序通过 xtquant 库连接 QMT 获取行情或下单,请改用 miniqmt 技能。

Overview

Publisherlzwme
Repositoryfinance-quant-skills
Skill nameqmt-strategy
Stars
461
Forks
85
Bundled files
35
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 35 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by lzwme on GitHub. Read the source before you install it.

Installation

Install the Qmt Strategy AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/lzwme/finance-quant-skills/tree/main/skills/qmt-strategy
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lzwme/finance-quant-skills.git /tmp/finance-quant-skills
mkdir -p .claude/skills
cp -r /tmp/finance-quant-skills/skills/qmt-strategy .claude/skills/qmt-strategy
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Qmt Strategy in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Qmt Strategy on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Qmt Strategy is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

QMT Python 策略开发知识库

为 QMT(迅投极速策略交易系统)提供完整的 Python 开发参考,分为教程指南和 API 参考两层。

与 miniqmt 的区别:本技能面向 QMT 客户端内置策略引擎——策略在 QMT 客户端内运行,使用内置 API(ContextInfo/C、passorder、get_market_data_ex、get_trade_detail_data 等),文件首行需 #coding:gbk。若需在外部 Python 程序中通过 xtquant 库(xtdata/xttrader)连接 QMT/MiniQMT 客户端获取行情或下单,请使用 miniqmt 技能。

📖 文档结构

教程/指南(实践导向)
├── overview.md              系统概述、模式选择、入门路径
├── execution-mechanisms.md  三种运行机制详解(含流程图和代码模板)
├── backtesting-guide.md     回测完整流程(数据准备→参数设置→运行→分析)
├── live-trading-guide.md    实盘交易指南(账号配置→委托管理→风险控制)
├── quick-reference.md       ★ 常用 API 速查卡片
├── best-practices.md        编码规范、性能优化、风险管理、调试技巧
├── joinquant-migration.md   聚宽策略迁移至 QMT 指南
└── examples/                代码示例(backtest / live-trading / subscribe / run-time)

API 参考(官方完整文档)
└── python-innerApi/
    ├── start_now.md          快速开始(回测/实盘概览 + 三种机制示例)
    ├── data_function.md      行情与数据函数(get_market_data_ex 等完整参数)
    ├── trading_function.md   交易函数(passorder、get_trade_detail_data 等)
    ├── system_function.md    系统函数(ContextInfo 方法、定时器等)
    ├── callback_function.md  回调函数(account/order/deal/position 主推)
    ├── quote_function.md     引用函数(扩展数据、因子、VBA调用)
    ├── drawing_function.md   绘图函数
    ├── interface_operation.md 界面操作说明
    ├── data_structure.md     数据结构定义(Bar/Tick/Order/Position 等对象字段)
    ├── enum_constants.md     枚举常量(opType、orderType、委托状态等)
    ├── variable_convention.md 变量约定
    ├── code_examples.md      完整代码示例合集
    ├── user_attention.md     用户注意事项
    └── question_answer.md    常见问题

数据字典
└── dict/                    各品种数据字段(stock / indexes / future / option 等)

🚀 使用引导

按场景选择入口

场景首先阅读然后查阅
新手入门overview.md → execution-mechanisms.mdquick-reference.md
编写回测策略backtesting-guide.mdexamples/backtest.md
编写实盘策略live-trading-guide.mdexamples/live-trading.md
查询 API 用法quick-reference.md(速查)python-innerApi/data_function.md 等(完整参数)
从聚宽迁移joinquant-migration.mdoverview.md
代码质量优化best-practices.mdexamples/
数据结构查询python-innerApi/data_structure.mdpython-innerApi/enum_constants.md

快速查找路径

需要看函数怎么用?
  → quick-reference.md(常用函数精简版)
  → python-innerApi/data_function.md(数据获取类完整文档)
  → python-innerApi/trading_function.md(交易类完整文档)
  → python-innerApi/system_function.md(系统/ContextInfo 方法)

需要看完整代码?
  → python-innerApi/code_examples.md(官方示例合集)
  → examples/(精选示例)

需要查字段含义?
  → python-innerApi/data_structure.md(数据结构定义)
  → dict/(各品种数据字典)

遇到报错/问题?
  → python-innerApi/question_answer.md(官方FAQ)
  → python-innerApi/user_attention.md(注意事项)

🔧 关键速查

编码规范

python
#coding:gbk  # 必须在文件第一行

核心概念

概念说明
handlebarK线驱动(回测推荐)
subscribe事件驱动(仅实盘,高频)
run_time定时触发(监控场景)
quicktrade=0等待K线完成再下单(逐K线模式)
quicktrade=2立即下单(不需要等待)
最小单位100 股

最常用代码

python
# 获取历史行情数据(回测用 subscribe=False,实盘用 subscribe=True)
data = C.get_market_data_ex(['close'], [stock], end_time=bar_date,
                              period='1d', count=100, subscribe=False)
close_list = list(data[stock].iloc[:, 0])

# 获取全推实时行情
tick = C.get_full_tick(['600000.SH'])
price = tick['600000.SH']['lastPrice']

# 下单买入(23=买入, 1101=按股数, quicktrade=0 逐K线模式)
passorder(23, 1101, account, stock, 5, -1, 100, C)

# 下单买入(quicktrade=2 立即下单模式)
passorder(23, 1101, account, stock, 5, -1, 100, '策略名', 2, '备注', C)

# 查询持仓
holds = get_trade_detail_data(account, 'stock', 'position')
holds_dict = {f'{p.m_strInstrumentID}.{p.m_strExchangeID}': p.m_nVolume for p in holds}

# 查询账户可用资金(单位:分)
cash = get_trade_detail_data(account, 'stock', 'account')[0].m_dAvailable

⚠️ 使用注意事项

  1. 编码声明:文件首行必须是 #coding:gbk,不可省略
  2. 位置参数:get_market_data_ex 的前两个参数 fields 和 stocks 必须用位置参数,不能用 fields= 或 stocks=
  3. subscribe 参数:回测必须 False,实盘使用 True
  4. 账号类型:get_trade_detail_data 的第二个参数:股票用 'stock',两融用 'credit'
  5. 金额单位:m_dAvailable 等金额字段单位是分,需 /100 转换为元
  6. 数量单位:股票交易必须是 100 的整数倍
  7. 实盘限制:subscribe 和 run_time 仅支持实盘,不支持回测

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Qmt Strategy AI skill do?

QMT 客户端(迅投极速策略交易系统)内置 Python 策略引擎开发指南,涵盖策略编写、回测、实盘交易、内置 API 参考与代码示例(基于 ContextInfo/passorder/get_trade_detail_data 等,非 xtquant 库)。当用户需要在 QMT 客户端中编写/回测/运行策略、查询 QMT 内置 API、从聚宽迁移至 QMT,或提及 QMT 策略、迅投策略、QMT 回测时使用。若需用外部 Python 程序通过 xtquant 库连接 QMT 获取行情或下单,请改用 miniqmt 技能。

Why use Qmt Strategy on TypingMind?

Because you install it once and use it with any model. Qmt Strategy is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Qmt Strategy in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/lzwme/finance-quant-skills/tree/main/skills/qmt-strategy. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Qmt Strategy?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Qmt Strategy?

As many as you like. As long as a model supports skills, you can use Qmt Strategy with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Qmt Strategy AI skill free?

It is published on GitHub by lzwme. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇