Zero-configuration precious metals price lookup covering all four major metals
across international futures and Chinese domestic markets.
No API key, no registration, no local plugins — works everywhere.
# Query all metals (JSON output)
python3 scripts/query.py
# Query specific metal
python3 scripts/query.py --metal gold
# Human-readable table output
python3 scripts/query.py --format table
# Query Chinese domestic retail prices only
python3 scripts/query.py --market cn
Any IDE, agent, or automation tool can invoke this skill:
python3 scripts/query.py [--metal {all,gold,silver,platinum,palladium}] [--format {json,table}] [--market {all,intl,cn}]
{"error": "message"} on failure{
"timestamp": "2026-06-03T11:12:20+08:00",
"markets": {
"international": {
"gold": { "symbol": "GC", "latest": 4513.7, "open": 4520.0, "high": 4525.1, "low": 4490.5, "unit": "USD/oz", "exchange": "COMEX" },
"silver": { "symbol": "SI", "latest": 75.36, "open": 75.50, "high": 75.63, "low": 74.11, "unit": "USD/oz", "exchange": "COMEX" },
"platinum": { "symbol": "XPT", "latest": 1937.4, "open": 1941.0, "high": 1946.4, "low": 1923.8, "unit": "USD/oz", "exchange": "NYMEX" },
"palladium": { "symbol": "XPD", "latest": 1395.0, "open": 1394.5, "high": 1395.5, "low": 1384.0, "unit": "USD/oz", "exchange": "NYMEX" }
},
"shanghai_futures": {
"gold": { "symbol": "AU0", "latest": 986.48, "high": 988.20, "low": 976.00, "prev_settle": 979.76, "unit": "CNY/g", "exchange": "SHFE" },
"silver": { "symbol": "AG0", "latest": 18375, "high": 18484, "low": 17933, "prev_settle": 18159, "unit": "CNY/kg", "exchange": "SHFE" }
},
"domestic_retail": {
"gold_bank_bars": [
{ "bank": "工商银行如意金条", "price": 998.68, "unit": "CNY/g" }
],
"gold_recycle": { "price": 961.0, "unit": "CNY/g" },
"palladium_recycle": { "price": 277.0, "unit": "CNY/g" }
}
},
"data_sources": ["sina_finance", "xxapi.cn"],
"note": "International futures: real-time during US/Asia electronic hours. Shanghai futures: real-time 09:00-15:00 CST. Retail prices: updated daily."
}
┌──────────────────────────────────────────────────────────┐
│ query.py (entry point) │
│ python3 scripts/query.py --metal all --format json │
└──────┬──────────────────────────┬────────────────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ Sina Finance │ │ xxapi.cn │
│ (hq.sinajs) │ │ (v2.xxapi.cn) │
├──────────────┤ ├──────────────────┤
│ hf_GC COMEX │ │ bank_gold_bar │
│ hf_SI COMEX │ │ gold_recycle │
│ hf_XPT NYMEX │ │ pd_recycle │
│ hf_XPD NYMEX │ │ ag_recycle │
│ nf_AU0 SHFE │ └──────────────────┘
│ nf_AG0 SHFE │ Zero auth
└──────────────┘
Zero auth
| Source | Coverage | Auth | Update | Reliability |
|---|---|---|---|---|
| -------- | ---------- | ------ | -------- | ------------- |
| Sina Finance | COMEX GC/SI, NYMEX XPT/XPD, SHFE AU/AG | None | Real-time | High (backed by exchange data) |
| xxapi.cn | Domestic bank bars, brand retail, recycle prices | None | Daily | Medium (aggregator, not primary) |
PRICE=$(python3 precious-metals/scripts/query.py --metal gold | python3 -c "import sys,json; print(json.load(sys.stdin)['markets']['international']['gold']['latest'])")
echo "COMEX Gold: $PRICE USD/oz"
import subprocess, json
result = subprocess.run(
["python3", "scripts/query.py", "--metal", "all", "--format", "json"],
capture_output=True, text=True, cwd="precious-metals"
)
data = json.loads(result.stdout)
gold = data["markets"]["international"]["gold"]
print(f"{gold['symbol']}: {gold['latest']} {gold['unit']}")
Tool: bash
Command: python3 /path/to/precious-metals/scripts/query.py --metal all --format json
→ Parse JSON response → Present to user
Detailed API documentation: references/api-reference.md
共 1 个版本