English | δΈζηζ¬
Intelligent caching wrapper for AKShare with 90%+ performance boost - Complete stock data ecosystem with smart SQLite caching for Chinese financial markets. Perfect for quantitative trading, financial analysis, and algorithmic trading in Python.
Intelligent caching wrapper for AKShare with 90%+ performance boost - Complete stock data ecosystem with smart SQLite caching for Chinese financial markets.
pip install quantdb # One command, instant 90%+ speed boost!import qdb # Note: import name is 'qdb' for simplicity
df = qdb.get_stock_data("000001", days=30)
# New in v2.2.9: Multi-market support!
df_china = qdb.get_stock_data("000001", days=30) # China A-shares
df_hk = qdb.get_stock_data("00700", days=30) # Hong Kong stocks
realtime = qdb.get_realtime_data("000001") # Real-time quotes
financials = qdb.get_financial_summary("000001") # Financial dataThree product formats: Python Package, API Service, and Cloud Platform for different user needs.
pip install quantdbimport qdb # Note: Package name is 'quantdb', import name is 'qdb'
df = qdb.get_stock_data("000001", days=30) # 90%+ faster than AKShare!Perfect for: Quantitative researchers, Python developers, data scientists
Import Note: Install as quantdb, import as qdb (like scikit-learn β sklearn)
curl "https://your-api.com/api/v1/stocks/000001/data?days=30"Perfect for: Enterprise teams, multi-user applications, production systems
Visit: QuantDB Cloud Platform Perfect for: Individual investors, data analysis, visualization
- π 90%+ Performance Boost: Smart SQLite caching, millisecond response time
- π¦ Multiple Product Forms: Python package, API service, cloud platform
- π Full AKShare Compatibility: Same API interface, seamless replacement
- πΎ Local Caching: Offline available, intelligent incremental updates
- π Trading Calendar Integration: Smart data fetching based on real trading days
- π οΈ Zero Configuration: pip install and ready to use
- βοΈ Cloud Deployment Ready: Supports Railway, Render, Alibaba Cloud, etc.
- π§ Intelligent Updates: Automatic missing data detection and fetching
- β‘ Real-time Data: Live stock quotes and market data
- π Financial Analytics: Complete financial indicators and ratios
- π Index Data: Major market indices support (SSE, SZSE, etc.)
- π Stock Lists: Complete market coverage and filtering
| Metric | Direct AKShare Call | QuantDB Package | Performance Improvement |
|---|---|---|---|
| Response Time | ~1000ms | ~10ms | 99% β¬οΈ |
| Cache Hit | N/A | 90%+ | Smart Cache β |
| Trading Day Recognition | Manual | Automatic | Intelligent π§ |
| Installation | Complex setup | pip install quantdb |
One Command π |
Important: Package name and import name are different (common practice in Python ecosystem)
# Install the package
pip install quantdb# Import the package (note: import name is 'qdb')
import qdb
# Start using immediately
df = qdb.get_stock_data("000001", days=30)
stats = qdb.cache_stats()Why different names?
- Package name:
quantdb(descriptive, searchable on PyPI) - Import name:
qdb(concise, easy to type) - Similar to:
scikit-learnβsklearn,beautifulsoup4βbs4
# Install the package
pip install quantdb
# Import and use (note the different import name)
python -c "
import qdb # Package: quantdb, Import: qdb
df = qdb.get_stock_data('000001', days=30)
print(f'Got {len(df)} records with 90%+ speed boost!')
print('β
QuantDB package working perfectly!')
"Direct access to deployed Streamlit Cloud version:
- Frontend Interface: QuantDB Cloud
- Complete Features: Stock data query, asset information, cache monitoring, watchlist management
# Clone repository
git clone https://github.com/franksunye/quantdb.git
cd quantdb
# Install dependencies
pip install -r requirements.txt
# Initialize database
python src/scripts/init_db.pyMethod 1: One-click Start (Recommended)
# Enter frontend directory and run startup script
cd quantdb_frontend
python start.py
# Script will automatically start backend API and frontend interfaceMethod 2: Manual Start
# 1. Start backend API (in project root)
python src/api/main.py
# 2. Start frontend interface (in new terminal)
cd quantdb_frontend
streamlit run app.py
# Access URLs
# Frontend Interface: http://localhost:8501
# API Documentation: http://localhost:8000/docsMethod 3: Cloud Version Local Run
# Run Streamlit Cloud version (integrated backend services)
cd cloud/streamlit_cloud
streamlit run app.py
# Access URL: http://localhost:8501# Health check
curl http://localhost:8000/api/v1/health
# Get stock data (auto-cached, displays real company names)
curl "http://localhost:8000/api/v1/historical/stock/600000?start_date=20240101&end_date=20240131"
# Get asset information (includes financial metrics)
curl "http://localhost:8000/api/v1/assets/symbol/600000"
# View cache status
curl http://localhost:8000/api/v1/cache/status# Run backend tests
python scripts/test_runner.py --all
# Run frontend tests
cd quantdb_frontend
python run_tests.py
# Run performance tests
python scripts/test_runner.py --performanceQuantDB is optimized for AI agent integration with comprehensive machine-readable documentation and standardized APIs.
- π Standardized Docstrings: All functions use Google Style format with detailed parameter constraints
- π§ Machine-Readable Schema: Complete API specification in JSON format
- π‘ Usage Examples: Comprehensive examples for financial and index data analysis
β οΈ Error Handling: Detailed exception documentation with recovery strategies- π― Type Safety: Full type hints for all function parameters and return values
import qdb
# AI agents can access complete documentation
help(qdb.get_stock_data) # Detailed function documentation
help(qdb.get_financial_summary) # Financial analysis functions
help(qdb.get_index_data) # Market index functions
# Example: AI agent can generate this code confidently
df = qdb.get_stock_data("000001", days=30) # Get recent stock data
summary = qdb.get_financial_summary("000001") # Get financial metrics
realtime = qdb.get_realtime_data("000001") # Get current quotes- API Schema: qdb-ai-agent-schema.json - Machine-readable API specification
- Usage Examples: AI Agent Examples - Complete usage patterns
- Financial Analysis: Financial Examples - Advanced analysis workflows
- Documentation Guide: AI Agent Guide - Integration best practices
With QuantDB, AI agents can:
- β Understand precise API functionality with detailed parameter constraints
- β Generate correct code with proper error handling
- β Perform advanced financial analysis with 80+ financial indicators
- β Access comprehensive market data including stocks, indices, and real-time quotes
- β Optimize performance using intelligent caching strategies
- Stock Analysis: Historical data, real-time quotes, technical indicators
- Financial Analysis: Quarterly reports, financial ratios, profitability metrics
- Index Analysis: Market indices, sector performance, trend analysis
- Portfolio Management: Multi-stock analysis, performance comparison
QuantDB adopts modern microservice architecture with the following core components:
- π§ Core Services: Unified business logic layer supporting multiple deployment modes
- π‘ FastAPI Backend: High-performance REST API service
- π± Streamlit Frontend: Interactive data analysis interface
- βοΈ Cloud Deployment: Cloud deployment version supporting Streamlit Cloud
- π§ͺ Comprehensive Testing: Complete test suite covering unit, integration, API, E2E tests
- π Smart Caching: Intelligent caching system based on trading calendar
For detailed architecture design, please refer to System Architecture Documentation.
- Backend: FastAPI + SQLAlchemy + SQLite
- Frontend: Streamlit + Plotly + Pandas
- Data Source: AKShare (Official Stock Data)
- Caching: Smart database caching + trading calendar
- Testing: pytest + unittest (259 tests, 100% pass rate)
- Monitoring: Real-time performance monitoring and data tracking
- Logging: Unified logging system with completely consistent recording
- Integration: Complete frontend-backend integration solution
| Document | Description |
|---|---|
| π Project Status | Current progress and priorities |
| π Changelog | Version history and changes |
| ποΈ System Architecture | Architecture design and components |
| ποΈ Database Architecture | Database design and models |
| π API Documentation | Complete API usage guide |
| π οΈ Development Guide | Development environment and workflow |
| π§ͺ Testing Guide | Test execution and writing |
| π Trading Calendar Upgrade | Multi-market trading calendar system upgrade |
| π DeepWiki Knowledge Base | Comprehensive knowledge base and documentation |
We welcome your feedback and are here to help! Choose the best channel for your needs:
- GitHub Issues: Report bugs or request features
- Please include version info, error messages, and reproduction steps
- GitHub Discussions: Join the conversation
- π Q&A - Get help with usage questions
- π‘ Ideas - Share feature ideas and suggestions
- π Show and Tell - Share your projects using QuantDB
- π£ Announcements - Stay updated with latest news
- Quick Help: FAQ
- Migration Guide: AKShare β QuantDB
- Full Documentation: https://franksunye.github.io/quantdb/
- PyPI Package: https://pypi.org/project/quantdb/
- Live Demo: https://quantdb-cloud.streamlit.app/
Response time: We aim to respond to issues within 24-48 hours. For urgent matters, please use GitHub Issues.
Current Version: v2.2.8 (Complete Multi-Feature Extension) Next Version: v2.3.0 (Enhanced Analytics and Performance) MVP Score: 10/10 (Core features complete, cloud deployment ready) Test Coverage: 259/259 passed (100%) - 222 backend + 37 frontend Data Quality: βββββ (5/5) - Real company names and financial metrics Frontend Experience: βββββ (5/5) - Professional quantitative data platform interface Integration Status: β Complete frontend-backend integration, cloud deployment ready Production Ready: βββββ (5/5) - Cloud deployment version complete Cloud Deployment: β Streamlit Cloud version, directly using backend services
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: https://github.com/franksunye/quantdb
- API Documentation: http://localhost:8000/docs (access after starting service)
- Project Maintainer: frank
β If this project helps you, please give it a Star!