ClickAPIs
Docs · Trend analysis

Docs / Endpoints

Trend analysis

POST/v1/trendsunits: 2daily

Regression channels (slope per year, R², position), trend age vs the 200-day average, ADX and DI, swing structure (higher highs/lows) and a daily/weekly/monthly trend table.

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.

Parameters

FieldTypeDefaultDescription
symbolrequiredstring—Ticker symbol, e.g. AAPL, SPY, BTC-USD.
channelsarray of integer[50, 100, 200]Regression-channel lengths in bars.
end_datedate—Compute as of this date (YYYY-MM-DD). Default: the latest bar.

Example request

How strong and how old is AAPL's trend? Read the walkthrough →

Request POST /v1/trends
{
  "symbol": "AAPL"
}
The same call with curl, Python and JavaScript
curl https://clickapis.com/v1/trends \
  -H "Authorization: Bearer $CLICKAPIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"AAPL"}'
import os, requests

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

Example response

Response 200 OK
{
  "ok": true,
  "data": {
    "symbol": "AAPL",
    "as_of": "2026-11-12",
    "close": 355.3,
    "regression_channels": [
      {
        "bars": 50,
        "slope_per_bar": 0.001437,
        "slope_annual": 0.436291,
        "r_squared": 0.6572,
        "mid": 350.4966,
        "upper": 361.3743,
        "lower": 339.9463,
        "position": 0.7227,
        "residual_z": 0.891,
        "direction": "up"
      },
      {
        "bars": 100,
        "slope_per_bar": 0.001459,
        "slope_annual": 0.444305,
        "r_squared": 0.6164,
        "mid": 349.8415,
        "upper": 374.1262,
        "lower": 327.133,
        "position": 0.6153,
        "residual_z": 0.461,
        "direction": "up"
      },
      {
        "bars": 200,
        "slope_per_bar": 0.001685,
        "slope_annual": 0.528983,
        "r_squared": 0.8474,
        "mid": 353.3977,
        "upper": 383.9785,
        "lower": 325.2525,
        "position": 0.5323,
        "residual_z": 0.129,
        "direction": "up"
      }
    ],
    "trend_age_vs_sma200": {
      "side": "above",
      "bars": 158,
      "since": "2026-03-31",
      "since_is_start_of_data": false
    },
    "adx": {
      "adx": 18.04,
      "plus_di": 31.52,
      "minus_di": 18.8,
      "strength": "weak",
      "direction": "up"
    },
    "structure": {
      "swing_bars_each_side": 3,
      "swings_considered": 8,
      "higher_highs": 5,
      "lower_highs": 2,
      "higher_lows": 5,
      "lower_lows": 2,
      "label": "uptrend",
      "last_swing_high": {
        "date": "2026-11-05",
        "price": 355.38
      },
      "last_swing_low": {
        "date": "2026-11-03",
        "price": 325.33
      }
    },
    "multi_timeframe": [
      {
        "timeframe": "daily",
        "available": true,
        "bars": 11573,
        "as_of": "2026-11-12",
        "close": 355.3,
        "sma10": 346.103,
        "sma20": 345.531,
        "sma50": 338.4836,
        "above_sma20": true,
        "sma20_above_sma50": true,
        "regression_slope_annual_20": 0.317355,
        "adx": 18.04,
        "rsi": 60.1,
        "score": 3,
        "trend": "up"
      },
      {
        "timeframe": "weekly",
        "available": true,
        "bars": 2397,
        "as_of": "2026-11-12",
        "close": 355.3,
        "sma10": 341.329,
        "sma20": 328.9765,
        "sma50": 295.2298,
        "above_sma20": true,
        "sma20_above_sma50": true,
        "regression_slope_annual_20": 0.382672,
        "adx": 22.69,
        "rsi": 68.31,
        "score": 3,
        "trend": "up"
      },
      {
        "timeframe": "monthly",
        "available": true,
        "bars": 552,
        "as_of": "2026-11-12",
        "close": 355.3,
        "sma10": 304.726,
        "sma20": 271.5715,
        "sma50": 222.219,
        "above_sma20": true,
        "sma20_above_sma50": true,
        "regression_slope_annual_20": 0.397578,
        "adx": 29.93,
        "rsi": 74.11,
        "score": 3,
        "trend": "up"
      }
    ],
    "alignment": "all_up",
    "notes": [
      "Regression channels: OLS of log(close) on time over the last n bars, +/- 2 residual stdevs; position 0 = lower band, 1 = upper band; slope_annual = exp(slope x 252) - 1.",
      "Weekly/monthly bars are resampled from daily; the latest one can be partial."
    ]
  },
  "meta": {
    "op": "trends",
    "units": 2,
    "cost_usd": 0.0,
    "billing": "internal",
    "free_call": false,
    "free_calls_left": 0,
    "balance_usd": 5.0,
    "ms": 135,
    "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.