ClickAPIs
Docs · Return distribution

Docs / Endpoints

Return distribution

POST/v1/distributionunits: 2intraday

The distribution of returns over a horizon: percentiles, skew and fat tails, a histogram, how often moves beyond given thresholds happen, and where the latest move sits.

Add "async": true to run it as a job, and "webhook_url" to be called when it finishes (Jobs & async). Calls estimated above 1,000 units run as jobs automatically. Supports interval for intraday bars at 5× the units (Intraday).

Parameters

FieldTypeDefaultDescription
symbolrequiredstring—Ticker.
horizon_barsinteger1Return horizon in bars (1 = one day on daily bars, one hour on 1hour bars).
start_datedate—YYYY-MM-DD. First date to include. Default: the full history available.
end_datedate—YYYY-MM-DD. Last date to include. Default: the latest bar.
binsinteger30Histogram bins.
thresholdsarray of number[0.02, 0.05]Move sizes to count, as decimals.
intervalstring"1day""1day" | "1hour" | "30min" | "15min" | "5min" | "1min". Intraday costs 5× the units; see Intraday.

Example request

How big is a normal day for TSLA? Read the walkthrough →

Request POST /v1/distribution
{
  "symbol": "TSLA",
  "horizon_bars": 1,
  "thresholds": [
    0.03,
    0.05,
    0.1
  ]
}
The same call with curl, Python and JavaScript
curl https://clickapis.com/v1/distribution \
  -H "Authorization: Bearer $CLICKAPIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"TSLA","horizon_bars":1,"thresholds":[0.03,0.05,0.1]}'
import os, requests

r = requests.post(
    "https://clickapis.com/v1/distribution",
    headers={"Authorization": f"Bearer {os.environ['CLICKAPIS_KEY']}"},
    json={
      "symbol": "TSLA",
      "horizon_bars": 1,
      "thresholds": [
        0.03,
        0.05,
        0.1
      ]
    },
    timeout=60,
)
print(r.json()["data"])
const r = await fetch("https://clickapis.com/v1/distribution", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.CLICKAPIS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "symbol": "TSLA",
    "horizon_bars": 1,
    "thresholds": [
      0.03,
      0.05,
      0.1
    ]
  }),
});
console.log((await r.json()).data);

Example response

Response 200 OK
{
  "ok": true,
  "data": {
    "symbol": "TSLA",
    "start": "2010-06-29",
    "end": "2026-11-12",
    "horizon_bars": 1,
    "observations": 4119,
    "stats": {
      "mean": 0.001989,
      "median": 0.000948,
      "stdev": 0.036076,
      "annualized_volatility": 0.571172,
      "skew": 0.346153,
      "excess_kurtosis": 4.899573,
      "min": -0.210628,
      "max": 0.244624,
      "positive_pct": 0.508861
    },
    "percentiles": {
      "p1": -0.09007,
      "p5": -0.051218,
      "p10": -0.036651,
      "p25": -0.016309,
      "p50": 0.000948,
      "p75": 0.01973,
      "p90": 0.040377,
      "p95": 0.05643,
      "p99": 0.10897
    },
    "histogram": [
      {
        "from": -0.210628,
        "to": -0.195453,
        "count": 1,
        "pct": 0.000243
      },
      {
        "from": -0.195453,
        "to": -0.180278,
        "count": 2,
        "pct": 0.000486
      },
      {
        "from": -0.180278,
        "to": -0.165103,
        "count": 1,
        "pct": 0.000243
      },
      {
        "from": -0.165103,
        "to": -0.149928,
        "count": 4,
        "pct": 0.000971
      },
      {
        "from": -0.149928,
        "to": -0.134753,
        "count": 7,
        "pct": 0.001699
      },
      "… 22 more items …",
      {
        "from": 0.199098,
        "to": 0.214274,
        "count": 0,
        "pct": 0.0
      },
      {
        "from": 0.214274,
        "to": 0.229449,
        "count": 2,
        "pct": 0.000486
      },
      {
        "from": 0.229449,
        "to": 0.244624,
        "count": 1,
        "pct": 0.000243
      }
    ],
    "thresholds": [
      {
        "threshold": 0.03,
        "count_up": 658,
        "count_down": 576,
        "prob_up": 0.159748,
        "prob_down": 0.13984,
        "normal_prob_up": 0.218745,
        "normal_prob_down": 0.187611
      },
      {
        "threshold": 0.05,
        "count_up": 267,
        "count_down": 222,
        "prob_up": 0.064822,
        "prob_down": 0.053897,
        "normal_prob_up": 0.091623,
        "normal_prob_down": 0.074775
      },
      {
        "threshold": 0.1,
        "count_up": 54,
        "count_down": 33,
        "prob_up": 0.01311,
        "prob_down": 0.008012,
        "normal_prob_up": 0.003296,
        "normal_prob_down": 0.002349
      }
    ],
    "latest": {
      "return": 0.022029,
      "percentile": 0.773974,
      "z_score": 0.555499
    },
    "notes": [],
    "interval": "1day"
  },
  "meta": {
    "op": "distribution",
    "units": 2,
    "cost_usd": 0.0,
    "billing": "internal",
    "free_call": false,
    "free_calls_left": 0,
    "balance_usd": 5.0,
    "ms": 55,
    "interval": "1day",
    "data_as_of": "2026-11-12",
    "partial_last_bar": false
  }
}

Every response has the same envelope: ok, data and meta (op, units, cost_usd, ms, interval, billing, balance_usd, data_as_of, partial_last_bar). Numbers are decimals (0.05 = 5%), dates ISO, and a value that cannot be computed is null.

More examples