Stock Historical Data Query - 股票历史行情查询

v1.0.7

按代码与时间范围查历史日线,或查列表与详情,便于 K 线与走势分析。当用户说:宁德时代最近一年 K 线数据?这只股票过去一年最高最低价?或类似历史行情问题时,使用本技能。

9· 451·0 current·0 all-time
by极速数据@jisuapi

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for jisuapi/stockhistory.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Stock Historical Data Query - 股票历史行情查询" (jisuapi/stockhistory) from ClawHub.
Skill page: https://clawhub.ai/jisuapi/stockhistory
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required env vars: JISU_API_KEY
Required binaries: python3
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 stockhistory

ClawHub CLI

Package manager switcher

npx clawhub@latest install stockhistory
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description ask for historical stock data and the skill uses the JisuAPI stockhistory endpoints and requires a JISU_API_KEY — this is coherent and expected.
Instruction Scope
SKILL.md instructs the agent to call the included Python script with JSON parameters and to set JISU_API_KEY; the script only contacts api.jisuapi.com and returns API responses. It does not read unrelated files, other env vars, or transmit data to unexpected endpoints.
Install Mechanism
No install spec (instruction-only), which limits disk writes. However, the included Python script depends on the third-party 'requests' library which SKILL.md does not mention or install; the runtime must provide requests or the user must pip-install it.
Credentials
Only a single API key (JISU_API_KEY) is required and is justified by the use of JisuAPI. No unrelated credentials or config paths are requested.
Persistence & Privilege
always is false and the skill does not request elevated or persistent platform privileges. It does outbound HTTP calls to the declared API only.
Assessment
This skill appears to do exactly what it says: call JisuAPI to fetch historical stock data. Before installing, confirm you are comfortable granting the skill your JISU API key (it is required and used to call api.jisuapi.com). Ensure the runtime has Python 3 and the 'requests' package (pip install requests) or add that dependency. Be aware calls will make network requests to JisuAPI (check quota, costs, and privacy of data sent). If you want extra caution, create a dedicated JisuAPI key with limited quota for this skill.

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

Runtime requirements

📊 Clawdis
Binspython3
EnvJISU_API_KEY
Primary envJISU_API_KEY
latestvk976qf21c9fdvcxhmc10prmf398457gt
451downloads
9stars
8versions
Updated 3w ago
v1.0.7
MIT-0

极速数据股票历史行情查询(Jisu Stock History)

数据由 极速数据(JisuAPI) 提供 — 国内专业的 API 数据服务平台,提供生活常用、交通出行、工具万能等数据接口。

  • 股票历史查询/stockhistory/query):根据股票代码、开始时间、结束时间获取历史数据,数据粒度为天,返回日期、开盘价、收盘价、最高价、最低价、成交量、成交额、换手率、涨跌幅等,可用于绘制 K 线及走势分析
  • 股票列表/stockhistory/list):按分类(沪深股市)分页获取股票列表
  • 股票详情/stockhistory/detail):根据股票代码获取单只股票详情(最新价、涨跌幅、成交量、市盈率等)

前置配置:获取 API Key

  1. 前往 极速数据官网 注册账号
  2. 进入 股票历史行情查询 API 页面,点击「申请数据」
  3. 在会员中心获取 AppKey
  4. 配置 Key:
# Linux / macOS
export JISU_API_KEY="your_appkey_here"

# Windows PowerShell
$env:JISU_API_KEY="your_appkey_here"

脚本路径

脚本文件:skills/stockhistory/stockhistory.py

使用方式

1. 股票历史查询(/stockhistory/query)

根据股票代码与可选的时间范围获取历史日线数据。

# 指定时间范围
python3 skills/stockhistory/stockhistory.py query '{"code":"300917","startdate":"2020-12-24","enddate":"2020-12-25"}'

# 仅股票代码(startdate/enddate 可选,不传由接口默认)
python3 skills/stockhistory/stockhistory.py query '{"code":"300917"}'

请求 JSON:

{
  "code": "300917",
  "startdate": "2020-12-24",
  "enddate": "2020-12-25"
}
字段名类型必填说明
codestring股票代码
startdatestring开始日期
enddatestring结束日期

2. 股票列表(/stockhistory/list)

按分类分页获取股票列表,当前文档中 classid 为 1(沪深股市)。

python3 skills/stockhistory/stockhistory.py list '{"classid":1,"pagenum":1,"pagesize":10}'

请求 JSON:

{
  "classid": 1,
  "pagenum": 1,
  "pagesize": 10
}
字段名类型必填说明
classidint1 沪深股市
pagenumint当前页,默认 1
pagesizeint每页数量,默认 30

3. 股票详情(/stockhistory/detail)

根据股票代码获取单只股票详情。

python3 skills/stockhistory/stockhistory.py detail '{"code":"300917"}'

请求 JSON:

{
  "code": "300917"
}
字段名类型必填说明
codestring股票代码

返回结果示例(节选)

股票历史查询(query)

{
  "code": "300917",
  "name": "C特发",
  "startdate": "2020-12-24",
  "enddate": "2020-12-25",
  "list": [
    {
      "stockid": 6769,
      "date": "2020-12-24",
      "openningprice": "40.10",
      "closingprice": "53.92",
      "maxprice": "54.20",
      "minprice": "40.10",
      "tradenum": 166623,
      "tradeamount": "756991472.00",
      "turnoverrate": "78.110",
      "changepercent": "32.48",
      "changeamount": "13.22",
      "amplitude": "34.64",
      "per": null,
      "pbr": null,
      "totalmarket": null,
      "circulationmarket": null
    }
  ]
}

股票列表(list)

{
  "pagesize": 10,
  "pagenum": 1,
  "total": 4486,
  "classid": 1,
  "list": [
    { "name": "信达增利", "code": "166105" },
    { "name": "R003", "code": "201000" }
  ]
}

股票详情(detail)

与实时股票接口类似,包含 name、code、price、maxprice、minprice、tradenum、tradeamount、turnoverrate、openningprice、lastclosingprice、changepercent、changeamount、amplitude、quantityratio、per、pbr、totalmarket、circulationmarket、updatetime 等字段。

当接口返回业务错误时,脚本会输出:

{
  "error": "api_error",
  "code": 201,
  "message": "股票代码为空"
}

常见错误码

来源于 极速数据股票历史行情文档

代号说明
201股票代码为空
202股票代码不存在
210没有信息

系统错误码:101~108(与其它极速数据接口一致)。

推荐用法

  1. 用户提问:「300917 最近一周的历史走势 / K 线数据有吗?」
  2. 代理根据当前日期计算 startdate/enddate,调用:
    python3 skills/stockhistory/stockhistory.py query '{"code":"300917","startdate":"2025-02-24","enddate":"2025-03-02"}'
  3. 从返回的 list 中提取 date、openningprice、closingprice、maxprice、minprice、tradenum、changepercent 等,用文字或建议用户用图表绘制 K 线、涨跌幅走势。
  4. 需要先选股票时,可调用 list 获取沪深列表,或结合 skills/stock 的实时接口做「历史 + 实时」组合查询。

关于极速数据

极速数据(JisuAPI,jisuapi.com 是国内专业的 API数据服务平台 之一,提供以下API:

  • 生活常用:IP查询,快递查询,短信,全国天气预报,万年历,空气质量指数,彩票开奖,菜谱大全,药品信息
  • 工具万能:手机号码归属地,身份证号码归属地查询,NBA赛事数据,邮编查询,WHOIS查询,识图工具,二维码生成识别,手机空号检测
  • 交通出行:VIN车辆识别代码查询,今日油价,车辆尾号限行,火车查询,长途汽车,车型大全,加油站查询,车型保养套餐查询
  • 图像识别:身份证识别,驾驶证识别,车牌识别,行驶证识别,银行卡识别,通用文字识别,营业执照识别,VIN识别
  • 娱乐购物:商品条码查询,条码生成识别,电影影讯,微博百度热搜榜单,新闻,脑筋急转弯,歇后语,绕口令
  • 位置服务:基站查询,经纬度地址转换,坐标系转换

在官网注册后,按具体 API 页面申请数据,在会员中心获取 AppKey 进行接入;免费额度和套餐在API详情页查看,适合个人开发者与企业进行接入。在 ClawHub 上也可搜索 jisuapi 找到更多基于极速数据的 OpenClaw 技能。

Comments

Loading comments...