pa-market-query
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "pa-market-query" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-079a93fd9b2757362363a358e0f265f106090f85dd7f9794f33411cde43c5f45. Verify the upstream source and version against https://skillhub.cn/skills/pinganzhengquan/pa-market-query before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Securities market real-time and historical quotes query. Provides market-data queries for A-share stocks, indices, ETFs and sectors, including real-time quotes, sector constituent stocks, main capital flows, and historical K-line data.
Introduction source: third_party · pinganzhengquan · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: pa-market-query
description: 查询A股个股/股指/ETF实时行情、板块行情、板块成分股、主力资金流向、历史K线等证券市场数据。当用户询问股价、涨跌幅、板块表现、领涨股、资金流入流出、K线走势等与证券行情相关的问题时,使用此 skill 获取实时数据,。用户提到股票名称\代码、板块,或说"帮我查一下…行情/资金流向/K线/涨跌"时,也应主动触发。券商行情查询 Skill
这个 Skill 做什么
查询实时/历史市场数据,覆盖 5 类场景:个股/股指/ETF 行情、板块行情、板块成分股、主力资金流向、历史 K 线。所有请求都通过 scripts/get_data.py 这一个脚本发出——每个接口对应一个固定的 options 子命令。
任何时候都应该用这个 skill 实际查询,不要依赖训练知识回答股价、涨跌幅等具体数字。
环境准备
- 检查是否已经设置环境变量
PINGAN_SKILL_APIKEY(用于鉴权用的 API Key),如未设置,提示用户登录平安证券skill开放平台获取 https://stock.pingan.com/huodong/aiskill/skillPage/index.html#/ - 依赖 Python 库
requests。
基本调用格式
python scripts/get_data.py <options> [参数...]
参数一览
| options | 说明 | 必填参数 | 限制 |
|---|---|---|---|
quote |
股票/股指/ETF 实时行情(支持批量) | codes(数组) |
同一接口按代码区分标的类型,最多同时查询5个股票/股指/ETF代码 |
sector |
板块实时行情 | sector_code(单个) |
— |
sector_stocks |
板块成分股实时变动 | sector_code(单个) |
limit 默认 5,范围 1~20 |
fundflow |
主力资金流向 | codes(数组) |
最多 5 个代码 |
kline |
历史 K 线数据(日线) | code(单个) |
last_n 最大 50,不传默认最近 5 个交易日 |
代码格式统一为「市场代码 + 证券代码」,例如 SH600519、SZ000001,不要传裸代码或带点号的写法(如 600519.SH)。
1. quote — 股票/股指/ETF 实时行情查询
获取指定股票/股指/ETF 的实时行情,支持批量查询(最多同时查询5个)。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
codes |
String[] | 代码列表,例如 ["SH600519", "SZ000001"] |
返回字段(items[],部分字段仅 ETF 才有)
| 字段 | 说明 |
|---|---|
code / name |
代码 / 名称 |
price |
最新价/点位(元/点) |
change / change_pct |
涨跌额(元) / 涨跌幅(%) |
open / high / low / prev_close |
今开 / 最高 / 最低 / 昨收(元) |
volume / amount |
累计成交量(股) / 成交额(元),均自开盘起算 |
turnover_pct |
换手率(%) |
pe_ttm / pb |
滚动市盈率 / 市净率(倍) |
market_cap / circ_market_cap |
总市值 / 流通市值(元) |
tracking_index |
仅 ETF:跟踪指数代码(非名称) |
premium_rate |
仅 ETF:折溢价率,正为溢价(%) |
fund_size |
仅 ETF:基金规模/净资产(元) |
iopv |
仅 ETF:基金份额参考净值(元) |
not_found |
无效代码列表,部分失败时才出现 |
调用示例
python scripts/get_data.py quote --codes SH600519,SZ000001
--codes 用逗号分隔字符串传入,例如 --codes SH600519,SZ000001。
2. sector — 板块实时行情
获取单个指定板块(行业板块、概念板块)或指数的实时行情。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
sector_code |
string | 板块代码 |
返回字段(items[])
| 字段 | 说明 |
|---|---|
sector_code / sector_name |
板块代码 / 名称 |
change_pct |
板块整体涨跌幅(%) |
leading_stock_code / leading_stock_name / leading_stock_change_pct |
领涨股代码 / 名称 / 涨跌幅(%) |
amount |
板块成分股总成交额(元) |
stock_count / up_count / down_count / flat_count |
成分股总数 / 上涨 / 下跌 / 平盘家数 |
调用示例
python scripts/get_data.py sector --sector_code PA90501002
板块代码参考下方 [板块代码列表]例如
90501002表示半导体板块。
3. sector_stocks — 板块成分股实时变动
获取某板块下的成分股列表及基础行情,默认按涨幅字段倒序排列。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
sector_code |
string | 板块代码 |
limit |
int | 返回条数,默认 5,范围 1~20 |
返回字段
顶层:sector_code、sector_name;items[] 内为成分股:
| 字段 | 说明 |
|---|---|
code / name |
成分股代码 / 名称 |
price |
最新价(元) |
change_pct |
涨跌幅(%) |
amount |
成交额(元) |
调用示例
python scripts/get_data.py sector_stocks --sector_code PA90501002 --limit 10
4. fundflow — 主力资金流向数据
获取股票/板块的资金流向数据,最多支持 5 个代码。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
codes |
String[] | 最多 5 个,股票或板块代码 |
返回字段(items[])
| 字段 | 说明 |
|---|---|
code / name |
代码 / 名称 |
main_net_inflow |
主力净流入(超大单+大单)(元) |
main_net_inflow_pct |
主力净流入 / 成交额;成交额为 0 或负值时为 null |
super_large_net_inflow / large_net_inflow |
超大单 / 大单净流入合计(元) |
amount |
总成交额(元) |
not_found |
无效代码列表,部分失败时才出现 |
调用示例
python scripts/get_data.py fundflow --codes SH600519,SZ000001
传入超过 5 个代码会在本地被直接拦截,报错「参数 codes 最多支持 5 个」,不会发起网络请求。
5. kline — 历史K线数据
获取单个股票的历史 K 线数据(日线,默认前复权)。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
code |
string | 股票代码 |
last_n |
int | 取最近 N 个交易日,最大 180,不传默认取最近 5 个交易日 |
返回字段
items[](通常一个 code 对应一项):
| 字段 | 说明 |
|---|---|
code / name |
股票代码 / 名称 |
period |
K 线周期,固定为 day |
adjust |
复权方式,默认前复权 |
start_date / end_date |
实际返回的起止日期 |
bars[] |
K 线数组,见下 |
bars[] 内每根 K 线:
| 字段 | 说明 |
|---|---|
date |
交易日(YYYY-MM-DD) |
open / high / low / close |
开 / 高 / 低 / 收盘价(元,已按 adjust 调整) |
change_pct |
当日涨跌幅(%),首根为 null |
volume / amount |
成交量(股) / 成交额(元) |
调用示例
python scripts/get_data.py kline --code SH600519 --last_n 20
# 不传 --last_n,网关默认取最近 5 个交易日
python scripts/get_data.py kline --code SH600519
每个子命令的参数和取值范围可以直接看帮助信息:
python scripts/get_data.py quote -h
python scripts/get_data.py kline -h
板块名称代码映射表
| 板块名称 | 代码 |
|---|---|
| 种植业 | PA90101002 |
| 渔业 | PA90102002 |
| 林业 | PA90103002 |
| 饲料 | PA90104002 |
| 农产品加工 | PA90105002 |
| 养殖业 | PA90106002 |
| 动物保健 | PA90107002 |
| 农业综合 | PA90108002 |
| 化学原料 | PA90201002 |
| 化学制品 | PA90202002 |
| 化学纤维 | PA90203002 |
| 塑料 | PA90204002 |
| 橡胶 | PA90205002 |
| 农化制品 | PA90206002 |
| 非金属材料 | PA90207002 |
| 冶钢原料 | PA90301002 |
| 普钢 | PA90302002 |
| 特钢 | PA90303002 |
| 金属新材料 | PA90401002 |
| 工业金属 | PA90402002 |
| 贵金属 | PA90403002 |
| 小金属 | PA90404002 |
| 能源金属 | PA90405002 |
| 半导体 | PA90501002 |
| 元件 | PA90502002 |
| 光学光电子 | PA90503002 |
| 其他电子 | PA90504002 |
| 消费电子 | PA90505002 |
| 电子化学品 | PA90506002 |
| 汽车零部件 | PA90601002 |
| 汽车服务 | PA90602002 |
| 摩托车及其他 | PA90603002 |
| 乘用车 | PA90604002 |
| 商用车 | PA90605002 |
| 白色家电 | PA90701002 |
| 黑色家电 | PA90702002 |
| 小家电 | PA90703002 |
| 厨卫电器 | PA90704002 |
| 照明设备 | PA90705002 |
| 家电零部件 | PA90706002 |
| 其他家电 | PA90707002 |
| 食品加工 | PA90801002 |
| 白酒 | PA90802002 |
| 其他酒类 | PA90803002 |
| 饮料乳品 | PA90804002 |
| 休闲食品 | PA90805002 |
| 调味发酵品 | PA90806002 |
| 纺织制造 | PA90901002 |
| 服装家纺 | PA90902002 |
| 饰品 | PA90903002 |
| 造纸 | PA91001002 |
| 包装印刷 | PA91002002 |
| 家居用品 | PA91003002 |
| 文娱用品 | PA91004002 |
| 化学制药 | PA91101002 |
| 中药 | PA91102002 |
| 生物制品 | PA91103002 |
| 医药商业 | PA91104002 |
| 医疗器械 | PA91105002 |
| 医疗服务 | PA91106002 |
| 电力 | PA91201002 |
| 燃气 | PA91202002 |
| 物流 | PA91301002 |
| 铁路公路 | PA91302002 |
| 航空机场 | PA91303002 |
| 航运港口 | PA91304002 |
| 房地产开发 | PA91401002 |
| 房地产服务 | PA91402002 |
| 贸易 | PA91501002 |
| 一般零售 | PA91502002 |
| 专业连锁 | PA91503002 |
| 互联网电商 | PA91504002 |
| 旅游零售 | PA91505002 |
| 体育 | PA91601002 |
| 专业服务 | PA91603002 |
| 酒店餐饮 | PA91604002 |
| 旅游及景区 | PA91605002 |
| 教育 | PA91606002 |
| 国有大型银行 | PA91701002 |
| 股份制银行 | PA91702002 |
| 城商行 | PA91703002 |
| 农商行 | PA91704002 |
| 证券 | PA91801002 |
| 保险 | PA91802002 |
| 多样金融 | PA91803002 |
| 综合 | PA91901002 |
| 水泥 | PA92001002 |
| 玻璃玻纤 | PA92002002 |
| 装修建材 | PA92003002 |
| 房屋建设 | PA92101002 |
| 装修装饰 | PA92102002 |
| 基础建设 | PA92103002 |
| 专业工程 | PA92104002 |
| 工程咨询服务 | PA92105002 |
| 电机 | PA92201002 |
| 其他电源设备 | PA92202002 |
| 光伏设备 | PA92203002 |
| 风电设备 | PA92204002 |
| 电池 | PA92205002 |
| 电网设备 | PA92206002 |
| 通用设备 | PA92301002 |
| 专用设备 | PA92302002 |
| 轨交设备 | PA92303002 |
| 工程机械 | PA92304002 |
| 自动化设备 | PA92305002 |
| 航天装备 | PA92401002 |
| 航空装备 | PA92402002 |
| 地面兵装 | PA92403002 |
| 航海装备 | PA92404002 |
| 军工电子 | PA92405002 |
| 计算机设备 | PA92501002 |
| IT服务 | PA92502002 |
| 软件开发 | PA92503002 |
| 游戏 | PA92601002 |
| 广告营销 | PA92602002 |
| 影视院线 | PA92603002 |
| 数字媒体 | PA92604002 |
| 出版 | PA92606002 |
| 电视广播 | PA92607002 |
| 通信服务 | PA92701002 |
| 通信设备 | PA92702002 |
| 煤炭开采 | PA92801002 |
| 焦炭 | PA92802002 |
| 油气开采 | PA92901002 |
| 油服工程 | PA92902002 |
| 炼化及贸易 | PA92903002 |
| 环境治理 | PA93001002 |
| 环保设备 | PA93002002 |
| 个护用品 | PA93101002 |
| 化妆品 | PA93102002 |
| 医疗美容 | PA93103002 |
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 覆盖个股/股指/ETF行情、板块行情、板块成分股、主力资金流向、历史K线等5类证券市场数据查询场景
- 支持批量查询和多种参数配置,满足用户多样化的行情数据需求
Areas to improve
-
Description in the wrong location Reported severity: Minor
顶层frontmatter中description为空,但skill_body内部有实质描述内容
Recommendation: 将description内容移至顶层frontmatter中,保持规范一致
Highlights
- 触发词精准完整,覆盖股价、涨跌幅、板块表现、领涨股、资金流向、K线等多种变体
- 边界清晰,用户提到股票名称/代码、板块或说'帮我查一下…行情/资金流向/K线/涨跌'时都应主动触发
Highlights
- Phase/步骤清晰,每个子命令都有详细的参数说明、返回字段和调用示例
- frontmatter完整,文档结构规范,单文件未超500行限制
Highlights
- 工具来源明确(scripts/get_data.py),参数正确,覆盖主要异常(如not_found字段)
- 每个接口都有固定的options子命令,调用格式统一规范
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 16
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- stock.pingan.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.