Quote proxy for the photonichat ESP32 clock — Sina Finance (stocks/FX/futures/indices) + CoinGecko (crypto).
Updates every 10s via /clock. Upstream cache: 30s quotes, 60s metals, 30s crypto.
| Method | Path | Returns | Try it |
|---|---|---|---|
| GET | /q/{symbol} |
Single-symbol JSON quote (alias for /quote/{symbol}) |
/q/sh600519 · /q/hk00700 · /q/gb_aapl |
| GET | /q?syms=A,B,C |
Batch JSON (single Sina request for the whole list) | /q?syms=… |
| GET | /quote/{symbol} |
Full JSON: name, price, change, change_pct, currency, exchange, ts, ts_utc | /quote/sh600519 |
| GET | /metals |
Gold + silver USD/oz (Sina hf_GC, hf_SI) |
/metals |
| GET | /crypto?ids=… |
CoinGecko prices in USD with 24h change | /crypto |
| GET | /clock?stocks=…&coins=… |
One-shot bundle for the clock face: stocks + metals + crypto | /clock |
| GET | /symbols |
Full catalog as JSON | /symbols |
| GET | /cache |
Cache hit/miss stats and entry ages | /cache |
| GET | /healthz |
{"ok":true} | /healthz |
All Sina hq.sinajs.cn codes work natively. Yahoo-style aliases (AAPL, 0700.HK, 600519.SS, USDCNY=X, GC=F, ^GSPC) are auto-translated.
| Market | Sina code | Yahoo alias accepted |
|---|---|---|
| Shanghai A-share | sh600519 | 600519.SS |
| Shenzhen A-share | sz000001 | 000001.SZ |
| Beijing Exchange | bj430047 | 430047.BJ |
| Hong Kong | hk00700 | 0700.HK |
| US stock | gb_aapl | AAPL |
| Index (CN) | sh000001, sz399001 | — |
| Index (intl) | int_sp500, int_nasdaq, int_hangseng | ^GSPC, ^IXIC, ^HSI |
| Forex | fx_susdcny, fx_seurusd | USDCNY=X, EURUSD=X |
| NYMEX future | hf_GC, hf_SI, hf_CL | GC=F, SI=F, CL=F |
| Spot precious metal | hf_XAU, hf_XAG | XAUUSD, XAGUSD |
The complete Shanghai + Shenzhen + Beijing A-share listing, loaded from Sina at startup
and cached to disk for 7 days. Reload manually with /symbols/reload.
loading universe…
browse SH · browse SZ · browse BJ · browse all
Hand-picked highlights across markets (including HK, US, indices, FX, futures, crypto). Or grab the whole curated list via /symbols JSON.
| Symbol | Name |
|---|---|
sh600000 | Pudong Development Bank |
sh600036 | China Merchants Bank |
sh600519 | Kweichow Moutai |
sh600490 | Penghui Energy |
sh601318 | Ping An Insurance |
sh601398 | ICBC |
sh601857 | PetroChina |
sh688981 | SMIC (STAR Market) |
| Symbol | Name |
|---|---|
sz000001 | Ping An Bank |
sz000002 | Vanke |
sz000333 | Midea Group |
sz000651 | Gree Electric |
sz000725 | BOE Technology |
sz000858 | Wuliangye |
sz300750 | CATL |
sz300760 | Mindray Medical |
| Symbol | Name |
|---|---|
hk00700 | Tencent |
hk00939 | CCB |
hk00941 | China Mobile |
hk01024 | Kuaishou |
hk01299 | AIA |
hk01810 | Xiaomi |
hk03690 | Meituan |
hk09988 | Alibaba |
hk09618 | JD.com |
| Symbol | Name |
|---|---|
gb_aapl | Apple |
gb_msft | Microsoft |
gb_googl | Alphabet |
gb_amzn | Amazon |
gb_nvda | NVIDIA |
gb_tsla | Tesla |
gb_meta | Meta |
gb_nflx | Netflix |
gb_amd | AMD |
gb_baba | Alibaba ADR |
gb_pdd | PDD Holdings |
gb_nio | NIO |
| Symbol | Name |
|---|---|
sh000001 | Shanghai Composite |
sz399001 | Shenzhen Component |
sz399006 | ChiNext |
sh000300 | CSI 300 |
int_sp500 | S&P 500 |
int_nasdaq | Nasdaq Composite |
int_dji | Dow Jones |
int_hangseng | Hang Seng |
int_nikkei | Nikkei 225 |
int_ftse | FTSE 100 |
| Symbol | Name |
|---|---|
fx_susdcny | USD/CNY |
fx_susdhkd | USD/HKD |
fx_susdjpy | USD/JPY |
fx_seurusd | EUR/USD |
fx_sgbpusd | GBP/USD |
fx_saudusd | AUD/USD |
fx_susdsgd | USD/SGD |
fx_susdkrw | USD/KRW |
| Symbol | Name |
|---|---|
hf_GC | Gold (NY) |
hf_SI | Silver (NY) |
hf_CL | WTI Crude Oil |
hf_NG | Natural Gas |
hf_HG | Copper |
hf_PL | Platinum |
hf_PA | Palladium |
hf_XAU | Spot Gold (XAUUSD) |
hf_XAG | Spot Silver (XAGUSD) |
| Symbol | Name |
|---|---|
bitcoin | BTC |
ethereum | ETH |
solana | SOL |
binancecoin | BNB |
ripple | XRP |
cardano | ADA |
dogecoin | DOGE |
// Single quote, JSON:
// GET /q/sh600519
// -> {"symbol":"SH600519","name":"贵州茅台","price":1450.5,
// "change":6.1,"change_pct":0.42,"currency":"CNY","exchange":"SH",
// "ts":1715200000,"ts_utc":"2024-05-08T22:13:20Z","source":"sina",
// "input_symbol":"SH600519"}
// Full clock bundle in one fetch:
// GET /clock?stocks=sh600519,hk00700,gb_aapl&coins=bitcoin,ethereum
If you are an AI agent (or an LLM-driven client) reading this page to integrate with this server, follow these rules. Everything here is read-only HTTP GET, no auth, CORS-open, JSON.
| User intent | Endpoint | Why |
|---|---|---|
| "What's the price of X?" (one symbol) | GET /quote/{symbol} or GET /q/{symbol} |
Full JSON: name, price, change, change_pct, currency, exchange, ts, ts_utc, source. |
| Multiple symbols at once | GET /q?syms=A,B,C |
One upstream call for the whole batch — always prefer this over N single calls. |
| Dashboard / "give me everything" | GET /clock?stocks=…&coins=… |
Stocks + metals + crypto in one bundle. |
| Gold or silver spot price | GET /metals |
USD/oz with 24h change_pct. |
| Crypto in USD | GET /crypto?ids=bitcoin,ethereum,… |
CoinGecko ids (lowercase full name, not ticker). |
| "Find a Chinese stock by name" | GET /symbols/search?q=… |
Substring match on symbol or Chinese name across the full A-share universe. |
Before calling, normalize the user's input to one of the supported forms. The server is tolerant of Yahoo-style aliases, but if you can produce a native Sina code you'll skip a lookup.
Apple -> gb_aapl (or AAPL)
Tencent (HK 0700) -> hk00700 (or 0700.HK)
Kweichow Moutai -> sh600519 (or 600519.SS)
Ping An Bank -> sz000001 (or 000001.SZ)
S&P 500 -> int_sp500 (or ^GSPC)
Hang Seng -> int_hangseng (or ^HSI)
USD/CNY -> fx_susdcny (or USDCNY=X)
NYMEX gold future -> hf_GC (or GC=F)
Spot gold (XAUUSD) -> hf_XAU (or XAUUSD)
Spot silver (XAGUSD) -> hf_XAG (or XAGUSD)
Bitcoin (crypto) -> bitcoin (CoinGecko id, /crypto endpoint)
Rule of thumb: stocks/FX/futures/indices → /quote or /q;
crypto → /crypto. Crypto ids are not tickers — use the lowercase CoinGecko slug
(bitcoin, not BTC).
Every quote object — whether from /q/{sym}, /quote/{sym},
or as an item inside /q?syms=… — has the same shape. Every envelope response
also carries a top-level ts + ts_utc.
{
"symbol": "SH600519", // server-normalized
"input_symbol": "SH600519", // exactly what you sent (uppercased)
"name": "贵州茅台",
"price": 1450.5,
"change": 6.1,
"change_pct": 0.42, // already a percent, not a fraction
"currency": "CNY",
"exchange": "SH",
"ts": 1715200000, // unix seconds, upstream timestamp when available
"ts_utc": "2024-05-08T22:13:20Z", // ISO 8601 UTC, derived from ts
"source": "sina"
}
404 means "no quote available for that symbol" — either the symbol is unknown or upstream returned an empty body. Treat as a normal "not found", not an error to retry.
curl https://<host>/quote/gb_nvda
curl 'https://<host>/q?syms=sh600519,hk00700,gb_aapl,int_sp500'
curl 'https://<host>/clock?stocks=gb_aapl,gb_tsla&coins=bitcoin,ethereum'
curl 'https://<host>/symbols/search?q=茅台'
# Python
import httpx
r = httpx.get("https://<host>/q", params={"syms": "gb_aapl,hk00700,sh600519"})
for q in r.json()["quotes"]:
print(q["symbol"], q["price"], q["change_pct"], "%")
// JavaScript
const d = await (await fetch('/q?syms=gb_aapl,hk00700,sh600519')).json();
d.quotes.forEach(q => console.log(q.symbol, q.price, q.change_pct + '%'));
/q?syms=… or
/clock — never loop single requests./symbols catalog or /symbols/search./symbols/search?q=… — it accepts
Chinese characters in the query string.GET /symbols returns the curated catalog and the universe
endpoints in machine-readable JSON.In-memory TTL cache. One upstream fetch per (symbol, TTL window) serves every polling device. See /cache for live stats.