# A股数据 API(ashareapi.com) > 面向 AI Agent 与开发者的 A 股数据 API:**32 个端点**(29 个数据端点 + 3 个工具端点)覆盖行情 / K线 / **五档盘口** / 财务 / 资金流 / 龙虎榜 / 板块 / 估值 / 宏观 / 可转债 / ETF / 新股 / 研报 / 因子选股;**5 个数据端点无需 Key 即可调用**;可经 MCP(24 个工具)一条 URL 接进 Claude Code / Cursor / Codex / CodeBuddy 等 19 家客户端,也可用 **Agent Skill** 装进 45+ 种 AI 客户端。 多源数据通道(多源自动切换 + 交叉校验)。统一返回信封:`{ ok, endpoint, tier, elapsed_ms, source, data }`。 代码格式带市场前缀:`sh600667`(沪)· `sz000001`(深)· `bj8xxxxx`(北)· `hk00700`(港)· `usAAPL`(美)· `sh113052` / `sz123138`(可转债)· `pt01801780`(申万板块)。 ## 快速开始 - [文档](https://ashareapi.com/docs/): 3 步拿到数据 · 鉴权 · 接入指引(MCP / Python / Node.js / 数据分析) - [Agent Skill 接入](https://ashareapi.com/skill/): 一个文件夹装进 45+ 种 AI 客户端(Claude Code / Cursor / Codex / opencode…),AI 自动知道怎么用本 API 取数 - [Agent Skill 分发索引](https://ashareapi.com/.well-known/agent-skills/index.json): 标准化的 Skill 发现入口(含 sha256 校验,客户端可按 digest 判更新) - [端点清单](https://ashareapi.com/endpoints/): 全部 29 个数据端点的参数与多语言示例 - [错误码](https://ashareapi.com/docs/errors/): 401 / 403 / 429 / 422 与上游失败对照 · 参数约定 - [定价与获取 Key](https://ashareapi.com/pricing/): 免费端点无需 Key · 体验 ¥9.9 / 1 万次 · 标准 ¥29.9 / 10 万次 · 专业 ¥99 / 50 万次 · 不限量 ¥199 / 月 ## 端点(29 个数据端点 · 每个都有独立文档页 /docs/endpoints/{id}/) ### 免费(无需 Key,匿名可调用) - `/v1/quote` — 行情快照(现价 / 开高低 / 成交额 / 换手)· [文档](https://ashareapi.com/docs/endpoints/quote/) - `/v1/kline` — K 线(日 / 周 / 月)· [文档](https://ashareapi.com/docs/endpoints/kline/) - `/v1/hot` — 热搜榜 · [文档](https://ashareapi.com/docs/endpoints/hot/) - `/v1/market-overview` — 市场总览(画像 / 涨跌 / 风格轮动 / 估值分位)· [文档](https://ashareapi.com/docs/endpoints/market-overview/) - `/v1/changedist` — 涨跌分布(市场广度)· [文档](https://ashareapi.com/docs/endpoints/changedist/) - `/v1/health` — 服务健康检查 ### 需 API Key(22 个) - 财务与基本面:`/v1/finance`(三大报表)· `/v1/profile`(公司简况)· `/v1/dividend`(分红送转)· `/v1/shareholder`(股东研究)· `/v1/chip`(筹码分布) - 资金与交易:`/v1/fund`(资金流 + 龙虎榜 + 大宗 + 两融)· `/v1/lhb`(龙虎榜分榜:机构 / 游资 / 活跃席位)· `/v1/margin-trade`(融资融券)· `/v1/block-trade`(大宗交易) - 行情与指标:`/v1/technical`(MA / MACD / KDJ / RSI / BOLL)· `/v1/events`(个股事件标签 42 类) - 板块与指数:`/v1/sector`(板块行情榜)· `/v1/sector-valuation`(板块估值 + 历史百分位) - 量化选股:`/v1/screen`(多因子表达式选股) - 宏观与固收:`/v1/macro`(GDP / CPI / PMI / LPR)· `/v1/bond`(可转债条款)· `/v1/etf`(ETF 概览) - 日历与研报:`/v1/ipo`(新股日历)· `/v1/dehydrated`(脱水研报)· `/v1/calendar`(财经日历) - 工具:`/v1/search`(股票 / 基金 / 板块搜索消歧)· `/v1/usage`(查询自身用量与额度) (每个端点都有独立文档页:`https://ashareapi.com/docs/endpoints/{id}/`,id = 去掉 `/v1/` 后的名字) ## 免费端点(无需注册即可试) > ⚠️ **域名分工**:本文档所有链接都在**内容域 `ashareapi.com`**(欢迎抓取)。 > 实际调用走**接口域 `api.ashareapi.com`** —— 它的 `robots.txt` 是 `Disallow: /`,**只为防止爬虫压测接口,不是屏蔽 AI**。调用示例见每个端点文档页。 - 行情快照 → https://ashareapi.com/docs/endpoints/quote/ - K 线 → https://ashareapi.com/docs/endpoints/kline/ - 热搜榜 → https://ashareapi.com/docs/endpoints/hot/ - 市场总览 → https://ashareapi.com/docs/endpoints/market-overview/ - 涨跌分布 → https://ashareapi.com/docs/endpoints/changedist/ 匿名调用按来源限流(5 次/分;解一次 PoW 挑战可到 60 次/分,见 `/v1/challenge`)。 ## A股每日报告(三时段 · 免费公开 · 可直接引用) 每交易日自动生成三档,**页面与 Markdown 版均可自由引用**(标注来源 `ashareapi.com`): | 时段 | 生成时间 | URL 规律 | |------|----------|----------| | 盘前简报 | 09:15 | `https://ashareapi.com/daily/{YYYY-MM-DD}-pre.html` | | 午间播报 | 11:40 | `https://ashareapi.com/daily/{YYYY-MM-DD}-noon.html` | | 收盘复盘 | 15:05 | `https://ashareapi.com/daily/{YYYY-MM-DD}-post.html` | - 索引(含全部历史归档): https://ashareapi.com/daily/ - Markdown 版(**推荐给 AI 直接读取**): 把 `.html` 换成 `.md`,如 `https://ashareapi.com/daily/2026-09-22-pre.md` - 收录入口: https://ashareapi.com/daily/sitemap.xml 每份内容:指数(收盘/涨跌幅/成交额)、市场情绪与宽度(温度/涨停/炸板率/最高板/涨跌区间分布)、涨停梯队(连板分层 + 涨停原因分布)、板块轮动(领涨/领跌 + 主力净流入 + 消息线索)、**强势股产业链定位**(节点/位置/关联度/业务描述)、龙虎榜机构榜、市场热度、消息面(腾讯 7x24 / 财联社 / 金十 / 百度异动多源交叉)、数据与来源说明。 > 口径:涨跌家数为接口逐档统计,与媒体「全口径」表述可能存在差异;成交额为沪深两市合计。全部为**客观数据整理,不含投资建议**。 ## 鉴权 - 推荐:请求头 `Authorization: Bearer `(Key 在 https://ashareapi.com/pricing/ 获取,形如 `ct-xxxxxxxx`) - 快速测试:URL 参数 `?key=`(仅测试用;生产请用请求头,避免密钥进日志) ## AI Agent 接入(MCP) - [MCP 接入指南](https://ashareapi.com/mcp/): 客户端配置里填**接口地址** `https://api.ashareapi.com/mcp`(接口域,仅供程序调用);19 家客户端的配置写法都在这个页面 - [国内平台接入教程](https://ashareapi.com/docs/mcp-china/): 阿里云百炼 / 扣子 / 腾讯元器 / 腾讯云智能体开发平台 / 火山方舟 的逐步配置 - [AI 爬虫清单与校验](https://ashareapi.com/docs/ai-crawlers/): 国内外 AI 爬虫对照(含官方 IP 段 / 官方来源)+ 三类区分(训练 / 检索 / 用户触发)+ 常见误封错误 - **24 个 MCP 工具**(前 5 个无需 Key):`ashare_quote`(行情快照)· `ashare_orderbook`(五档盘口)· `ashare_snapshot`(全字段画像)· `ashare_kline`(K线)· `ashare_finance`(三大报表)· `ashare_fund`(资金流+龙虎榜+大宗+两融)· `ashare_technical`(技术指标)· `ashare_shareholder`(股东研究)· `ashare_events`(事件标签)· `ashare_lhb`(龙虎榜分榜)· `ashare_screen`(因子选股)· `ashare_sector`(板块行情)· `ashare_sector_valuation`(板块估值)· `ashare_market_overview`(市场总览)· `ashare_changedist`(涨跌分布)· `ashare_hot`(热搜)· `ashare_macro`(宏观)· `ashare_bond`(可转债)· `ashare_etf`(ETF)· `ashare_ipo`(新股日历)· `ashare_dividend`(分红)· `ashare_dehydrated`(脱水研报)· `ashare_search`(搜索消歧)· `ashare_usage`(用量查询) - OpenAPI 规范(内容域,可抓取): https://ashareapi.com/openapi.json ## 与同类对比 - [ashareapi 与 Tushare 对比](https://ashareapi.com/compare/tushare/): 托管服务 vs 积分制,含各自适合谁与诚实边界 - [ashareapi 与 AkShare 对比](https://ashareapi.com/compare/akshare/): 托管 API vs 开源库(自维护成本对照) - [ashareapi 与 BaoStock 对比](https://ashareapi.com/compare/baostock/): 托管 API vs 免费历史数据库(分钟 K 线 / 复权因子 vs 实时快照 / 结构化资金面) ## 教程(附可运行代码) - [用 Python 获取 A股实时行情:3 种方法对比](https://ashareapi.com/docs/guides/python-ashare-quotes/): HTTP API / 数据 SDK / 爬网页的取舍、限流与常见错误 - [用 Python 获取 A股龙虎榜数据:4 种方法对比](https://ashareapi.com/docs/guides/longhubang-data/): 机构 / 游资 / 活跃席位三种分榜 · 金额单位与字符串转换坑 - [用 Python SDK 获取 A股数据(pip install ashareapi)](https://ashareapi.com/docs/guides/python-sdk/): 32 个端点 · 免费端点无需 Key · DataFrame 与 5 类异常 - [用 Node.js / TypeScript SDK 获取 A股数据(npm install ashareapi)](https://ashareapi.com/docs/guides/nodejs-ashare-quotes/): 32 个端点 · 零运行时依赖(原生 fetch)· TypeScript 类型 · 对象数组与 5 类异常 - [用数据量化 A股市场情绪](https://ashareapi.com/docs/guides/market-mood/): 涨跌家数 / 涨停家数 / 成交额 / 风格轮动(全免费端点)· 当期 vs T-1 口径陷阱 - [A股板块轮动怎么查](https://ashareapi.com/docs/guides/sector-rotation/): 板块涨幅榜 + 估值分位 + 产业链定位(pt 代码格式) - [A股财务排雷](https://ashareapi.com/docs/guides/financial-redflags/): 三表勾稽(有利润没现金)+ 股东户数暴增 + 解禁事件 + 分红连续性 - [从 AkShare 迁移](https://ashareapi.com/docs/guides/migrate-from-akshare/): 函数名对照表 + 代码格式转换(600667 → sh600667)+ 字段映射与限流处理 - [可转债强赎与双低怎么监控](https://ashareapi.com/docs/guides/convertible-bond-alerts/): 双低值 / 纯债溢价率 / 转股价值 / 强赎触发价 · Markdown 返回的解析 + 强赎风险提前判断 - [用数据看主力资金](https://ashareapi.com/docs/guides/main-capital-flow/): 主力净流入(当日/5/10/20 日)+ 全市场排名 + 龙虎榜营业部明细 · 四个常见误读 - [从 Tushare 迁移](https://ashareapi.com/docs/migrate-from-tushare/): 接口对照表 + ts_code 前缀转换 + 字段映射 - [用 Claude Code 接入(MCP)](https://ashareapi.com/docs/guides/mcp-claude-code/): 一行命令 + 各客户端配置 - [用 MCP 做 AI 量化](https://ashareapi.com/docs/guides/ai-quant-mcp/): 数据与验证的分工、回测骨架与裁决口径 - 全部教程: https://ashareapi.com/docs/guides/ ## Optional - [服务状态](https://ashareapi.com/status/): 数据源实时状态与历史 - [更新日志](https://ashareapi.com/changelog/): 功能变更 · 新增端点 · 字段只增不删 - [服务条款](https://ashareapi.com/terms/): 服务内容 · 非投资建议声明 · 使用限制 - [English site](https://ashareapi.com/en/): English version (llms.txt: https://ashareapi.com/en/llms.txt) > 说明:本服务提供数据接口与工具,**不构成投资建议**。