TopRank Skills

Official OpenClaw rules 36%

xtquant

XtQuant Python SDK for QMT/miniQMT — market data (xtdata) and trading (xttrade) interface for Chinese securities.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 xtquant 技能。 若已安装,则直接安装 xtquant 技能。

Overview

Skill Key
coderwpf/xtquant
Author
coderwpf
Source Repo
openclaw/skills
Version
1.0.0
Source Path
skills/coderwpf/xtquant
Latest Commit SHA
e1e1d5b63c4ad216932a86ef9cd421855608c3a8

Extracted Content

SKILL.md excerpt

# XtQuant (迅投QMT Python SDK)

XtQuant is the Python SDK for [QMT/miniQMT](http://www.thinktrader.net) quantitative trading platform by 迅投科技. It consists of two core modules:

- **xtdata** — Market data (行情模块): real-time quotes, historical K-lines, tick data, Level2 data, financial data
- **xttrade** — Trading (交易模块): order placement, position/order queries, account management

> ⚠️ **Requires miniQMT or QMT client running locally**. XtQuant connects to the local QMT process via TCP. You need a broker account with QMT/miniQMT access enabled.

## Install

```bash
pip install xtquant
```

Or download from: http://dict.thinktrader.net/nativeApi/download_xtquant.html

## Architecture

```
Your Python Script
    ↓ (xtquant SDK)
    ├── xtdata  → miniQMT (market data server)
    └── xttrade → miniQMT (trading server)
         ↓
    Broker Trading System
```

## Quick start — Market data

```python
from xtquant import xtdata

# Connect to miniQMT (default localhost)
xtdata.connect()

# Download historical K-line
xtdata.download_history_data('000001.SZ', '1d', start_time='20240101', end_time='20240630')

# Get local K-line data
data = xtdata.get_market_data_ex([], ['000001.SZ'], period='1d', start_time='20240101', end_time='20240630')
print(data['000001.SZ'])
```

## Quick start — Trading

```python
from xtquant import xttrader
from xtquant.xttrader import XtQuantTrader
from xtquant.xttype import StockAccount

# Create trader instance
path = r'D:\国金证券QMT交易端\userdata_mini'  # miniQMT userdata path
session_id = 123456
xt_trader = XtQuantTrader(path, session_id)

# Connect and start
xt_trader.start()

# Create account
account = StockAccount('your_account_id')

# Place order: buy 100 shares of 000001.SZ
order_id = xt_trader.order_stock(account, '000001.SZ', xtconstant.STOCK_BUY, 100, xtconstant.FIX_PRICE, 11.5)

# Query positions
positions = xt_trader.query_stock_positions(account)
for pos in positions:
    print(pos.stock_code, pos.volume, pos.market_value)...

Related Claw Skills