Install
openclaw skills install akshareFetch Chinese stock market data (A-shares, Hong Kong stocks, futures, funds, macroeconomic indicators) using AKShare library. Use when you need to get real-time or historical financial data from Chinese markets, including stock prices, trading volumes, financial statements, fund data, futures data, or macroeconomic statistics. Supports daily/weekly/monthly K-line data, stock fundamentals, market indices, and more. No API key required - completely free.
openclaw skills install akshareAKShare is a free, open-source Python library for accessing Chinese financial market data.
import akshare as ak
# Get A-share real-time quotes
stock_spot = ak.stock_zh_a_spot_em()
# Get historical K-line data (with forward adjustment)
df = ak.stock_zh_a_hist(symbol="000001", period="daily",
start_date="20200101", end_date="20231231",
adjust="qfq")
Real-time quotes:
# All A-shares
ak.stock_zh_a_spot_em()
# Individual stock info
ak.stock_individual_info_em(symbol="000001")
Historical data:
# Daily K-line (symbol without exchange prefix)
ak.stock_zh_a_hist(
symbol="000001", # Stock code
period="daily", # daily/weekly/monthly
start_date="20200101",
end_date="20231231",
adjust="qfq" # qfq=forward, hfq=backward, ""=none
)
Index data:
# Shanghai Composite
ak.stock_zh_index_daily(symbol="sh000001")
# Shenzhen Component
ak.stock_zh_index_daily(symbol="sz399001")
# Fund rankings
ak.fund_open_fund_rank_em(symbol="全部")
# Fund net value history
ak.fund_open_fund_info_em(fund="000001", indicator="单位净值走势")
# ETF real-time quotes
ak.fund_etf_spot_em()
# Futures real-time quotes
ak.futures_zh_spot(symbol="主力合约")
# Futures historical data
ak.futures_zh_daily_sina(symbol="CU0", start_date="20230101", end_date="20231231")
# GDP
ak.macro_china_gdp()
# CPI
ak.macro_china_cpi()
# PMI
ak.macro_china_pmi()
# Money supply
ak.macro_china_money_supply()
time.sleep(1) between calls"000001" not "sz000001""sh000001", "sz399001"Get multiple stocks:
import time
stocks = ["000001", "600519", "000858"]
data = {}
for code in stocks:
data[code] = ak.stock_zh_a_hist(symbol=code, period="daily", adjust="qfq")
time.sleep(1) # Avoid rate limiting
Calculate returns:
df = ak.stock_zh_a_hist(symbol="000001", period="daily", adjust="qfq")
df['日收益率'] = df['收盘'].pct_change() * 100
total_return = ((df['收盘'].iloc[-1] / df['收盘'].iloc[0]) - 1) * 100
pip install akshare --upgradescripts/ directoryreferences/api_reference.mdUse AKShare when:
Consider alternatives when: