← Back to Skills Marketplace
bensema

同花顺问财ETF选股

by bensema · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
95
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install iwencai-skill-etf
Description
同花顺智能选ETF skill。根据行情、跟踪指数基本面、规模、风格类型等条件筛选ETF。返回符合条件的相关ETF数据。当用户询问ETF筛选问题时,必须使用此技能。
README (SKILL.md)

问财选ETF 使用指南

技能概述

本技能提供ETF智能筛选能力,通过自然语言查询支持:

  • 行情指标筛选(价格、涨跌幅、成交量、换手率等)
  • 跟踪指数筛选(沪深300、中证500、上证50、创业板指等)
  • 基本面筛选(估值、费率、跟踪误差等)
  • 规模筛选(资产规模、份额变化等)
  • 风格类型筛选(成长、价值、平衡等)
  • 多条件组合筛选

核心处理流程

步骤 1: 接收用户 Query

接收用户的自然语言ETF筛选请求,分析用户意图。

步骤 2: Query 改写

将用户问句适当改写为标准的金融查询问句,保持原意不变:

改写规则:

  • 保留用户核心意图(如:沪深300ETF、规模大于10亿等)
  • 将口语化表达转为标准金融术语(如"给我选一个ETF" → "ETF有哪些")
  • 适当简化过于复杂的复合条件
  • 改写后需保持原意不变

思维链拆解(如果需要): 根据用户需求自行决定是否拆解思维链:

  • 单次查询:如果用户问题可以直接用单个 query 回答,直接进入下一步
  • 多次查询:如果用户问题涉及多个独立的问句,需要拆分为多个标准 query 分别调用接口。

步骤 3: API 调用

调用金融查询接口获取数据,支持分页参数:

# 使用 Python 标准库
import urllib.request
import json
import os

url = "https://openapi.iwencai.com/v1/query2data"
headers = {
    "Authorization": f"Bearer {os.environ['IWENCAI_API_KEY']}",
    "Content-Type": "application/json"
}
payload = {
    "query": "改写后的查询语句",
    "source": "test",
    "page": "1",
    "limit": "10",
    "is_cache": "1",
    "expand_index": "true"
}

data = json.dumps(payload).encode("utf-8")
request = urllib.request.Request(url, data=data, headers=headers, method="POST")
response = urllib.request.urlopen(request, timeout=30)
result = json.loads(response.read().decode("utf-8"))
datas = result.get("datas", [])

步骤 4: 空数据处理

如果 datas 为空或无数据,适当放宽或简化查询条件后重新请求(最多尝试2次):

  • 首次重试:去掉过于苛刻的条件,保留核心筛选条件
  • 二次重试:进一步放宽条件或使用更通用的表述

每次重试都算作一次改写,最终返回时需说明最终使用的查询问句。

步骤 5: 数据解析

解析返回的 datas 数组,提取相关指标:

for item in datas:
    # 根据查询类型提取相应字段

步骤 6: 数据扩展决策

skill 需要自行决策当前数据是否足够回答用户问题:

  • 如果数据完整:直接返回格式化后的结果
  • 如果需要更多背景信息:可以调用其他金融工具或者搜索工具获取相关资讯

步骤 7: 回答用户

组织语言回答用户问题,确保:

  • 结果清晰易懂
  • 如果改写了问句,需特别说明最终使用的查询问句
  • 必须强调数据来源于同花顺问财

接口地址

  • IWENCAI_API_URL

认证方式

  • 请求头:Authorization: Bearer {IWENCAI_API_KEY}
  • 环境变量:IWENCAI_API_KEY

请求参数

参数名 类型 必填 说明
query STRING 用户问句
source STRING 来源,默认值:test
page STRING 分页参数,默认值:1
limit STRING 分页参数,默认值:10
is_cache STRING 缓存参数,默认值:1
expand_index STRING 是否展开指数,默认值:true

响应参数

参数名 类型 说明
datas ARRAY 金融数据列表,对象数组

响应示例:

{
  "datas": [
    {"ETF代码": "510300.SH", "ETF简称": "华泰柏瑞沪深300ETF", "涨跌幅": 1.25},
    {"ETF代码": "159919.SZ", "ETF简称": "嘉实沪深300ETF", "涨跌幅": 1.18}
  ]
}

CLI 使用方式

命令行参数

参数 类型 必填 说明
--query STRING 直接传入查询字符串
--page STRING 分页参数,默认值:1
--limit STRING 每页条数,默认值:10
--is-cache STRING 缓存参数,默认值:1
--api-key STRING API密钥(默认从环境变量读取)

使用示例

# 直接查询(默认分页10条)
python scripts/cli.py --query "沪深300ETF有哪些?"

# 指定分页参数
python scripts/cli.py --query "规模最大的ETF" --page "1" --limit "20"

# 指定API密钥
python scripts/cli.py --query "创业板ETF" --api-key "your-key"

数据来源标注

重要提示

  • 引用同花顺数据时,必须强调数据来源于同花顺问财
  • 如果没有查询到数据,提示用户可以到同花顺问财 web端查询:https://www.iwencai.com/unifiedwap/chat

错误处理

  • API调用失败:给出友好错误提示
  • 无数据返回:引导用户访问同花顺问财(https://www.iwencai.com/unifiedwap/chat)
  • 最多重试2次逐步放宽条件

代码结构

hithink-etf-selector/
├── SKILL.md       # Skill 配置文件
├── references/
│   ├── api.md     # API 接口文档
│   └── requirement.md  # 构建要求文档
└── scripts/
    └── cli.py     # CLI 入口(单一脚本,内含API调用和数据处理)
Usage Guidance
This skill appears to be a straightforward client for the 同花顺/问财 (iwencai) API, but exercise caution before installing or enabling it: - Metadata mismatch: The skill's manifest declares no required environment variables, but the instructions and CLI code require IWENCAI_API_KEY (and refer to IWENCAI_API_URL). Do not provide your API key until you confirm the skill legitimately needs it. - Verify the endpoint and owner: The CLI uses https://openapi.iwencai.com/v1/query2data. Confirm that this is the official endpoint and that you trust the unknown owner/publisher before supplying credentials. - Review network behavior: The skill sends your full query text to the external service and may retry with relaxed queries up to 2 times. Avoid sending sensitive or private data in queries because it will be transmitted to an external API and may be logged. - Confirm credential scope: Use an API key with limited scope/usage and monitor its usage. Prefer creating a dedicated key for this skill rather than reusing high-privilege credentials. - Test locally first: Inspect and run the provided scripts locally in a safe environment (without exposing production secrets) to validate behavior and ensure IWENCAI_API_URL usage is as expected (the CLI hardcodes DEFAULT_API_URL and does not read an IWENCAI_API_URL env var despite mentioning it in docs). Given the manifest/instructions inconsistency and unknown publisher, treat this skill as suspicious until you validate the above points.
Capability Analysis
Type: OpenClaw Skill Name: iwencai-skill-etf Version: 1.0.0 The skill bundle is a legitimate tool for querying ETF data from the iWencai (Tonghuashun) API. The Python script `scripts/cli.py` and the instructions in `SKILL.md` use standard libraries to perform authorized API calls using a provided API key. There is no evidence of data exfiltration, malicious execution, or prompt injection.
Capability Assessment
Purpose & Capability
The skill's stated purpose (ETF selection via 同花顺/问财) matches the included code and docs which call an iwencai API. Requiring an API key and making POST queries to an external financial API is coherent with the stated purpose.
Instruction Scope
The SKILL.md and scripts/cli.py instruct the agent to send user queries to an external API (openapi.iwencai.com) and to retry with relaxed queries up to 2 times. SKILL.md also allows calling 'other financial tools or search tools' at the agent's discretion (broad). Critically, the runtime instructions reference the environment variable IWENCAI_API_KEY (and mention IWENCAI_API_URL) while the skill metadata declared no required env vars — this mismatch means the agent may attempt network calls that require secrets not declared to the platform.
Install Mechanism
No install spec; there is a single CLI script using only Python standard library. No downloads or third-party packages are installed, which minimizes install-time risk.
Credentials
The code requires an API key (IWENCAI_API_KEY) for authentication and the docs mention IWENCAI_API_URL; however, the registry metadata lists no required env vars. Asking for an API key is proportionate to the task, but the omission from metadata is a mismatch and increases the chance a user would inadvertently supply credentials without realizing the skill needs them. The skill does not request unrelated credentials, but the missing declaration is a red flag.
Persistence & Privilege
always:false and no special persistence or system-wide configuration changes. The skill does not request elevated/always-on privileges in the manifest.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install iwencai-skill-etf
  3. After installation, invoke the skill by name or use /iwencai-skill-etf
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
问财选ETF v1.0.0 发布 - 首次发布同花顺ETF智能筛选技能,支持多维度自然语言筛选ETF(包括行情、指数、基本面、规模、风格等)。 - 内置完整数据API调用流程,支持自动放宽筛选条件重试(最多2次)。 - 结果需注明数据来源于同花顺问财,未命中时引导用户使用官方Web端。 - 提供详细的CLI用法说明及错误处理机制。 - 文档详细描述技能原理、参数说明与目录结构,便于开发者快速上手。
Metadata
Slug iwencai-skill-etf
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 同花顺问财ETF选股?

同花顺智能选ETF skill。根据行情、跟踪指数基本面、规模、风格类型等条件筛选ETF。返回符合条件的相关ETF数据。当用户询问ETF筛选问题时,必须使用此技能。 It is an AI Agent Skill for Claude Code / OpenClaw, with 95 downloads so far.

How do I install 同花顺问财ETF选股?

Run "/install iwencai-skill-etf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 同花顺问财ETF选股 free?

Yes, 同花顺问财ETF选股 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 同花顺问财ETF选股 support?

同花顺问财ETF选股 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 同花顺问财ETF选股?

It is built and maintained by bensema (@bensema); the current version is v1.0.0.

💬 Comments