Repository navigation
v1.1.0 — 新增 Python & Node.js SDK
🎉 v1.1.0 —— 三语言 SDK 全家桶
在 PHP SDK(v1.0.0)基础上,新增 Python 与 Node.js 官方 SDK,三个 SDK 的 API 完全对齐,均已通过线上接口冒烟测试。
安装(任选其一)
composer require gold-api/sdk-php # PHP ≥ 7.2,零依赖
pip install gold-api # Python ≥ 3.7,零依赖
npm install gold-api # Node.js ≥ 18,零依赖(内置 fetch)快速开始
Python
from gold_api import GoldApiClient
client = GoldApiClient("gk_your_appkey")
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()) # 配额感知Node.js
import { GoldApiClient, GoldApiException } from 'gold-api';
const client = new GoldApiClient('gk_your_appkey');
const quotes = await client.realtime(['1061', 'hf_GC', 'nf_AU0']);
for (const q of Object.values(quotes)) {
console.log(q.varietyName, q.lastPrice, q.changeMargin);
}
console.log(client.getLastRateLimit()); // 配额感知PHP(v1.0.0 起)
use GoldApi\Sdk\GoldApiClient;
$client = new GoldApiClient('gk_your_appkey');
$quotes = $client->realtime(['1061', 'hf_GC', 'nf_AU0']);变更清单
- ✨ 新增
python/gold_api:realtime()/realtime_one()/varieties()/last_rate_limit(),异常含msg_id/request_id/http_code与is_rate_limit() - ✨ 新增
node/src:ESM 导出,realtime()/realtimeOne()/varieties()/getLastRateLimit(),同样的异常体系 - 📖 README 升级为三语言门户(选择你的语言 → 安装 → 快速开始)
- 🛡 三个 SDK 均默认
X-API-KEY请求头认证,密钥不进 URL / 访问日志 - ✅ Python / Node SDK 已对线上
varieties接口完成冒烟测试