Metadata-Version: 2.4
Name: sagax-data
Version: 1.1.0
Summary: Python SDK for the SAGAX Data API (Choice-style csd/css/ctr/edb/info)
Project-URL: Homepage, https://www.sagax.cn/data/v1/
Project-URL: Documentation, https://www.sagax.cn/data/v1/sdk_doc/
Project-URL: API, https://www.sagax.cn/data/v1/api_doc/
Author-email: SAGAX Team <support@sagax.cn>
License-Expression: MIT
License-File: LICENSE
Keywords: a-shares,api,choice,data,finance,futures,sagax,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: pandas>=1.5.0
Requires-Dist: requests>=2.20.0
Description-Content-Type: text/markdown

# sagax-data

SAGAX 数据平台 Python SDK。与 [Data API](https://www.sagax.cn/data/v1/api_doc/) 同构，返回 pandas DataFrame（Choice 手感）。

鉴权沿用 SAGAX 平台 API Key（HMAC-SHA256）。Key 由调用方传入，本包不含任何凭据。

## 安装

```bash
pip install sagax-data
```

国内镜像同步可能有延迟，可指定官方源：

```bash
pip install -i https://pypi.org/simple/ sagax-data
```

## 快速开始

显式 `Client`（推荐：多 key / 多环境可并存，线程安全）：

```python
from sagax_data import Client

cli = Client(api_key="sagax_ak_...", secret_key="sagax_sk_...")
df = cli.csd("600519.SH", "CLOSE_QFQ,FIN_ROE", start="20250101", end="20260826")
df = cli.table("quote_stock_daily", codes="600519.SH", start="20260101", end="20260826")
```

模块级快捷方式（单 key）：

```python
import sagax_data as sd

sd.init(api_key="sagax_ak_...", secret_key="sagax_sk_...")
df = sd.csd("600519.SH", "CLOSE_QFQ", start="20250101", end="20260826")
```

## 方法

| 方法 | 说明 |
|------|------|
| `csd(codes, indicators, start, end)` | 序列。宽表：index=date，columns=(code, indicator) |
| `css(codes, indicators, date)` | 截面。财务为 PIT 口径 |
| `ctr(report, start=None, end=None, codes=None)` | 专题报表 |
| `edb(ids, start=None, end=None)` | 宏观序列 |
| `info(codes=None, start=None, end=None, limit=100, full=False)` | 资讯 |
| `table(name, codes=None, start=None, end=None, limit=10000)` | 显式整表查询 |
| `indicators()` | 指标字典 |

codes / indicators 接受逗号分隔字符串或 list。请求失败抛 `sagax_data.SagaxDataError`。

默认 `base_url=https://api.sagax.cn/data/v1`。完整文档：<https://www.sagax.cn/data/v1/sdk_doc/>
