Skip to main content

gold-api (Python)

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

安装

pip install gold-api

零第三方依赖,Python 3.7+。

快速开始

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。

链接

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

License

MIT

Metadata

Release files for gold-api 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gold-api 1.0.0
File Size Uploaded Provenance Actions
gold_api-1.0.0.tar.gz 5.1 kB Without provenance Details for gold_api-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gold-api 1.0.0
File Interpreter ABI Platform Actions
gold_api-1.0.0-py3-none-any.whl Python 3 none any Details for gold_api-1.0.0-py3-none-any.whl

Total release size: 11.0 kB

Release files / gold_api-1.0.0.tar.gz

Download URL gold_api-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
90805741ebf27645a7dfd374ccaadef203d161ea072e6fb0ab2d1f70f4142815
BLAKE2b-256 checksum
How to use checksums
e541c9de3f04a98c47695009ad2e0bd2b838e719a2703f071d88112a729b2f74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / gold_api-1.0.0-py3-none-any.whl

Download URL gold_api-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bad887fdd5a7cc8bf5b3161a0bb5c9e7a1dc87e84bef778ee23a60c59909c1c9
BLAKE2b-256 checksum
How to use checksums
baba0fcba21c83150bab5d116efc2a251f427a989884560116db621ebfcb02d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for gold-api 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page