>

免费抓取中国A股数据:从东方财富到京东,开箱即用的 Apify 实战指南

Reading Time: 2 minutes

适合人群:量化研究员、数据分析师、独立交易者、构建中国市场仪表盘的开发者 预计阅读时间:8 分钟 工具:Python 3.10+,Apify SDK(免费层即可)


痛点:中国市场数据获取的几大门槛

如果你做过中国股市的数据分析,你大概率遇到过这些麻烦:

  • **Tushare**:免费版接口限速严重,全 A 股每分钟只能拉取几只;Pro 版每年收费上千元
  • **Wind / Choice / iFinD**:终端授权动辄两三万一年,个人开发者完全负担不起
  • **东方财富官方接口**:没有公开 API,自己写爬虫又要应对频繁变更的反爬策略
  • **跨市场(A 股 + 港股 + 台股 + 中概股)**:每个市场都要单独写一套抓取器,维护成本极高

下面介绍一个能跳过所有这些坑的方案:使用 Apify 上的一组现成的中国市场数据采集器,免费层就能起步,按用量计费,单次调用几分钱人民币。

方案概览:一个统一的接口,覆盖中国全市场

我们在 Apify 平台部署了一套针对中国市场的 Stock Screener 全家桶,每个采集器都返回结构化 JSON,可以直接喂给 pandas 做分析:

采集器覆盖范围适用场景
Eastmoney 东方财富沪市 + 深市全 A 股(5000+ 只)A 股大盘行情、市值排序、行业筛选
Shanghai STAR Market 上海科创板科创板(550+ 只)硬科技、半导体、生物医药选股
Shenzhen ChiNext 深圳创业板创业板(1300+ 只)成长型科技股、TMT 板块
Beijing Stock Exchange 北交所北交所(240+ 只)创新型中小企业
HKEX Hang Seng 港股港股主板(2500+ 只)港股蓝筹、中概回归
Taiwan TWSE 台股台湾上市(1000+ 只,含台积电/联发科)台股大盘、半导体产业链

所有数据通过 Apify 的代理基础设施抓取,自动处理反爬,返回标准化字段(市值统一为亿元、价格统一为元/港币/新台币、行业按 GICS 分类)。

5 行代码跑通:以东方财富 A 股为例

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("nexgendata/eastmoney-china-stock-screener").call(
    run_input={
        "properties": "all_a",      # 所有 A 股
        "sort_by": "market_cap",     # 按市值排序
        "sort_order": "desc",
        "max_results": 50,           # 取前 50
    },
)
# 拉取结果
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{item['symbol']:8} {item['name']:12} 市值: ¥{item['market_cap']/1e8:.0f}亿  PE: {item.get('pe_ratio', 'N/A')}")

输出示例:

601398   工商银行         市值: ¥21430亿  PE: 5.8
600519   贵州茅台         市值: ¥18920亿  PE: 28.4
601288   农业银行         市值: ¥15640亿  PE: 5.2
601988   中国银行         市值: ¥13280亿  PE: 5.4
601857   中国石油         市值: ¥12150亿  PE: 9.1
...

无需自己处理 HTTP 请求、反爬虫、字段标准化——所有这些 Apify 替你做了。

进阶用法:多市场组合 + 跨市场比较

如果你做的是中概股研究,或者想做”AH 股溢价比较”这类多市场策略,可以把几个采集器串起来:

import pandas as pd
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
# 拉取 A 股银行板块
a_run = client.actor("nexgendata/eastmoney-china-stock-screener").call(
    run_input={"properties": "industry", "industry": "银行", "max_results": 30}
)
a_banks = pd.DataFrame(list(client.dataset(a_run["defaultDatasetId"]).iterate_items()))
# 拉取港股银行板块
hk_run = client.actor("nexgendata/hkex-hang-seng-stock-screener").call(
    run_input={"sector": "Financials.Banks", "max_results": 30}
)
hk_banks = pd.DataFrame(list(client.dataset(hk_run["defaultDatasetId"]).iterate_items()))
# 匹配 AH 股(按公司名称模糊匹配)
ah_pairs = pd.merge(
    a_banks[["symbol", "name", "price"]],
    hk_banks[["symbol_hk", "name_hk", "price_hkd"]],
    left_on="name", right_on="name_hk", how="inner"
)
ah_pairs["premium_pct"] = (ah_pairs["price"] - ah_pairs["price_hkd"] * 0.92) / ah_pairs["price_hkd"] / 0.92 * 100
print(ah_pairs.sort_values("premium_pct", ascending=False).head(10))

这段代码就是一份完整的 AH 股溢价排序工具——传统上需要订阅万得资讯才能跑出来的分析,现在用免费工具几行代码就搞定。

不只是股票:京东商品、微博热搜、B 站视频

如果你的研究范围更广,比如做消费行业研究需要电商价格数据、做品牌监控需要社媒舆情,我们还做了配套的采集器:

# 京东商品价格 + 评分
jd_run = client.actor("nexgendata/jd-com-product-scraper").call(
    run_input={"keyword": "iPhone 17", "max_products": 50}
)
# 微博热搜实时榜
weibo_run = client.actor("nexgendata/weibo-hot-search-tracker").call(
    run_input={"max_topics": 50}
)
# B 站视频元数据(按关键词)
bilibili_run = client.actor("nexgendata/bilibili-video-search").call(
    run_input={"keyword": "量化交易", "max_videos": 100}
)

所有这些采集器都遵循同一套 actor.call() + dataset.iterate_items() 模式,学一次会全部。

计费透明:到底多少钱

Apify 用的是 Pay-Per-Event(按事件计费)模式,没有月费、没有套餐——你跑多少算多少。以东方财富采集器为例:

  • 启动费:$0.02(约人民币 0.14 元)
  • 每只股票数据:$0.0001(约人民币 0.0007 元)

跑 1000 只 A 股的成本大约是 $0.12(约 0.85 元人民币)。对比 Tushare Pro 每年 199 元起、万得终端每年 23000 元起——免费层就足以覆盖大多数个人开发者的需求。

新用户注册 Apify 还有 $5 免费额度通过这个链接注册),足够你跑几十次完整的全 A 股扫描,先把工具跑通再决定要不要付费。

对比表:免费方案 vs 付费数据终端

维度Tushare Pro万得 Wind同花顺 iFinDApify 中国采集器
起步价¥199/年¥23,000/年起¥6,000/年起$0(免费层 + 按用量)
A 股全市场覆盖
港股覆盖部分
台股覆盖部分
科创板/创业板/北交所
实时刷新限速实时实时实时
跨平台数据(电商/社媒)需另购需另购
上手成本Python + 注册客户端 + 培训客户端 + 培训Python + 注册
个人开发者友好度

总结:先把工具跑通再决定要不要付费

整个中国市场数据采集流程从”自己造轮子”变成”调用三方函数”,开发时间从几天压缩到几分钟。如果你只是做研究或者小规模交易策略,免费层和按用量计费已经够用;如果业务规模做大了,再考虑升级 Apify 付费套餐(Starter 月费 $29 起),仍然比 Wind/Choice 便宜两个数量级。

链接汇总:

  • 东方财富 A 股:https://apify.com/nexgendata/eastmoney-china-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 上海科创板:https://apify.com/nexgendata/star-market-china-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 深圳创业板:https://apify.com/nexgendata/chinext-china-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 北京交易所:https://apify.com/nexgendata/bse-beijing-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 港股恒生:https://apify.com/nexgendata/hkex-hang-seng-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 台股 TWSE:https://apify.com/nexgendata/twse-stock-screener?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 京东商品:https://apify.com/nexgendata/jd-com-product-scraper?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 微博热搜:https://apify.com/nexgendata/weibo-hot-search-tracker?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • B 站搜索:https://apify.com/nexgendata/bilibili-video-search?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh
  • 中国趋势汇总:https://apify.com/nexgendata/china-trends-tracker?fpr=2ayu9b&utm_source=tngn&utm_medium=blog&utm_campaign=free-china-a-share-data-scraping-apify-guide-zh

注册 Apify(含 $5 免费额度):https://www.apify.com/sign-up?fpr=2ayu9b


*作者:NexGenData 团队。我们在 Apify 上发布了 270+ 个数据采集器,覆盖全球主要金融市场、社交平台和电商网站。欢迎在评论区告诉我们你想要哪些数据源。*

Related guides on NexGenData

Explore more tools and guides in this category:

Run it yourself in minutes

New users get $5 free credit (no card). Browse the full 300+ actor catalog and run any tool on pay-per-use pricing.

More from the blog