AKShare is an elegant and simple financial data interface library for Python, built for human beings! It provides a comprehensive set of tools for acquiring fundamental, real-time, and historical market data for various financial products like stocks, futures, options, funds, foreign exchange, bonds, and cryptocurrencies. The library is actively developed with frequent releases, often multiple minor versions per day, to adapt to changes in data sources.
pip install akshare --upgradeVerified import paths — ran on the pinned version, not inferred.
This quickstart fetches historical daily A-share stock data for a specified symbol and date range using the `stock_zh_a_hist` interface. The `adjust` parameter can be used for different ex-dividend adjustments.
Regularly run `pip install akshare --upgrade` and consult the official documentation for updated interface names (e.g., check the '接口更名一览表' section for changes).
Understand the limitations of scraped data and use dedicated broker APIs for high-frequency or production trading systems.
Ensure your Python environment is `3.9` or higher, ideally `3.13.x`.
Check interface documentation for parameter availability; if not present, filter the returned DataFrame using Pandas after data retrieval.
Avoid naming your Python script files `akshare.py`. Choose a different, descriptive name for your scripts.
Implement retry logic, utilize a proxy server (if configured), or decrease the rate of data requests to mitigate these issues.
If encountering `execjs._exceptions.RuntimeUnavailableError`, install `Node.js` in your environment.