npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ashareapi-pi

v0.2.8

Published

A股数据 API 官方 Pi 包 —— 装上即可查 A 股行情 / K线 / 财务 / 资金 / 龙虎榜(40 个端点说明书,开放标准 Agent Skills)

Readme

ashareapi — A股数据 API 官方 Pi 包

让 Pi(pi.dev)直接查 A 股数据:行情 / K线 / 五档盘口 / 财务 / 资金 / 龙虎榜 / 板块 / 可转债 / 因子选股 / 宏观 / 量化回测 —— 40 个端点,5 个免费无需 Key。

一条命令装好 —— 装完 Pi 就知道该调哪个端点、参数怎么填、字段什么单位、错了怎么处理。

Pi Agent Skills npm License

支持 Pi(pi.dev):

Pi package

中文 · English

官网 · 文档 · 端点清单 · MCP 接入 · Agent Skill

GitHub 源码 · 问题反馈 Issues · 更新日志


这是什么

一个 A股数据 Pi 包:装上之后,你在 Pi 里问「600667 现在多少钱」,它会自己去调接口拿真实数据,而不是编一个数给你。

里面是一份 Agent Skill(开放标准)—— Pi 与 Claude Code / Codex 用同一套 skill 规范,所以这份说明书在它们之间通用。内容 = 40 个端点的参数与字段语义、单位换算(volume 是手 / amount 是元 / 比率为百分数)、数据日期语义、常见错误与限流处理。

底层接的是 ashareapi.com 的 REST API(https://api.ashareapi.com/v1/...)—— Pi 直接 curl 调即可;也可以换成官方 SDK 或 MCP。


为什么用它

  • 一条命令装好:pi install npm:ashareapi-pi,装完 /reload 即用,不用配 JSON、不用写脚本
  • 免费端点真的免 Key:/v1/quote /v1/kline /v1/hot /v1/changedist /v1/market-overview 这 5 个装上就能调
  • 多源自动切换:后端 70 个数据源互为备份,某个源出问题会自动换下一个,且不扣调用次数
  • 口径固定,不用二次处理:K 线固定前复权(没有 adjust 参数),不会二次复权
  • 无数据 ≠ 失败:停牌这类「市场真没数据」和「取数失败」分开返回 —— Agent 不会把停牌误判成故障
  • 说明书写给 AI 看:讲清「什么时候用哪个端点 / 参数怎么填 / 字段什么单位 / 错了怎么处理」,Agent 不会调错
  • 不用你维护:内容由脚本从 Agent Skill 生成(单一事实源),Pi 升级也不用跟着改

安装

pi install npm:ashareapi-pi

装完 /reload(或重开 Pi)即可。想先试一次、不写进配置:

pi -e npm:ashareapi-pi

然后在对话里直接问:

| 你可以这样问 | 会用到的端点 | |---|---| | 600667 现在多少钱? | /v1/quote | | 帮我拉一下 600667 最近 60 天的日 K | /v1/kline | | 今天市场什么情况? | /v1/market-overview | | 现在大家都在看什么股票? | /v1/hot | | 今天涨跌家数怎么分布? | /v1/changedist |

卸载:

pi remove npm:ashareapi-pi

配置 API Key

上面 5 个端点不用配任何东西就能用。

要用其余端点(盘口 / 财务 / 资金 / 龙虎榜 / 板块 / 选股 / 宏观…),需要一个 Key:获取 Key(体验版 ¥9.9 起)。

把 Key 放进环境变量 ASHAREAPI_KEY,或者直接告诉 Pi —— 说明书里写明了怎么带上:

curl -H "Authorization: Bearer ct-你的Key" "https://api.ashareapi.com/v1/quote?code=sh600667"

能查什么

免费(无需 Key)

实时行情 · K线 · 热搜榜 · 涨跌分布 · 市场总览

需 Key

五档盘口 · 全字段画像 · 财务三表 · 资金流 · 技术指标 · 股东 · 事件 · 龙虎榜 · 因子选股 · 板块 · 板块估值 · 宏观 · 可转债 · ETF · 新股 · 分红 · 脱水研报 · 代码搜索 · 用量

字段含义、参数与返回样例见文档。


相关

官方 SDK:Python pip install ashareapi · Node.js / TypeScript npm install ashareapi

MCP 服务器:https://api.ashareapi.com/mcp(配置说明)—— Pi 内置 MCP,填一条 URL 就能接;Claude Code / Codex / Cursor 等 19 家客户端同样

Agent Skill(给 AI 读的接口说明书):https://ashareapi.com/skill

本包内容由脚本从 Agent Skill 生成(单一事实源:https://github.com/ashareapi/ashareapi-skill),不手工维护。


版本

最新版本见 npm。本包内容来自 Agent Skill,版本号与 skill 一致;变更见 ashareapi.com/changelog。


License

MIT