Two calls return gold as Shanghai trades it: the exchange price of physical gold and the futures months, both in yuan per gram with no dollar conversion. Every plan includes them: Free is 15 minutes late, Basic, Plus, and Pro are live.
What the API returns
The Shanghai exchange price is the price of physical gold traded in Shanghai. Shanghai gold futures trade by delivery month on the Shanghai Futures Exchange. Both are in yuan per gram.
| Call | What it returns |
|---|---|
/v1/prices?symbol=XAU-CNY-SGE | The Shanghai exchange price in yuan per gram |
/v1/futures/XAU?exchange=SHFE | Shanghai gold futures, the most traded month |
Get the Shanghai exchange price
This request returns the Shanghai exchange price, with the time it was computed and whether it is stale.
curl "https://api.goldprice.dev/v1/prices?symbol=XAU-CNY-SGE" \ -H "Authorization: Bearer $GOLDPRICE_API_KEY"const res = await fetch("https://api.goldprice.dev/v1/prices?symbol=XAU-CNY-SGE", { headers: { Authorization: `Bearer ${process.env.GOLDPRICE_API_KEY}` },})const data = await res.json()if (!res.ok) throw new Error(data.error)import os, requestsres = requests.get( "https://api.goldprice.dev/v1/prices?symbol=XAU-CNY-SGE", headers={"Authorization": f"Bearer {os.environ['GOLDPRICE_API_KEY']}"}, timeout=10,)res.raise_for_status()data = res.json()Get Shanghai gold futures
Add exchange=SHFE to the gold futures call. The answer has the same fields as the New York futures, with currency CNY and unit gram.
curl "https://api.goldprice.dev/v1/futures/XAU?exchange=SHFE" \ -H "Authorization: Bearer $GOLDPRICE_API_KEY"| Field | Meaning |
|---|---|
symbol | Metal code: XAU, XAG, HG, XPT or XPD |
exchange | The exchange: COMEX, NYMEX, or SHFE for Shanghai gold |
contract_month | The delivery month of the contract, as YYYY-MM |
most_traded | True when this is the month with the most trading |
price | The middle of the best bid and best ask |
bid, ask | Best bid and best ask; null when the market shows none |
day_high, day_low | Highest and lowest price of the trading day; null when there is none yet |
currency | Currency of the price: USD, or CNY on SHFE |
unit | troy_ounce for gold, silver, platinum and palladium, pound for copper, gram on SHFE |
timestamp | When we received the price (UTC) |
delayed | True when our live feed is down: the price comes from a backup that runs late, or cannot be confirmed while the market trades |
state, message, next_open | Only while the market is closed: closed, with message and next_open (UTC) |
What people build with it
- A gold shop screen in China that shows the local market price
- A tracker of the gap between Shanghai and the world price
- A savings app that values gold in yuan per gram
- An agent that answers what gold trades at in Shanghai right now
Plans
Shanghai gold follows the spot rule on every plan. The full list is on pricing.
| Plan | Free | Basic | Plus | Pro |
|---|---|---|---|---|
| Futures prices | 15 minutes late | Live | Live | Live |
| Requests a month | 5,000 | 100,000 | 300,000 | 1,000,000 |
Next
Every futures parameter and error is in the futures reference. The Shanghai gold price page shows the latest price.