quantdb


Namequantdb JSON
Version 2.2.6 PyPI version JSON
download
home_pagehttps://github.com/franksunye/quantdb
SummaryIntelligent caching wrapper for AKShare with 90%+ performance boost - 100% English codebase (import as 'qdb')
upload_time2025-08-05 13:57:39
maintainerNone
docs_urlNone
authorYe Sun
requires_python>=3.8
licenseMIT
keywords stock finance akshare cache quantitative trading investment qdb quantdb
VCS
bugtrack_url
requirements pandas numpy akshare fastapi uvicorn pydantic httpx sqlalchemy psycopg2-binary alembic python-jose passlib python-multipart pytest pytest-cov python-dotenv schedule requests
Travis-CI No Travis.
coveralls test coverage
            # QuantDB - Intelligent Stock Data Caching

[![PyPI version](https://img.shields.io/pypi/v/quantdb.svg)](https://pypi.org/project/quantdb/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/quantdb)](https://pypi.org/project/quantdb/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quantdb)](https://pypi.org/project/quantdb/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Performance](https://img.shields.io/badge/performance-90%25_faster-brightgreen)](https://github.com/franksunye/quantdb)

**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

```bash
pip install quantdb  # One command, instant 90%+ speed boost!
```

```python
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
```python
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
```

### AKShare Compatibility
```python
import qdb

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

### Configuration
```python
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

## 🔄 Coming Soon (v2.3.0)

- **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

- **GitHub Repository**: [https://github.com/franksunye/quantdb](https://github.com/franksunye/quantdb)
- **Full Documentation**: [https://github.com/franksunye/quantdb/docs](https://github.com/franksunye/quantdb/docs)
- **Issue Tracker**: [https://github.com/franksunye/quantdb/issues](https://github.com/franksunye/quantdb/issues)
- **API Reference**: Complete API documentation with examples

## 🏗️ 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](https://github.com/franksunye/quantdb/blob/main/CONTRIBUTING.md) for details.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/franksunye/quantdb/blob/main/LICENSE) file for details.

## 🙏 Acknowledgments

- Built on top of the excellent [AKShare](https://github.com/akfamily/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*



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/franksunye/quantdb",
    "name": "quantdb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "stock, finance, akshare, cache, quantitative, trading, investment, qdb, quantdb",
    "author": "Ye Sun",
    "author_email": "franksunye@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/ce/5ba2e707c60dc4ff6b4a8e12dcc1b1ead293f1f9e0e0a33400ebd5a91fb6/quantdb-2.2.6.tar.gz",
    "platform": "any",
    "description": "# QuantDB - Intelligent Stock Data Caching\n\n[![PyPI version](https://img.shields.io/pypi/v/quantdb.svg)](https://pypi.org/project/quantdb/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/quantdb)](https://pypi.org/project/quantdb/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quantdb)](https://pypi.org/project/quantdb/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Performance](https://img.shields.io/badge/performance-90%25_faster-brightgreen)](https://github.com/franksunye/quantdb)\n\n**Intelligent caching wrapper for AKShare with 90%+ performance boost** - Complete stock data ecosystem with smart SQLite caching for Chinese financial markets.\n\n> \ud83d\udcca **Note**: Download statistics may take 24-48 hours to appear on PyPI and third-party services after a new release.\n\n## \ud83d\ude80 Quick Start\n\n```bash\npip install quantdb  # One command, instant 90%+ speed boost!\n```\n\n```python\nimport qdb  # Note: import name is 'qdb' for simplicity\ndf = qdb.get_stock_data(\"000001\", days=30)  # 90%+ faster than AKShare!\n```\n\n## \u2728 Key Features\n\n- **\ud83d\ude80 90%+ Performance Boost**: Local SQLite cache avoids repeated network requests\n- **\ud83e\udde0 Smart Incremental Updates**: Only fetch missing data, maximize cache efficiency  \n- **\u26a1 Millisecond Response**: Cache hit response time < 10ms\n- **\ud83d\udcc5 Trading Calendar Integration**: Smart data acquisition based on real trading calendar\n- **\ud83d\udd27 Zero Configuration**: Automatically initialize local cache database\n- **\ud83d\udd04 Full AKShare Compatibility**: Drop-in replacement with same API interface\n- **\ud83c\udf0d 100% English Codebase**: International developer friendly\n- **\ud83c\udfaf Multi-Market Support**: A-shares + Hong Kong stocks unified API\n\n## \ud83d\udcca Performance Comparison\n\n| Operation | AKShare | QuantDB | Improvement |\n|-----------|---------|---------|-------------|\n| First Request | ~1000ms | ~1000ms | Same |\n| Cache Hit | ~1000ms | ~18ms | **98.1% faster** |\n| Bulk Operations | Very Slow | Lightning Fast | **90%+ faster** |\n\n## \ud83d\udd27 Core API\n\n### Basic Usage\n```python\nimport qdb\n\n# Get stock data (with intelligent caching)\ndf = qdb.get_stock_data(\"000001\", days=30)\ndf = qdb.get_stock_data(\"600000\", start_date=\"20240101\", end_date=\"20240201\")\n\n# Multiple stocks\nstocks_data = qdb.get_multiple_stocks([\"000001\", \"000002\"], days=30)\n\n# Asset information\nasset_info = qdb.get_asset_info(\"000001\")\n\n# Cache management\nstats = qdb.cache_stats()  # View cache statistics\nqdb.clear_cache()         # Clear cache if needed\n```\n\n### AKShare Compatibility\n```python\nimport qdb\n\n# 100% compatible with AKShare API\ndf = qdb.stock_zh_a_hist(\"000001\", start_date=\"20240101\", end_date=\"20240201\")\n```\n\n### Configuration\n```python\nimport qdb\n\n# Custom cache directory\nqdb.set_cache_dir(\"./my_custom_cache\")\n\n# Logging level\nqdb.set_log_level(\"INFO\")  # DEBUG, INFO, WARNING, ERROR\n```\n\n## \ud83c\udfaf Use Cases\n\n- **Quantitative Research**: Frequent backtesting with cached historical data\n- **Algorithm Trading**: Real-time data access with minimal latency\n- **Financial Analysis**: Large-scale data processing with performance optimization\n- **Portfolio Management**: Multi-asset data retrieval and analysis\n- **Academic Research**: Reliable data source for financial studies\n\n## \ud83d\udd04 Coming Soon (v2.3.0)\n\n- **Real-time Stock Quotes**: Live market data with smart caching\n- **Stock List API**: Complete market coverage and filtering\n- **Index Data**: Major indices support (SSE, SZSE, etc.)\n- **Financial Metrics**: Key financial indicators and ratios\n\n## \ud83d\udcda Documentation & Support\n\n- **GitHub Repository**: [https://github.com/franksunye/quantdb](https://github.com/franksunye/quantdb)\n- **Full Documentation**: [https://github.com/franksunye/quantdb/docs](https://github.com/franksunye/quantdb/docs)\n- **Issue Tracker**: [https://github.com/franksunye/quantdb/issues](https://github.com/franksunye/quantdb/issues)\n- **API Reference**: Complete API documentation with examples\n\n## \ud83c\udfd7\ufe0f Architecture\n\nQuantDB provides multiple deployment options:\n\n1. **\ud83d\udce6 Python Package** (This Package): Local caching for individual developers\n2. **\ud83d\ude80 API Service**: Enterprise-grade REST API with advanced features  \n3. **\u2601\ufe0f Cloud Platform**: Web interface with visualization and monitoring\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](https://github.com/franksunye/quantdb/blob/main/CONTRIBUTING.md) for details.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/franksunye/quantdb/blob/main/LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- Built on top of the excellent [AKShare](https://github.com/akfamily/akshare) library\n- Inspired by the need for high-performance financial data access in Python\n\n---\n\n**Note**: Package name is `quantdb`, import name is `qdb` (similar to scikit-learn \u2192 sklearn)\n\n*Made with \u2764\ufe0f for the Python quantitative finance community*\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Intelligent caching wrapper for AKShare with 90%+ performance boost - 100% English codebase (import as 'qdb')",
    "version": "2.2.6",
    "project_urls": {
        "Bug Reports": "https://github.com/franksunye/quantdb/issues",
        "Documentation": "https://github.com/franksunye/quantdb/docs",
        "Homepage": "https://github.com/franksunye/quantdb",
        "Source": "https://github.com/franksunye/quantdb"
    },
    "split_keywords": [
        "stock",
        " finance",
        " akshare",
        " cache",
        " quantitative",
        " trading",
        " investment",
        " qdb",
        " quantdb"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "42aca015b2a69f58764d5acd0b05fe99e30c398bc2a36446c7d4f651f617fe02",
                "md5": "5a9abcdf3f4b6d1a690372c4e00afbe4",
                "sha256": "f62131ce74f61f812d79bb3ac0bfbec9a3b96bf3b432973a4f1f12859c7b0acc"
            },
            "downloads": -1,
            "filename": "quantdb-2.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a9abcdf3f4b6d1a690372c4e00afbe4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 57300,
            "upload_time": "2025-08-05T13:57:37",
            "upload_time_iso_8601": "2025-08-05T13:57:37.916185Z",
            "url": "https://files.pythonhosted.org/packages/42/ac/a015b2a69f58764d5acd0b05fe99e30c398bc2a36446c7d4f651f617fe02/quantdb-2.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7ace5ba2e707c60dc4ff6b4a8e12dcc1b1ead293f1f9e0e0a33400ebd5a91fb6",
                "md5": "427ffefa2a544f5e8abf0b7a7dea44d7",
                "sha256": "d67423a104c7ce5e099014fd4708a9782e94918538b3952d62c5bcecb774a57f"
            },
            "downloads": -1,
            "filename": "quantdb-2.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "427ffefa2a544f5e8abf0b7a7dea44d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 101119,
            "upload_time": "2025-08-05T13:57:39",
            "upload_time_iso_8601": "2025-08-05T13:57:39.937749Z",
            "url": "https://files.pythonhosted.org/packages/7a/ce/5ba2e707c60dc4ff6b4a8e12dcc1b1ead293f1f9e0e0a33400ebd5a91fb6/quantdb-2.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 13:57:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "franksunye",
    "github_project": "quantdb",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.3.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.20.0"
                ]
            ]
        },
        {
            "name": "akshare",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "fastapi",
            "specs": [
                [
                    ">=",
                    "0.68.0"
                ]
            ]
        },
        {
            "name": "uvicorn",
            "specs": [
                [
                    ">=",
                    "0.15.0"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "1.8.0"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    ">=",
                    "0.18.0"
                ]
            ]
        },
        {
            "name": "sqlalchemy",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "psycopg2-binary",
            "specs": [
                [
                    ">=",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "alembic",
            "specs": [
                [
                    ">=",
                    "1.7.0"
                ]
            ]
        },
        {
            "name": "python-jose",
            "specs": [
                [
                    ">=",
                    "3.3.0"
                ]
            ]
        },
        {
            "name": "passlib",
            "specs": [
                [
                    ">=",
                    "1.7.4"
                ]
            ]
        },
        {
            "name": "python-multipart",
            "specs": [
                [
                    ">=",
                    "0.0.5"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "6.2.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "2.12.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "0.19.0"
                ]
            ]
        },
        {
            "name": "schedule",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.26.0"
                ]
            ]
        }
    ],
    "lcname": "quantdb"
}
        
Elapsed time: 0.49025s