Methodology

How the market-state signals are computed.

Every patternfetch response links here, so here is the honest version: exactly how each field of a brief is derived from raw candles, what each score means, and — just as important — what it does not mean. No black box, no magic, no implied edge.

Binance spot · crypto only · 1m → 1d

A brief is deterministic: the same candles produce the same output. Nothing here is trained, fitted to future returns, or tuned to "win" — these are transparent, classical techniques applied to recent price history and packaged compactly so an AI agent can reason over them without dumping a raw OHLCV array into its context. Read the limitations section before you act on anything.

1 · data source 2 · candle codec 3 · SAX shape 4 · patterns 5 · support / resistance 6 · regime 7 · indicators 8 · one-line summary 9 · analogs 10 · limitations

1. Data source

All inputs are Binance spot OHLCV (open, high, low, close, volume per candle). patternfetch is crypto only. Supported timeframes are 1m, 5m, 15m, 1h, 4h and 1d.

A brief fetches up to ~200 candles for the requested timeframe (the no-signup /v1/demo uses 120). If the series has fewer than 20 candles, the API returns INSUFFICIENT_DATA instead of computing a brief on too little history. Every value below is a point-in-time snapshot over exactly those candles.

2. Compact candle codec (codec.rows)

The candle series is encoded for tokens, not for humans. Each candle becomes one row "o,h,l,c,v", and rows are joined by ;. There is no per-row timestamp — the header's t0/t1 (epoch milliseconds) bound the whole series, and the timeframe fixes the spacing, so the index of a row is its position in time.

Prices are written at a single fixed precision (the number of decimal places), with trailing zeros stripped. The precision is chosen from the magnitude of the maximum high in the series:

Max high in seriesPrice decimals (precision)
≥ 10001
≥ 1 and < 10002
≥ 0.01 and < 15
< 0.018

Volume is written at 0 decimals when ≥ 1, otherwise at 4 decimals. The codec is loss-tolerant by design: it preserves the shape the downstream analysis needs while keeping the payload small. The precision value is returned so a consumer can interpret the digits correctly.

"codec": {
  "rows": "60125.4,60480,59890.1,60310.7,1284;60310.7,60590,60180,60420.2,977;…",
  "sax": "dcefdcbe",
  "precision": 1
}

3. SAX shape signature (codec.sax)

The sax string is a coarse fingerprint of the recent shape of the series — a way for an agent to compare or recall shapes cheaply. It is computed as Symbolic Aggregate approXimation over the series of close-to-close returns:

  1. Take consecutive close-to-close returns.
  2. z-normalize them (subtract the mean, divide by the standard deviation).
  3. PAA-collapse the normalized series into at most 8 segments (Piecewise Aggregate Approximation — average within each segment).
  4. Quantize each segment into the alphabet a–g using the fixed breakpoints [-1.2, -0.5, -0.15, 0.15, 0.5, 1.2] (so values below −1.2 → a, between −1.2 and −0.5 → b, … above 1.2 → g).

The length of the string is min(8, candles − 1). It is a shape descriptor, not a forecast — two identical sax strings mean two stretches looked alike after normalization, nothing about what comes next.

4. Patterns (analysis.patterns[])

Patterns are detected geometrically from the candle geometry — there is no model "predicting" them. Each hit is an object:

{ "name": "double_bottom", "confidence": 0.86, "at": 142, "span": 11 }

Important: confidence is a geometric quality score, not a probability of profit. A 0.86 means the shape is a clean example of that pattern — not that a trade has an 86% chance of working.

5. Support / resistance (analysis.levels)

Levels are built by detecting swing pivots (local highs and lows) in the series and clustering nearby pivots into price levels. Each level is:

{ "price": 59820.4, "strength": 1 }

strength is in 0..1, where 1 is the strongest — i.e. the most-tested level, with the most pivots clustered at it. levels.support holds levels below the current price and levels.resistance holds levels above it. Strength reflects how often price has reacted there in this window, not whether it will hold next time.

6. Regime (analysis.regime)

The regime is a compact classification of the current trend state:

{ "trend": "up", "strength": 0.42, "volPct": 2.13 }

7. Interpreted indicators (analysis.indicators)

Indicators are returned as interpreted state, not a wall of numbers — an LLM reasons better over a label than over a bare float. Each indicator carries its value and a state:

"indicators": {
  "rsi": { "v": 58.3, "state": "neutral" },
  "ema": { "v": 61240.8, "state": "above_20_50" }
}

The v is the raw indicator value if you want it; the state is the digested read your agent can act on directly.

8. One-line summary (analysis.nl)

The nl field is a single natural-language line composed from the fields above — specifically the trend, the last-bar % change, the RSI value and state, and the top pattern. It exists so the model never has to do arithmetic on raw numbers (where LLMs hallucinate); the line is already a ready-to-reason summary.

"nl": "BTC/USDT: uptrend (moderate), +1.94% last 4h, RSI 58.3 (neutral), double_bottom (conf 0.86)."

It is a faithful restatement of the computed analysis, not an opinion or a call.

9. Analogs (/v1/analogs)

Analogs do in-series shape matching. patternfetch takes the current window and searches earlier windows of the same series for ones whose shape is similar, using cosine similarity over z-normalized windows. For the similar windows it then looks at what happened over a fixed forward horizon and returns the full outcome distribution:

{ "n": 14, "horizon": 12, "winRate": 0.57, "median": 0.011, "mean": 0.004, "min": -0.083, "max": 0.072 }

This is not a prediction and not a strategy backtest. It describes what happened in the past after similar-looking windows — and it includes the losers (that is the whole point of returning min and the full distribution rather than a single rosy number).

10. Limitations — read this

We would rather you trust the data because we are candid about its limits:

See it for real, or go deeper:

Try a brief — no signup Full API docs

Related: /docs · /try · /disclaimer