Assets & Prices
Price Sparklines
GET /api/prices/sparklines A year of weekly values for every asset — about 52 points each, just enough to draw a small trend line (a sparkline) beside each row of a prices table. Filter by asset type, region or sector.
For stocks, ETFs, crypto and commodities each point is the asset’s weekly CAPR — its US-dollar price divided by the MSCI World index — so the line shows how the asset has done against the world market, free of currency moves and split steps. For currency pairs each point is the weekly closing rate.
Example
curl https://api.bytetree.io/api/prices/sparklines \
-H "Authorization: Bearer YOUR_API_KEY" const res = await fetch("https://api.bytetree.io/api/prices/sparklines", {
headers: { "Authorization": "Bearer YOUR_API_KEY" },
});
const body = await res.json(); import requests
res = requests.get(
"https://api.bytetree.io/api/prices/sparklines",
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
body = res.json() 200 Shortened to ten points per symbol {
"data": {
"AAPL": [0.0580, 0.0592, 0.0611, 0.0604, 0.0627, 0.0641, 0.0655, 0.0662, 0.0679, 0.0683],
"BTCUSD": [12.14, 12.87, 13.52, 13.10, 14.35, 15.02, 15.46, 16.10, 16.88, 17.43],
"EURUSD": [1.1215, 1.1302, 1.1350, 1.1298, 1.1420, 1.1503, 1.1566, 1.1610, 1.1672, 1.1684]
}
} Stocks only
curl "https://api.bytetree.io/api/prices/sparklines?type=stock" \
-H "Authorization: Bearer YOUR_API_KEY" European stocks
curl "https://api.bytetree.io/api/prices/sparklines?type=stock®ion=Europe" \
-H "Authorization: Bearer YOUR_API_KEY" Currency pairs only
curl "https://api.bytetree.io/api/prices/sparklines?type=fx" \
-H "Authorization: Bearer YOUR_API_KEY" Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
type |
string |
No | stock, crypto, etf or commodity for that asset type’s CAPR series; fx for currency pairs’ weekly closes. Omit for every asset type and every currency pair. Indices are not included — they are the benchmark CAPR is measured against |
region |
string |
No | Region label, exact match (e.g. North America, Europe) — see Dimensions. Filters assets; currency pairs are left out |
sector |
string |
No | Sector label, exact match (e.g. Technology). Filters assets; currency pairs are left out |
Response
| Field | Type | Description |
|---|---|---|
data |
object |
Map of symbol to an array of weekly values |
Each key is a symbol. Each value is an array of numbers, one per ISO week, oldest first: the week’s last CAPR for an asset, or the week’s last close for a currency pair.
CAPR is a ratio, not a price, so its scale is the asset’s own: compare a line’s shape across assets, not its level.
Freshness headers
The asset series are built once a day ahead of time. When a request is served from them — no region or sector filter, and type absent or one of the four asset types — the response carries two freshness signals:
| Header | Description |
|---|---|
X-Sparklines-AsOf |
When the newest series was built, as an ISO 8601 timestamp (e.g. 2026-10-09T04:20:07.121Z) |
X-Sparklines-Stale |
true when that build is more than 36 hours old. Absent otherwise. The data is still served — treat it as a warning, not an error |
Requests with region or sector, and type=fx, are computed on the fly and don’t send these headers.
Errors
| Status | When |
|---|---|
400 |
type is not one of stock, crypto, etf, commodity or fx — including index. Body: Invalid value for 'type': expected one of stock, crypto, etf, commodity, fx, received 'index'. |
400 |
A region or sector request too broad to compute in time: { "error": "sparklines query too broad to compute in time — narrow it: add a type, or a narrower region/sector" }, sent with Cache-Control: no-store. Add type, or narrow the region or sector |
503 |
The weekly series is momentarily unavailable. Sent with Retry-After: 120 and { "error": "Sparkline series not yet materialised" } — retry after the indicated seconds rather than treating it as “no data” |
Notes
- Returns approximately 52 points per symbol (one per ISO week over the last 12 months)
- The last value in each array is the most recent week’s
regionandsectorfilters resolve against the asset registry- Assets with no CAPR in the last 12 months are left out of the response