Metric Distribution

Returns a cross-sectional distribution of a single metric over time — for each timestep in the requested range it summarises every asset’s value of metric into a row carrying summary statistics (mean, median, p25, p75, p90) and, where the metric is discrete or range-bucketed, 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. macro, global-trends-200) — restricts the population to assets in a named group. Use with dimension and group. Out-of-scope slugs return 403
dimensionstringNoDimension within the universe: region, sector, industry, type, or country
groupstringNoGroup label within the dimension, exact match (paired with universe + dimension)
formatstringNoResponse format: json (default), csv, or toon

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