mirror of
https://github.com/succ985/openclaw-akshare-skill.git
synced 2026-09-14 20:50:58 +08:00
master
OpenClaw AkShare Skill
Chinese financial data access using AkShare library for OpenClaw.
Overview
This skill provides easy access to Chinese financial market data through the AkShare library. It supports real-time and historical data for:
- A-shares (A股): Shanghai and Shenzhen stock exchanges
- Hong Kong stocks (港股): HKEX
- US stocks (美股): US market data
- Futures (期货): Commodity and index futures
- Funds (基金): Open-end and ETF funds
- Macroeconomic indicators (宏观): GDP, CPI, PMI, and more
Installation
Prerequisites
- Python 3.7+
- OpenClaw framework
Install AkShare
pip install akshare
Or use the provided installation script:
bash scripts/install_akshare.sh
Install the Skill
Copy this skill to your OpenClaw workspace:
cp -r openclaw-akshare-skill /path/to/openclaw/workspace/skills/akshare
Quick Start
Basic Stock Quote
import akshare as ak
# Get all A-shares real-time data
df = ak.stock_zh_a_spot_em()
print(df.head())
Historical Stock Data
# Get historical daily data for a specific stock
df = ak.stock_zh_a_hist(
symbol="000001",
period="daily",
start_date="20240101",
end_date="20241231",
adjust="qfq" # Forward adjustment
)
print(df.tail())
Features
Stock Data
- Real-time quotes: All A-shares, Hong Kong stocks, US stocks
- Historical data: Daily, weekly, monthly periods with price adjustment
- Stock list: Complete stock code and name information
Futures Data
- Commodity futures real-time data
- Historical futures data from major exchanges
Fund Data
- Open-end fund information
- Fund historical net value trends
Macroeconomic Indicators
- GDP, CPI, PPI, PMI
- Economic calendar and indicators
Common Parameters
Period (周期)
daily- Daily (日线)weekly- Weekly (周线)monthly- Monthly (月线)
Price Adjustment (复权)
qfq- Forward adjustment (前复权)hfq- Backward adjustment (后复权)""- No adjustment (不复权)
Examples
See the scripts/ directory for more examples:
example_usage.py- Common usage examplestest_basic.py- Basic functionality teststest_quick.py- Quick start examples
Documentation
- SKILL.md - Complete skill documentation
- references/akshare_api.md - Detailed API reference
- references/common_functions.md - Commonly used functions
- Official AkShare Docs
Tips
- Data caching: AkShare doesn't cache data by default. Implement your own caching if needed
- Rate limiting: Be mindful of request frequency to avoid being blocked
- Data format: Returns pandas DataFrame, can be easily processed
- Error handling: Network errors may occur, implement retry logic
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for version history.
Acknowledgments
- AkShare - The underlying Python library for Chinese financial data
- OpenClaw - The AI assistant framework
Support
For issues and questions:
- Open an issue on GitHub
- Check AkShare documentation
- Review the examples in the
scripts/directory
Languages
Python
98.5%
Shell
1.5%