CNBC quotes
Quotes from CNBC for up to 50 symbols (stocks, indices, currencies, commodities, bonds): name, type, exchange, currency, market status, price, change, open, high, low, previous close, volume and 10-day average, 52-week high/low with dates, market cap, shares outstanding, P/E and forward P/E, EPS, dividend and yield, beta, revenue, margins, ROE, EBITDA, debt/equity, bond yield, the pre/after-hours quote, next earnings date and ex-dividend date. Unknown symbols are listed in not_found.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
symbolsrequired | string | Comma-separated CNBC symbols: tickers (AAPL), indices (.SPX, .DJI, .IXIC), currencies (EUR=, JPY=), commodities (@CL.1, @GC.1), Treasury yields (US10Y). Example: AAPL,.SPX,EUR=,@CL.1,US10Y |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/cnbc/v1/quote?symbols=AAPL%2C.SPX%2CEUR%3D%2C%40CL.1%2CUS10Y" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/cnbc/v1/quote",
params={"symbols": "AAPL,.SPX,EUR=,@CL.1,US10Y"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/cnbc/v1/quote");
url.searchParams.set("symbols", "AAPL,.SPX,EUR=,@CL.1,US10Y");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).