ByteTree API documentation

Metric Distribution

How one metric is spread across all assets, and how that spread changes over time — for example, how many assets score 5 against how many score 0, month by month.

For each step in the date range, every asset’s value of metric is summarised into one row of statistics (mean, median, p25, p75, p90) and, for scores and other bucketed metrics, a histogram (buckets).

Designed for “how is this metric distributed across the population, and how is that distribution drifting?” — not for per-symbol time series (use /api/metrics/:symbol for that).

Request

# ByteTrend Weekly CAPR distribution, monthly steps, all of 2025
curl "https://api.bytetree.io/api/metrics/distribution?metric=byteTrendCapr200w&from=2025-01-01&frequency=monthly"

# trendAge200w across active stocks, weekly
curl "https://api.bytetree.io/api/metrics/distribution?metric=trendAge200w&from=2026-01-01&type=stock&status=active"

# Continuous metric (Sharpe) for a single sector, weekly
curl "https://api.bytetree.io/api/metrics/distribution?metric=sharpe52w&from=2025-06-01&sector=Technology"

Query Parameters

NameTypeRequiredDescription
metricstringYesMetric key. Allow-listed (40 entries — byteTrend{Local,Capr}{200w,30d}, trendAge200w, plus 35 continuous metrics). Send any unrecognised value to receive a 400 with the full allow-list echoed
fromstringYesInclusive ISO YYYY-MM-DD start date
tostringNoInclusive ISO YYYY-MM-DD end date. Defaults to today
frequencystringNoStep granularity: daily, weekly, monthly. Default weekly
typestringNoAsset-type filter — stock, crypto, etf, index, commodity. fx is rejected (no synthesised distribution surface)
statusstringNoAsset status — active, pending, inactive
sectorstringNoSector filter (case-insensitive)
qstringNoFree-text symbol/name search across the asset population
universestringNoUniverse slug (e.g. bytetrend, bytefolio) — see Universes. Membership filter: the population becomes that universe’s members. Unknown slugs and macro return 400 — see Group filters
dimensionstringNoOne of the five global dimensions: region, sector, industry, type, or country. Paired with group; independent of universe
groupstringNoGroup label within dimension, exact match. Paired with dimension
formatstringNoResponse format: json (default), csv, or toon

Group filters

universe restricts the population to that universe’s members — the assets whose universes[] includes the slug. Without it, the population is the whole registry.

dimension + group narrow the population by the asset’s resolved value in one of the five global dimensions. The pair is independent of universe — it works on the whole registry or within a universe — and both-or-neither: one without the other is a 400, as is an unknown dimension. type, status, sector and q compose with all of these.

# ByteTrend members only
curl "https://api.bytetree.io/api/metrics/distribution?metric=byteTrendLocal200w&from=2026-01-01&universe=bytetrend"

# Technology sector across the whole registry
curl "https://api.bytetree.io/api/metrics/distribution?metric=byteTrendLocal200w&from=2026-01-01&dimension=sector&group=Technology"

?universe=macro is a 400 — the macro dataset is a computed aggregation at /api/macro, not a universe. Filter by nothing to cover the whole registry.

Response

FieldTypeDescription
generatedAtstringISO timestamp captured when the server ran the aggregation
metricstringEcho of the resolved metric key
frequencystringEcho of the requested frequency
countnumberNumber of timestep rows in data
dataobject[]One row per timestep
data[].datestringISO YYYY-MM-DD of this timestep
data[].nnumberNumber of assets contributing to this row
data[].statsobjectAlways present — mean, median, p25, p75, p90. Percentiles are approximate
data[].bucketsobject or absentHistogram, present only for bucketed metrics — see below

Bucket-vs-percentile branching

The shape of buckets depends on the metric:

{
  "generatedAt": "2026-05-07T19:34:35.517Z",
  "metric": "byteTrendCapr200w",
  "frequency": "monthly",
  "count": 17,
  "data": [
    {
      "date": "2025-01-01",
      "n": 5075,
      "stats": { "mean": 2.60, "median": 3, "p25": 1, "p75": 5, "p90": 5 },
      "buckets": { "0": 1170, "1": 633, "2": 689, "3": 562, "4": 602, "5": 1419 }
    }
  ]
}

Bounds

Notes