> ## Documentation Index
> Fetch the complete documentation index at: https://stockcontext.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema 2 technicals

> The stock_technicals scalar indicators, complete-window drawdowns, SPY benchmark analytics, and optional indicator history.

`stock_technicals` is the schema-2-only specialist companion to `stock_prices`. It reads the same
held licensed bars and reuses the same locked formulas; the split changes routing and token cost,
not indicator or benchmark math.

```bash theme={null}
curl -sS "https://api.stockcontext.com/v1/tools/stock_technicals" \
  -H "X-API-Key: $STOCKCONTEXT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"AAPL"}'
```

The capabilities catalog reports `stock_technicals_core` at **305 measured tokens** with a
**400-token gate**. The example is trimmed from the real render captured at
`tests/fixtures/prices_v2/golden_technicals.json`.

```json theme={null}
{
  "subject": {
    "entity": { "cik": "0000320193", "name": "Apple Inc." },
    "security": { "security_id": "sec_0000320193_aapl", "ticker": "AAPL", "trading_currency": "USD" }
  },
  "data": {
    "trading_currency": "USD",
    "freshness": { "session": "2026-07-01", "sessions_behind": 1 },
    "context": {
      "avg_volume_30d": 61149408,
      "volume_vs_30d_avg_ratio": 0.8204,
      "max_drawdown_1y": { "pct": -13.8, "peak_date": "2025-12-02", "trough_date": "2026-01-20" },
      "max_drawdown_3y": { "pct": -33.36, "peak_date": "2024-12-26", "trough_date": "2025-04-08" }
    },
    "technicals": {
      "sma_50": 292.6024,
      "sma_200": 269.9567,
      "ema_12": 290.9601,
      "ema_26": 293.208,
      "rsi_14": 50.9861,
      "rsi_14_weekly": 57.8434,
      "adx_14": 24.3827,
      "stochastic_14_3_3": { "percent_k": 51.4243, "percent_d": 34.8468 },
      "obv": 3275200243,
      "macd_12_26_9": { "line": -2.248, "signal": -0.9912, "histogram": -1.2568 },
      "bollinger_20_2": { "lower": 277.5402, "middle": 294.884, "upper": 312.2278 },
      "volatility_30d_annualized_pct": 30.81,
      "atr_14_pct": 2.78
    },
    "benchmark": {
      "symbol": "SPY",
      "session": "2026-07-01",
      "beta_1y": 1.2,
      "beta_5y": 1.18,
      "excess_returns_pct": { "1w": -1.26, "1mo": -2.46, "3mo": 1.16, "6mo": -1.46, "ytd": -1.46, "1y": 20.14 }
    }
  },
  "meta": { "schema_version": "2", "as_of": { "market": "2026-07-02" }, "basis": "eod_licensed" }
}
```

## Fixed methods and refusals

* Daily and weekly RSI use Wilder RSI-14. ADX uses Wilder RMA-14 for true range, directional movement, and DX. Slow stochastic is 14-3-3.
* OBV cumulatively signs raw volume by adjusted-close direction. MACD is 12-26-9, Bollinger is 20 periods at two population standard deviations, and ATR is Wilder ATR-14 divided by adjusted close.
* `max_drawdown_1y` and `max_drawdown_3y` require complete 365- and 1,095-calendar-day windows. Partial windows refuse with `insufficient_history`.
* `beta_1y` and `beta_5y` use covariance/variance of weekly log returns versus SPY over shared sessions, with floors of 40 and 200 returns. `excess_returns_pct` uses the same aligned anchors.
* Missing SPY history returns an `ingestion_pending` benchmark refusal. A benchmark store/feed fault returns a typed `price_unavailable` benchmark cell; neither turns the response into a 5xx.

## Indicator history

Pass `indicators` to append a `history` block using the same column/row grammar as prices history.
`range` defaults to `1y`; warm-up cells are typed `insufficient_history` refusals.

```json theme={null}
{
  "symbol": "AAPL",
  "range": "3mo",
  "indicators": ["macd_12_26_9", "bollinger_20_2", "atr_14_pct"]
}
```

Composite indicators expand into named numeric columns. `bars: false` cannot carry indicator
columns and returns the standard `422 invalid_request` envelope rather than silently dropping them.
