Skip to main content

Intelligent caching wrapper for AKShare with 90%+ performance boost - 100% English codebase (import as 'qdb')

Project description

QuantDB - Intelligent Stock Data Caching

PyPI version PyPI - Downloads PyPI - Python Version License: MIT Performance

Intelligent caching wrapper for AKShare with 90%+ performance boost - Complete stock data ecosystem with smart SQLite caching for Chinese financial markets.

📊 Note: Download statistics may take 24-48 hours to appear on PyPI and third-party services after a new release.

🚀 Quick Start

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)  # 90%+ faster than AKShare!

✨ Key Features

  • 🚀 90%+ Performance Boost: Local SQLite cache avoids repeated network requests
  • 🧠 Smart Incremental Updates: Only fetch missing data, maximize cache efficiency
  • ⚡ Millisecond Response: Cache hit response time < 10ms
  • 📅 Trading Calendar Integration: Smart data acquisition based on real trading calendar
  • 🔧 Zero Configuration: Automatically initialize local cache database
  • 🔄 Full AKShare Compatibility: Drop-in replacement with same API interface
  • 🌍 100% English Codebase: International developer friendly
  • 🎯 Multi-Market Support: A-shares + Hong Kong stocks unified API

📊 Performance Comparison

Operation AKShare QuantDB Improvement
First Request ~1000ms ~1000ms Same
Cache Hit ~1000ms ~18ms 98.1% faster
Bulk Operations Very Slow Lightning Fast 90%+ faster

🔧 Core API

Basic Usage

import qdb

# Get stock data (with intelligent caching)
df = qdb.get_stock_data("000001", days=30)
df = qdb.get_stock_data("600000", start_date="20240101", end_date="20240201")

# Multiple stocks
stocks_data = qdb.get_multiple_stocks(["000001", "000002"], days=30)

# Asset information
asset_info = qdb.get_asset_info("000001")

# Cache management
stats = qdb.cache_stats()  # View cache statistics
qdb.clear_cache()         # Clear cache if needed

New Features (v2.2.6)

import qdb

# Real-time stock quotes
realtime = qdb.get_realtime_data("000001")
batch_realtime = qdb.get_realtime_data_batch(["000001", "000002"])

# Complete stock list
stock_list = qdb.get_stock_list()

# Financial data
financial_summary = qdb.get_financial_summary("000001")
financial_indicators = qdb.get_financial_indicators("000001")

AKShare Compatibility

import qdb

# 100% compatible with AKShare API
df = qdb.stock_zh_a_hist("000001", start_date="20240101", end_date="20240201")

Configuration

import qdb

# Custom cache directory
qdb.set_cache_dir("./my_custom_cache")

# Logging level
qdb.set_log_level("INFO")  # DEBUG, INFO, WARNING, ERROR

🎯 Use Cases

  • Quantitative Research: Frequent backtesting with cached historical data
  • Algorithm Trading: Real-time data access with minimal latency
  • Financial Analysis: Large-scale data processing with performance optimization
  • Portfolio Management: Multi-asset data retrieval and analysis
  • Academic Research: Reliable data source for financial studies

🎉 New in v2.2.6

  • ✅ Real-time Stock Quotes: Live market data with smart caching
  • ✅ Stock List API: Complete market coverage and filtering
  • ✅ Index Data: Major indices support (SSE, SZSE, etc.)
  • ✅ Financial Metrics: Key financial indicators and ratios

📚 Documentation & Support

🏗️ Architecture

QuantDB provides multiple deployment options:

  1. 📦 Python Package (This Package): Local caching for individual developers
  2. 🚀 API Service: Enterprise-grade REST API with advanced features
  3. ☁️ Cloud Platform: Web interface with visualization and monitoring

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built on top of the excellent AKShare library
  • Inspired by the need for high-performance financial data access in Python

Note: Package name is quantdb, import name is qdb (similar to scikit-learn → sklearn)

Made with ❤️ for the Python quantitative finance community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantdb-2.2.7.tar.gz (127.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantdb-2.2.7-py3-none-any.whl (90.8 kB view details)

Uploaded Python 3

File details

Details for the file quantdb-2.2.7.tar.gz.

File metadata

  • Download URL: quantdb-2.2.7.tar.gz
  • Upload date:
  • Size: 127.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for quantdb-2.2.7.tar.gz
Algorithm Hash digest
SHA256 1e8aefaa8a9bea0bdd511000fe71fe00c12008548ee186de63b4398c09717b8f
MD5 00a9f558037ea2e16703e8588f740ce0
BLAKE2b-256 37fa296285b06ea3ba15fd515973e064b9bbb422549cf243f80b9d879afa49af

See more details on using hashes here.

File details

Details for the file quantdb-2.2.7-py3-none-any.whl.

File metadata

  • Download URL: quantdb-2.2.7-py3-none-any.whl
  • Upload date:
  • Size: 90.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for quantdb-2.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9eb96096afedaab84b49b71b000d1e5add24e1996a0b94901ae0988b51ed31e7
MD5 2cb5ed538930990a3407e62af1dad389
BLAKE2b-256 c4287dbcb88b08a21d8a0664c9c23489d4143ae75e7532cc822e792e15137a53

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page