From quant-skills
Connects to MiniQMT via XtQuant for A-share/futures/options market data (K-line, tick, financials) and trading (order, cancel, query assets/positions). Use when users need real-time quotes, backtest data, or programmatic trading through MiniQMT.
How this skill is triggered — by the user, by Claude, or both
Slash command
/quant-skills:miniqmtThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- 本 Skill 用于:通过 XtQuant 库连接 MiniQMT 客户端,获取 A 股/期货/期权行情数据,执行量化交易操作
references/changelog.mdreferences/code_examples.mdreferences/download_xtquant.mdreferences/question_function.mdreferences/start_now.mdreferences/xtdata.mdreferences/xtdata_dict.mdreferences/xttrader.mdscripts/__init__.pyscripts/financial_data.pyscripts/market_data.pyscripts/sector_data.pyscripts/trade.pypip install xtquantuserdata_mini 路径用于 xttrader 连接QMT安装目录\
├── bin.x64\XtMiniQmt.exe # MiniQMT 主程序
├── userdata_mini\ # 用户数据目录(xttrader 连接路径)
│ ├── xqtrader.ini # 交易配置
│ └── xtdatacenter.ini # 行情配置
600000.SH(上海)、000001.SZ(深圳)rb2405.SF(螺纹钢)510050.SH(上证50ETF期权)| 周期 | 说明 | 周期 | 说明 |
|---|---|---|---|
tick | 分笔数据 | 1q | 季度线 |
1m | 1分钟线 | 1hy | 半年线 |
5m | 5分钟线 | 1y | 年线 |
15m | 15分钟线 | 1w | 周线 |
30m | 30分钟线 | 1d | 日线 |
1h | 1小时线 | 1mon | 月线 |
none - 不复权front - 前复权back - 后复权front_ratio - 等比前复权back_ratio - 等比后复权| 市场 | 常量 | 市场 | 常量 |
|---|---|---|---|
| 上海 | 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 |
| 类型 | 常量 | 类型 | 常量 |
|---|---|---|---|
| 股票 | xtconstant.SECURITY_ACCOUNT | 沪港通 | xtconstant.HUGANGTONG_ACCOUNT |
| 期货 | xtconstant.FUTURE_ACCOUNT | 深港通 | xtconstant.SHENGANGTONG_ACCOUNT |
| 信用 | xtconstant.CREDIT_ACCOUNT | 期货期权 | xtconstant.FUTURE_OPTION_ACCOUNT |
| 股票期权 | xtconstant.STOCK_OPTION_ACCOUNT | - | - |
| 用户提问 | 对应功能 | 调用方式 |
|---|---|---|
| "贵州茅台实时股价" | 实时行情快照 | 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 |
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()
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'
)
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}")
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.SHpython scripts/market_data.py kline --code 600519.SH --period 1d --count 100python scripts/market_data.py tick --code 600519.SH --count 100python scripts/market_data.py full_tick --codes 600519.SH,000001.SZpython scripts/sector_data.py sector_listpython scripts/sector_data.py sector_stocks --sector 半导体python scripts/financial_data.py financial --code 600519.SH --tables Balance,Incomepython scripts/trade.py order --code 600519.SH --type buy --volume 100 --price 1800.0python scripts/trade.py cancel --order_id 12345python scripts/trade.py positionspython scripts/trade.py orderspython scripts/trade.py assetpython scripts/trade.py tradesuserdata_mini 路径正确,否则连接会失败download_history_data2 下载'20240101' 或 '20240101000000''FUTURE'get_market_data 批量获取npx claudepluginhub lzwme/finance-quant-skills --plugin quant-skillsOperates miniQMT/xtquant via CLI for market data, real-time streaming, account management, order placement with safety guards, daemon health checks, SSH tunnel management, and Windows deployment.
Complete guide to QMT (迅投) Python quantitative strategy development. Includes backtesting, live trading, API reference, and migration from JoinQuant (聚宽).
Trades Taiwan markets (TWSE/TPEX/TAIFEX) via Shioaji's Python binding, CLI, or HTTP API with SSE streaming. Handles orders, real-time quotes, account data, and multi-language HTTP clients.