一键导入
akshare-mastery
Expert guide for using AkShare to fetch Chinese financial data, covering installation, proxy configuration, resilience patterns, and key interfaces.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Expert guide for using AkShare to fetch Chinese financial data, covering installation, proxy configuration, resilience patterns, and key interfaces.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
A股智能投顾哨兵 - AI驱动的市场分析、追问与趋势研判。Use when the user asks about A-share market analysis, Chinese stock/ETF trading signals, portfolio review, or market trends.
Use when generating or publishing Project Sentinel midday or close reports and report quality must be checked before AI narration or publishing.
| name | AkShare Mastery |
| description | Expert guide for using AkShare to fetch Chinese financial data, covering installation, proxy configuration, resilience patterns, and key interfaces. |
AkShare is an open-source financial data interface library for Python, built for human beings! It fetches data from various sources (Eastmoney, Sina, Xueqiu, etc.) primarily via web scraping.
requests. Proxies must be set via standard environment variables.For faster installation in China, use Aliyun mirror:
pip install akshare --upgrade -i https://mirrors.aliyun.com/pypi/simple/
Since AkShare scrapes websites, it is vulnerable to IP blocking (403 Forbidden / Connection Reset). To use a proxy:
Set these before running your script.
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
python main.py
import os
import akshare as ak
# Apply proxy globally for the process just before calling AkShare
os.environ["HTTP_PROXY"] = "http://127.0.0.1:7890"
os.environ["HTTPS_PROXY"] = "http://127.0.0.1:7890"
df = ak.stock_zh_a_spot_em()
ak.stock_zh_a_spot_em()
ak.stock_zh_a_hist(symbol="000001", period="daily", start_date="20230101", adjust="qfq")
ak.stock_hsgt_fund_flow_summary_em()Never call AkShare directly in production without these wrappers:
asyncio.wait_for or func_timeout.tenacity library.if df.empty.from tenacity import retry, stop_after_attempt
import akshare as ak
@retry(stop=stop_after_attempt(3))
def safe_fetch_spot():
df = ak.stock_zh_a_spot_em()
if df is None or df.empty:
raise ValueError("Empty response")
return df
pip install akshare --upgrade.