← Back to Skills Marketplace
shermanxli

Datayes Stock Data

by shermanxli · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
117
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install datayes-stock-data
Description
通过 Datayes 查询 A 股和港股的行情、分时、K 线、财务、估值、资金流向、股东持仓、分红和公司资料。用户询问个股价格、公司基本面、估值指标、资金流向、排行筛选、技术指标或其他需要实时股票数据的问题时使用。
README (SKILL.md)

Datayes Stock Data

使用 Datayes 接口回答股票与上市公司数据问题。通过仓库内的 Python 脚本发请求。

前提条件

1. 获取 Datayes Token

访问 https://r.datayes.com/auth/login 登录 Datayes 账号,并在 Datayes 控制台获取可撤销的 API token。

2. 配置 Token

先确认环境变量已配置:

macOS / Linux:

export DATAYES_TOKEN='your-token'

Windows PowerShell:

$env:DATAYES_TOKEN = "your-token"

Windows CMD:

set DATAYES_TOKEN=your-token

建议只使用最小权限、可随时撤销的 token,不要把 token 写入仓库。

使用脚本

脚本位置:scripts/datayes_api.py

python3 scripts/datayes_api.py market_snapshot --param ticker=002594 --param type=stock --result-only --pretty

脚本行为:

  • 自动从环境变量 DATAYES_TOKEN 读取 token。
  • 在所有请求头里携带 Authorization: Bearer \x3Ctoken>
  • 先请求 API 规格接口,再按返回的 httpUrlhttpMethod 和参数位置调用真实业务接口。
  • 真实业务接口的 httpUrl 会先校验主机名,只允许 Datayes 受信任域名,避免把 token 发送到非 Datayes 地址。
  • 调用前按规格校验参数名,并自动补齐有默认值的必填参数。
  • 支持 --result-only 只看业务结果,支持 --field 提取嵌套字段。
  • 默认输出 JSON,并同时包含规格信息和业务结果。

工作流

  1. 判断用户要查的是行情、财务、估值、资金流向、股东持仓还是公司资料。
  2. 如果只有公司名,没有股票代码,先调用 stock_search
  3. 先用 --spec-only 拉取最新 API 规格,确认必填参数、参数位置和请求方法。
  4. 再执行正式请求,必要时组合多个接口交叉验证。
  5. 读取返回字段后,用自然语言总结结果,并明确时间范围、单位和口径。

常用命令

只查规格:

python3 scripts/datayes_api.py market_snapshot --spec-only --pretty

查股票代码:

python3 scripts/datayes_api.py stock_search --param query=比亚迪 --result-only --pretty
python3 scripts/datayes_api.py stock_search --param query=比亚迪 --result-only --field data.hits.0.entity_id

说明:stock_search 当前规格里的默认参数会自动补齐;常见返回字段是 entity_id,A 股场景下可直接作为股票代码使用。

查实时快照:

python3 scripts/datayes_api.py market_snapshot --param ticker=002594 --param type=stock --result-only --pretty
python3 scripts/datayes_api.py market_snapshot --param ticker=002594 --param type=stock --field result.data.lastPrice

查利润表:

python3 scripts/datayes_api.py fdmt_is_new_lt --param ticker=002594 --param reportType=A --param beginDate=20230101 --param endDate=20241231 --result-only --pretty

运行 smoke test:

python3 scripts/smoke_test.py

参数约定

  • --param key=value 可重复传入多个参数。
  • value 支持普通字符串,也支持 JSON 字面量;数组和布尔值可直接写成 JSON,例如 --param ids='["000001","000002"]'
  • 日期优先使用接口要求的格式,常见为 YYYYMMDD
  • 当接口要求 type 时,不要省略;例如区间涨跌统计通常要显式传 type=stock
  • 如果传入旧参数名或无效参数名,脚本会先本地报错,而不是把错误请求直接发到线上。
  • --field 使用点路径;数组下标直接写数字,例如 result.data.0.ticker

输出规则

  • 优先引用接口返回的原始数值,不要凭经验补充未经验证的结论。
  • 如果多个接口口径可能不同,先说明差异,再给结论。
  • 如果接口报错或无数据,先检查股票代码、日期范围、typereportType 等关键参数。
  • 如果需要更多接口映射和常见参数,读取 references/api-catalog.md
Usage Guidance
This skill appears coherent and implements a Datayes client. Before installing, (1) verify the Datayes token you provide is least-privilege and revocable; (2) don't commit the token to any repository; (3) review the included scripts locally (they validate HTTPS and restrict hosts to Datayes-related domains) and run the smoke test with a disposable token to confirm behavior; (4) note the package has no published homepage/source link—if provenance matters to you, request upstream info from the publisher. If you plan to allow autonomous agent invocation, remember the agent could call these APIs using your token, so limit the token's privileges and revoke it if you see unexpected usage.
Capability Analysis
Type: OpenClaw Skill Name: datayes-stock-data Version: 1.0.1 The skill bundle is a well-structured tool for querying financial data from Datayes. The core script `scripts/datayes_api.py` implements security best practices by using a domain whitelist (ALLOWED_HTTP_HOSTS) and enforcing HTTPS to prevent the DATAYES_TOKEN from being exfiltrated to untrusted endpoints. The code relies solely on the Python standard library, contains no obfuscation, and the instructions in SKILL.md are strictly aligned with the stated purpose of stock data retrieval.
Capability Assessment
Purpose & Capability
Name/description match the implemented functionality: the package is a Python-based Datayes client that fetches API specs and calls Datayes endpoints. Requested binary (python3) and env var (DATAYES_TOKEN) are appropriate. The source/homepage is unknown but that is a provenance issue, not an internal incoherence.
Instruction Scope
SKILL.md instructs the agent to run included Python scripts which read only DATAYES_TOKEN and call Datayes API endpoints. The code first fetches an API spec and then calls the business API, and it documents parameter handling and output rules. There are no instructions to read unrelated files or env vars.
Install Mechanism
No install spec; this is instruction + script only. Scripts use the Python standard library and do not download or execute external archives. Risk from install mechanism is low.
Credentials
Only DATAYES_TOKEN is required and is used solely to set Authorization headers for Datayes requests. The number and type of env vars are proportionate to the skill's purpose.
Persistence & Privilege
always is false and the skill is user-invocable. It does not request persistent system privileges, nor does it modify other skills or system-wide agent settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install datayes-stock-data
  3. After installation, invoke the skill by name or use /datayes-stock-data
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
- 添加 slug 字段及 openclaw metadata,明确所需环境变量和依赖(DATAYES_TOKEN、python3)。 - 详细补充了 Datayes Token 获取方法及在不同操作系统下的配置说明。 - 所有脚本示例从 python 调整为 python3,更加规范。 - 增加安全说明:仅允许请求 Datayes 受信任域名,避免泄露 token。 - 其他描述和结构更清晰,适合各类用户快速上手。
v1.0.0
- Initial release of datayes-stock-data skill. - Supports querying A-shares and Hong Kong stocks for real-time market data, K-lines, financials, valuation, fund flows, shareholder positions, dividends, and corporate profiles via Datayes. - Added Python scripts for flexible, CLI-based API access with parameter validation, default value completion, and result extraction. - Includes detailed workflow and usage documentation for various stock data queries and API behaviors. - Provides smoke test script for basic validation.
Metadata
Slug datayes-stock-data
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Datayes Stock Data?

通过 Datayes 查询 A 股和港股的行情、分时、K 线、财务、估值、资金流向、股东持仓、分红和公司资料。用户询问个股价格、公司基本面、估值指标、资金流向、排行筛选、技术指标或其他需要实时股票数据的问题时使用。 It is an AI Agent Skill for Claude Code / OpenClaw, with 117 downloads so far.

How do I install Datayes Stock Data?

Run "/install datayes-stock-data" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Datayes Stock Data free?

Yes, Datayes Stock Data is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Datayes Stock Data support?

Datayes Stock Data is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Datayes Stock Data?

It is built and maintained by shermanxli (@shermanxli); the current version is v1.0.1.

💬 Comments