返回顶部
c

cn-security-code-resolver中国证券代码解析

Resolve A-share stocks, ETFs, funds, and other mainland China securities from Chinese names into tradable codes using Eastmoney search. This skill should be used when a user asks for a security code, ticker, exchange suffix, or wants a portfolio file enriched with Chinese market instrument codes.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
111
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

cn-security-code-resolver

CN Security Code Resolver

概述

通过确定性初筛和可验证的备用方案,将中文证券名称解析为交易所可交易代码。使用内置脚本查询东方财富公开建议API,返回最佳匹配结果及足够的元数据以供确认。

使用场景

当任务涉及以下任何情况时使用此技能:

  • - 根据中文名称查找中国股票、ETF、LOF、REIT或基金的代码
  • 将投资组合/自选股列表从名称转换为可交易代码
  • 确认某品种是否为A股、ETF/基金或其他内地市场类型
  • 添加交易所标识符,如600938.SH、510880.SH或东方财富QuoteID

不适用于以下场景:

  • - 实时定价或图表分析
  • 香港、美国、期货或加密货币代码,除非用户明确要求跨市场结果
  • 超出基础品种识别范围的基本面分析

工作流程

1) 优先使用脚本

运行内置解析脚本:

bash
python3 skills/cn-security-code-resolver/scripts/resolvecnsecurity.py 中国海油

批量模式:

bash
python3 skills/cn-security-code-resolver/scripts/resolvecnsecurity.py 红利ETF华泰柏瑞 苏美达 中国海油 海油发展 中海油服

2) 仔细阅读最佳匹配结果

优先选择以下行:

  • - Name与查询的中文名称完全匹配
  • SecurityTypeName符合用户意图(沪A、深A、基金等)
  • MarketType / QuoteID表明为内地交易场所

对于内地现金股票和ETF,交易所后缀映射规则如下:

  • - 以6、5或9开头的代码 → 通常为SH
  • 以0、1、2或3开头的代码 → 通常为SZ

如果返回结果不明确,显示前3个候选结果并要求用户确认,而非自行猜测。

3) 返回简洁确认信息

回复时使用以下输出格式:

text
标的:中海油服
A股代码:601808
交易所:上交所
类型:沪A
标准代码:601808.SH
QuoteID:1.601808

4) 更新文件时

在写入投资组合JSON或其他结构化文件时,建议同时存储:

  • - code:原始数字代码,例如601808
  • exchangeSuffix:可明确推导时为SH或SZ

可选增强字段:

  • - quoteId
  • securityTypeName
  • marketType
  • source: eastmoney_suggest

验证指南

如果首次结果存疑:

  • - 使用券商/应用中完整准确的中文名称重新运行
  • 检查脚本输出的候选列表顶部结果
  • 仅在必要时通过浏览器搜索进行交叉验证

良好的验证信号:

  • - 中文名称完全匹配
  • 预期类别(例如ETF与股票)
  • 价格范围和投资组合上下文与品种类型一致

内置资源

脚本

  • - scripts/resolvecnsecurity.py
- 查询东方财富建议API - 支持单个或多个名称 - 返回带交易所提示的排序JSON结果

参考文档

  • - references/eastmoney-api.md
- 记录API端点、返回字段及匹配启发式规则

示例

bash
python3 skills/cn-security-code-resolver/scripts/resolvecnsecurity.py 苏美达

预期最佳结果:

  • - 600710 / 苏美达 / 沪A

bash
python3 skills/cn-security-code-resolver/scripts/resolvecnsecurity.py 红利ETF华泰柏瑞

预期最佳结果:

  • - 510880 / 红利ETF华泰柏瑞 / 基金

bash
python3 skills/cn-security-code-resolver/scripts/resolvecnsecurity.py 中海油服

预期最佳结果:

  • - 601808 / 中海油服 / 沪A
  • 如果其他市场也出现结果,除非用户另有要求,否则优先选择A股

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 cn-security-code-resolver-openclaw-skill-1776060428 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 cn-security-code-resolver-openclaw-skill-1776060428 技能

通过命令行安装

skillhub install cn-security-code-resolver-openclaw-skill-1776060428

下载

⬇ 下载 cn-security-code-resolver v1.0.0(免费)

文件大小: 7.09 KB | 发布时间: 2026-4-14 13:34

v1.0.0 最新 2026-4-14 13:34
Initial release of CN Security Code Resolver.

- Resolves Chinese stock, ETF, or fund names into tradable mainland codes using Eastmoney search.
- Supports batch and single-name resolution with precise matching logic for code, exchange, and instrument type.
- Provides usage workflow and output formatting guidelines for deterministic and verifiable results.
- Includes CLI script and API reference for integration or advanced use.
- Offers validation and fallback steps to ensure result accuracy.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部