AKShare Data API Reference
AKShare is a Python package providing access to Chinese financial market data. This skill contains complete API documentation organized by asset class and data category.
Quick Start
AKShare can be used via CLI wrapper or Python library.
CLI (Recommended)
# Get stock data (JSON output is default)
python3 scripts/akshare_cli.py stock_zh_a_hist --symbol 000001 --start_date 20200101 --end_date 20210101
# Get as JSON explicitly
python3 scripts/akshare_cli.py stock_zh_a_hist --symbol 000001 --start_date 20200101 --end_date 20210101 --format json
# Export to CSV when needed for complex analysis
python3 scripts/akshare_cli.py stock_zh_a_hist --symbol 000001 --start_date 20200101 --end_date 20210101 --format csv > stock_data.csv
Python Library (Legacy)
import akshare as ak
stock_df = ak.stock_zh_a_hist(symbol="000001", start_date="20200101", end_date="20210101")
print(stock_df)
Data Categories
All APIs below are available via CLI wrapper. See individual API docs for both CLI and Python usage:
Equities & Indices
- Stock Data - A/B shares, history, daily snapshots, sector data, board listings
- Index Data - Stock indices, index components, performance data
Fixed Income & Rates
- Bonds - Government bonds, corporate bonds, municipal bonds
- Interest Rates - LPR rates, deposit/loan rates, yield curves
Derivatives & Futures
- Futures - Futures contracts, open interest, delivery data
- Options - Options contracts, Greeks, implied volatility
Alternative Assets
- Funds - Public funds (mutual funds), private funds (hedge funds), fund ratings
- QDII - Qualified Domestic Institutional Investor products
- Commodities & Spot Trading - Commodity futures, spot market data
Forex & International
- Foreign Exchange (FX) - Currency pairs, exchange rates
- Hong Kong/Singapore Data (QHKC) - Hong Kong stocks, Singapore data, commodity analysis
Macro & Economics
- Macroeconomic Data - GDP, CPI, industrial production, consumer spending
- Currency & FX Markets - Currency data, forex indicators
- Energy Data - Oil, coal, natural gas prices and data
- Interest Rates - Central bank rates, yield curves
Specialized Data
- Bank Data - Bank regulatory data, administrative penalties
- Data Center (DC) - Data center services and infrastructure
- Digital Currency - Cryptocurrency and digital asset data
- Events & News - Market events, corporate actions, news events
- Natural Language Processing - Text analysis, sentiment analysis
- Technical Indicators & Tools - Technical analysis tools, indicators
- Financial Articles - Financial research articles and reports
- Others - Additional specialized data sources
API Documentation Structure
Each reference file contains:
- API name - The function name (e.g.,
stock_zh_a_hist) - Target URL - Data source web address
- Description - What the API provides
- Rate limits - Data return limits per request
- Input parameters - Function parameters with types and descriptions
- Output parameters - DataFrame columns returned by the API
- Code example - Working Python example
- Data sample - Sample output rows
Parameter Conventions
Common parameter patterns across AKShare APIs:
symbol- Stock symbol (e.g., "000001" for SZZF)start_date/end_date- Date strings in format "YYYYMMDD" (e.g., "20200101")period- Time period ("daily", "weekly", "monthly")page/limit- Pagination parameters for large datasets- Date output - Most APIs return datetime columns in format "YYYY-MM-DD HH:MM:SS"
Multi-Part Categories
Some data categories have multiple sub-APIs:
- Funds (references/fund/) - Public funds vs. private funds documentation
- QHKC (references/qhkc/) - Hong Kong stocks, fundamentals, brokers, commodities, analysis tools
Finding What You Need
By asset class: Start with the category above that matches your market focus
By function: If you know the AKShare function name, search within the corresponding reference file using grep patterns:
- Stock functions:
stock_ - Fund functions:
fund_ - Futures functions:
futures_orfuture_ - Forex functions:
fx_orexchange_
By data type: All APIs include parameter tables and examples. Look for "Input parameters" and "Output parameters" sections.
Example Usage Patterns
Get historical stock data:
See references/stock.md - use stock_zh_a_hist() function
Access futures data:
See references/futures.md - functions like futures_open_interest(), futures_delivery()
Query fund performance:
See references/fund/fund_public.md for mutual funds or references/fund/fund_private.md for private funds
Macroeconomic indicators:
See references/macro.md - GDP, inflation, industrial production
Hong Kong/Singapore market data:
See references/qhkc/ subdirectory for index data, fundamentals, and analysis tools
CLI Usage Guide
All AKShare functions are available via the CLI wrapper in scripts/akshare_cli.py.
Output Formats
--format json: JSON format for API integration (default)--format pretty: Human-readable tables--format csv: CSV format for import into Excel/databases (use when complex analysis is needed)
Examples by Category
# Stock data
python3 scripts/akshare_cli.py stock_zh_a_hist --symbol 000001 --start_date 20240101 --end_date 20240110
# Index data
python3 scripts/akshare_cli.py index_zh_a_hist --symbol 000001 --start_date 20240101 --end_date 20240110
# Macro data
python3 scripts/akshare_cli.py macro_china_gdp --format json
# Bank data
python3 scripts/akshare_cli.py bank_fjcf_table_detail --page 1 --item "分局本级"
# Export to file
python3 scripts/akshare_cli.py stock_zh_a_hist --symbol 000001 --start_date 20240101 --end_date 20240110 --format csv > output.csv
See CLI_DESIGN.md for complete CLI documentation.