Metadata-Version: 2.4
Name: quantcoda
Version: 0.1.1
Summary: QuantCoda A 股量化数据 API 官方 Python SDK：行情、财务、资金流、龙虎榜，一个 Key 全部拿到
Author-email: QuantCoda <support@quantcoda.com>
License-Expression: MIT
Project-URL: Official Website, https://quantcoda.com
Project-URL: Documentation, https://quantcoda.com/docs
Project-URL: Create API Key, https://quantcoda.com/register?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=project_links
Project-URL: Pricing, https://quantcoda.com/pricing?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=project_links
Project-URL: Hosted MCP Server, https://quantcoda.com/mcp
Project-URL: Repository, https://github.com/ChuYiCui1/quantcoda-python
Project-URL: Issues, https://github.com/ChuYiCui1/quantcoda-python/issues
Project-URL: Changelog, https://quantcoda.com/changelog
Keywords: quant,a-share,stock,market-data,financial-data,api
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Requires-Dist: pandas>=1.5
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Dynamic: license-file

# QuantCoda Python SDK

[![tests](https://github.com/ChuYiCui1/quantcoda-python/actions/workflows/tests.yml/badge.svg)](https://github.com/ChuYiCui1/quantcoda-python/actions/workflows/tests.yml) [![PyPI](https://img.shields.io/pypi/v/quantcoda)](https://pypi.org/project/quantcoda/)

[官网](https://quantcoda.com/?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=readme) · [API 文档](https://quantcoda.com/docs?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=readme) · [免费注册](https://quantcoda.com/register?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=readme) · [MCP 接入](https://quantcoda.com/docs?utm_source=pypi&utm_medium=referral&utm_campaign=python_sdk&utm_content=readme_mcp)

[QuantCoda](https://quantcoda.com) 官方 Python SDK —— A 股行情、财务、资金流、筹码、龙虎榜，45 个数据接口，一个 API Key 全部拿到。

## 安装

```bash
pip install quantcoda
```

## 快速开始

```python
import quantcoda as qc

qc.set_token("qc_live_你的密钥")   # 免费注册: https://quantcoda.com/register

# 贵州茅台 2026 年以来的日线（返回 pandas.DataFrame）
df = qc.daily(symbol="600519.SH", start_date="20260101")

# 每日指标 / 财务 / 资金流 / 龙虎榜……全部同一姿势
qc.fundamentals(symbol="600519.SH", trade_date="20260710")
qc.income(symbol="600519.SH", period="20251231")
qc.moneyflow(trade_date="20260710")
qc.top_list(trade_date="20260710")

# 指数与外汇
qc.index_daily(symbol="000300.SH", start_date="20260101")
qc.fx_daily(start_date="20260101")

# 实时行情与快讯
qc.realtime(symbol="600519.SH,300750.SZ")
qc.news_flash(source="cls")
```

- Key 也可以放环境变量 `QUANTCODA_TOKEN`，省去 `set_token`
- 全部接口一览：`qc.endpoints()`（方法名、路径、套餐、参数与返回字段）
- 单个接口的完整契约：`qc.endpoint_schema("daily")`
- 参数与返回字段和 [在线文档](https://quantcoda.com/docs) 一一对应；日期统一 `YYYYMMDD`，证券代码带交易所后缀（`600519.SH`）

## 错误处理

```python
from quantcoda import QuantCodaError, RateLimitError

try:
    df = qc.daily(symbol="600519.SH")
except RateLimitError as e:      # 超出限速（429）
    print(e, "建议等待:", e.retry_after, "秒")
except QuantCodaError as e:     # 其他错误，中文说明
    print(e.status, e)
```

## 多账号 / 自定义

```python
from quantcoda import QuantCoda

client = QuantCoda(token="qc_live_另一把密钥", timeout=60)
df = client.daily(symbol="000001.SZ", start_date="20260101")
```

## 定价

免费 100 次/天，无需信用卡。付费档全部数据不分级，只按调用量计费 —— [定价页](https://quantcoda.com/pricing)。
