实现基于qmt智能交易终端的A股交易数据本地化

v1.0.1

基于QMT量化交易平台,支持自然语言指令下载并实时网页监控A股多周期历史行情数据,含智能错误处理和任务控制。

0· 192·0 current·0 all-time
byvillage_dog@diudiuhuang

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for diudiuhuang/stock-qdata.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "实现基于qmt智能交易终端的A股交易数据本地化" (diudiuhuang/stock-qdata) from ClawHub.
Skill page: https://clawhub.ai/diudiuhuang/stock-qdata
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install stock-qdata

ClawHub CLI

Package manager switcher

npx clawhub@latest install stock-qdata
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description (download A‑share history via QMT) align with the code and instructions: it reads/writes CSVs, requires a local QMT installation, starts/checks QMT, and provides a local web UI for monitoring. No unexpected cloud API keys or unrelated services are requested.
Instruction Scope
SKILL.md instructs pip installing requirements and running main.py (natural-language or CLI). The runtime instructions and code legitimately access local config.json, create data directories, read stock_list.csv/index_list.csv, and start a local Flask/Socket.IO server. These actions are within the stated purpose. Note: the web UI may fetch fallback assets from public CDNs if local static assets fail.
Install Mechanism
No automated install spec; this is an instruction+code bundle. Dependencies are standard Python packages (flask, flask-socketio, pandas, psutil) listed in requirements.txt. No external arbitrary binary downloads are performed by the skill itself.
Credentials
The skill does not request environment variables or external credentials. It uses a local config.json (base_path, qmt_path) to operate; these are appropriate for filesystem and QMT access required by the described functionality.
Persistence & Privilege
always:false and user-invocable:true (normal). The skill writes/updates its own config.json and creates data directories under base_path — expected for a local data downloader. It also launches/monitors local processes (QMT) and can forcibly exit the process (os._exit) on idle; these are operational choices rather than covert privilege escalation but warrant attention.
Assessment
Before installing/running: 1) Confirm you have a legitimate local QMT installation and set qmt_path in config.json correctly; the skill will try to start/check the QMT executable. 2) Review and set base_path to a safe directory — the skill will create folders and write many CSV files. 3) The web UI runs a local Flask/Socket.IO server (ports ~5018–5038) and, if local static files are missing, will load Bootstrap/Font Awesome from public CDNs (your browser will contact those CDNs). If you require full offline operation, ensure the provided static assets are present. 4) The code uses subprocess/psutil to inspect and launch local processes and may call os._exit to terminate the server on idle; run it in a controlled environment you trust. 5) The package has some duplicated/sloppy code (e.g., duplicate start_qmt definitions) — consider reviewing the code or running in a sandbox before using on sensitive systems.

Like a lobster shell, security has layers — review code before you run it.

latestvk9754p5qqdggy9c6z1sy3te91183zd7q
192downloads
0stars
2versions
Updated 3w ago
v1.0.1
MIT-0

###技术支持:微信名quant_village_dog | QQ:13620658 ###技术社区:QQ群:1057968391 ,自行下载因clawhub限制无法上传的资源文件 ---

name: stock-qdata description: "下载A股历史行情数据(基于QMT量化交易平台),支持自然语言指令和网页实时监控界面" Use when: 用户需要获取A股交易数据。

When to Run

  • 触发条件1:用户说“下载日线数据,最近200天,使用网页监控模式”
  • 触发条件2:用户说“下载30分钟线数据,最近100天,每批30个,后台模式”
  • 触发条件3:用户说 “下载5分钟线,500天,每批50,网页"
  • 触发条件3:用户说“下载交易数据”
  • 触发条件4:用户说“获取历史数据”
  • 触发条件5:用户说“下载历史数据”

股票数据下载技能 (Stock-QData)

基于QMT量化交易平台,下载A股历史行情数据,支持日线、30分钟线、5分钟线、1分钟线等多种周期。

功能特性

  • 自然语言指令:支持中文自然语言描述下载任务
  • 网页监控界面:实时显示下载进度、速度、错误信息
  • 多种数据周期:支持1d(日线)、30m、5m、1m等周期
  • 智能错误处理:自动重试失败股票,记录错误日志
  • 实时状态更新:每2秒自动更新进度,Socket.IO实时通信
  • 暂停/恢复:支持暂停和恢复下载任务

系统要求

  1. QMT量化交易平台:必须安装并配置好QMT
  2. Python环境:Python 3.7+—3.12,安装必要依赖
  3. 网络连接:需要连接QMT服务器下载数据

安装依赖

pip install -r requirements.txt

使用方法

1. 自然语言指令模式

# 下载日线数据,最近200天,使用网页监控模式
python main.py "下载日线数据,最近200天,使用网页模式"

# 后台下载30分钟线数据,最近100天,每批30个
python main.py "后台下载30分钟线数据,最近100天,每批30个"

# 下载5分钟线,500天,每批50,网页监控
python main.py "下载5分钟线,500天,每批50,网页"

2. 命令行参数模式

# 网页监控模式(默认)
python main.py --period=1d --days=200 --mode=web

# 纯后台模式
python main.py --period=30m --days=100 --batch_size=30 --mode=background

3. 参数说明

参数说明默认值可选值
period数据周期1d1d(日线), 30m, 5m, 1m
days回溯天数5001-9999
batch_size每批处理数量501-1000
mode运行模式webweb(网页监控), background(纯后台)

配置文件

config.json 包含基本配置:

{
  "base_path": "d:\\data\\",        // 数据保存路径
  "qmt_path": "D:\\QMT\\bin.x64",   // QMT安装路径
  "batch_size": 50,                 // 默认批次大小
  "download_days": 500,             // 默认下载天数
  "download_period": "1d",          // 默认数据周期
  "host": "127.0.0.1",             // Web服务器主机
  "port": 5000                      // Web服务器端口
}

网页监控界面

启动网页模式后,访问 http://127.0.0.1:5018(端口可能自动调整)打开监控界面:

  • 实时进度:显示总体进度、处理速度、预计完成时间
  • 股票列表:显示正在处理和已完成的股票
  • 错误日志:显示下载过程中出现的错误和警告
  • 控制按钮:开始、暂停、恢复、停止下载任务
  • 参数调整:可在界面上调整批次大小

数据存储

数据按以下结构保存:

{base_path}/
  └── k_data/
      └── {period}/
          ├── 000001.SZ.csv
          ├── 000002.SZ.csv
          └── ...

注意事项

  1. QMT要求:必须正确安装QMT,且qmt_path配置正确
  2. 首次使用:需要登录QMT客户端并保持运行
  3. 网络连接:下载过程需要稳定的网络连接
  4. 磁盘空间:确保数据保存路径有足够空间
  5. 自动超时:网页界面5分钟无操作会自动关闭服务器

故障排除

  • QMT未启动:系统会自动尝试启动QMT,如失败请手动启动
  • 端口冲突:系统会自动寻找可用端口(5018-5038)
  • 字体缺失:字体文件已包含在技能包中,无需额外下载
  • 依赖缺失:运行 pip install -r requirements.txt 安装所有依赖

Comments

Loading comments...