Metadata-Version: 2.4
Name: gold-api
Version: 1.0.0
Summary: GoldAPI (gold-api.cn) 贵金属行情 Python SDK —— 黄金/白银/铂金/钯金等 70+ 品种实时行情，一次请求批量 50 个品种
Author-email: GoldAPI <721449117@qq.com>
License: MIT
Project-URL: Homepage, https://www.gold-api.cn
Project-URL: Documentation, https://www.gold-api.cn/docs.php
Project-URL: Repository, https://github.com/hujuncheng-ddd/gold-api-cn
Project-URL: Changelog, https://github.com/hujuncheng-ddd/gold-api-cn/releases
Keywords: gold,silver,platinum,palladium,gold-price,precious-metals,quotes,api,sdk,贵金属,黄金,行情,金价
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# gold-api (Python)

> GoldAPI (gold-api.cn) 贵金属行情 Python SDK —— 一次请求，批量拿回黄金 / 白银 / 铂金 / 钯金等 **70+ 品种**行情

## 安装

```bash
pip install gold-api
```

零第三方依赖，Python 3.7+。

## 快速开始

```python
from gold_api import GoldApiClient, GoldApiException

client = GoldApiClient("gk_your_appkey")   # https://www.gold-api.cn/client/register.php 免费注册获取

try:
    quotes = client.realtime(["1061", "hf_GC", "nf_AU0"])  # 黄金现货 + 纽约金 + 沪金主力
    for q in quotes.values():
        print(q["varietyName"], q["lastPrice"], q["changeMargin"])

    print(client.last_rate_limit())        # {'billing': 'member', 'daily_limit': '1000', ...}
except GoldApiException as e:
    print(e.msg_id, e.http_code, e, e.request_id)
    if e.is_rate_limit():
        ...  # 退避重试或提醒升级配额
```

更多用法（单品种、品种列表、配额感知）见[仓库根目录 README](../README.md)。

## 链接

| 资源 | 地址 |
|---|---|
| 官网 | https://www.gold-api.cn |
| 接口文档 | https://www.gold-api.cn/docs.php |
| 免费注册 | https://www.gold-api.cn/client/register.php |

## License

MIT
