# A-Stock-Data — Full-Stack Data Toolkit for China A-Share Markets > Open-source Python data toolkit covering 43 endpoints and 15 data sources for comprehensive China A-share stock market analysis. ## Install Save as a script file and run: # A-Stock-Data — Full-Stack Data Toolkit for China A-Share Markets ## Quick Use ```bash pip install a-stock-data python -c "from a_stock_data import market; print(market.get_realtime('600519'))" ``` ## Introduction A-Stock-Data is an open-source Python toolkit that provides comprehensive data access for the China A-share stock market. With 43 endpoints across 15 data sources, it covers real-time quotes, research reports, capital flows, chip distribution, company announcements, ETF options, and market sentiment — all with built-in fallback sources for reliability. ## What A-Stock-Data Does - Fetches real-time and historical price data for all A-share listed stocks - Retrieves institutional research reports and analyst ratings - Tracks capital flows including northbound (QFII) and block trade data - Provides chip distribution and shareholder concentration analysis - Aggregates company announcements, financial statements, and board activity ## Architecture Overview The toolkit uses a 10-layer architecture with data source adapters at the bottom, a normalization layer that standardizes output across sources, a caching layer for rate-limit management, and a clean Python API at the top. Each endpoint has up to 3 fallback data sources that activate automatically on failure. Data is returned as pandas DataFrames for easy integration with analysis workflows. ## Self-Hosting & Configuration - Install from PyPI with pip install a-stock-data - No API keys required for basic market data from public sources - Configure premium data sources (e.g., Wind, Choice) in config.yaml if available - Built-in request rate limiting respects source quotas automatically - Works as a library in scripts or as an MCP server for agent integration ## Key Features - 43 endpoints covering quotes, fundamentals, technicals, sentiment, and alternatives - 15 integrated data sources with automatic failover and degradation - Pandas DataFrame output for seamless integration with data science workflows - Built-in rate limiting and caching for responsible data access - MCP server mode for direct use by AI agents in research workflows ## Comparison with Similar Tools - **Tushare** — popular A-share data library but requires registration and has strict rate limits; A-Stock-Data offers more fallback sources - **AkShare** — broad financial data library; A-Stock-Data focuses deeper on A-share with more endpoints per category - **baostock** — free A-share data with limited real-time support; A-Stock-Data adds real-time quotes and sentiment data - **Wind/Choice API** — commercial terminals with comprehensive data; A-Stock-Data provides a free open-source alternative - **yfinance** — designed for US markets; A-Stock-Data is purpose-built for China A-shares ## FAQ **Q: Is an API key required?** A: No, basic endpoints use publicly available data sources. Premium sources can be optionally configured. **Q: How real-time is the data?** A: Real-time quotes have a typical delay of 1-3 seconds depending on the source, matching most free data APIs. **Q: Can I use this for backtesting?** A: Yes, historical data endpoints provide daily, weekly, and minute-level OHLCV data suitable for backtesting frameworks. **Q: Does it support Hong Kong or US stocks?** A: The primary focus is China A-shares (Shanghai and Shenzhen exchanges). Some endpoints include Hong Kong Connect data. ## Sources - https://github.com/simonlin1212/a-stock-data --- Source: https://tokrepo.com/en/workflows/asset-d5128596 Author: Script Depot