How does an AI trading agent get a compact market-state brief in one API call?
Crypto-first. Impersonal and non-directive by design — data, never buy/sell advice.
Short answer: An AI trading agent gets a compact market-state brief by calling patternfetch's POST /v1/brief endpoint — or its MCP tool — with a ticker and a timeframe. Instead of raw OHLCV, one call returns compact candles + a SAX shape signature, detected chart/candlestick patterns, support/resistance clusters, a trend/regime label, and interpreted indicators (RSI/EMA/ATR) plus a one-line summary — a fraction of the tokens, with the structure already computed server-side.
The problem with raw candles
The usual approach dumps hundreds of OHLCV rows per ticker straight into the model context. That is expensive in tokens, slow, and the model re-derives the same support levels, patterns, and indicator readings on every single call. The structure work is repeated, and the context window fills with numbers the agent mostly ignores.
The one call
patternfetch moves that work server-side. The agent sends only what it wants to look at:
curl -X POST https://patternfetch.com/v1/brief \
-H "Authorization: Bearer <key>" -H "Content-Type: application/json" \
-d '{"ticker":"BTC","timeframe":"1h"}'
Via MCP, an agent adds the server once and calls the same brief as a tool:
{ "mcpServers": { "patternfetch": {
"url": "https://patternfetch.com/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" } } } }
Get a key (free $3.00 credit): POST https://patternfetch.com/v1/keys {"email":"you@example.com"}
What comes back
| Field | What it is |
|---|---|
| compact candles | down-sampled rows + a SAX shape signature (the trend shape as a short string) |
| patterns | double top/bottom, head & shoulders, engulfing, hammer, doji, … |
| support / resistance | clustered price levels with proximity to current price |
| regime | trend/volatility label (e.g. up-trend, ranging, high-vol) |
| indicators | interpreted RSI / EMA / ATR — readings, not raw arrays |
| summary | one-line natural-language state for the agent to reason over |
Related calls
| Endpoint | Use | Price |
|---|---|---|
| /v1/brief | full market-state brief | $0.01 |
| /v1/delta | only what changed since your last brief (cheap polling) | $0.008 |
| /v1/candles | compact candle codec only | $0.005 |
| /v1/analogs | historical outcome distribution (n, win-rate, median, min/max) | $0.05 |
Pay per call via x402 (USDC on Base, no account) or Stripe. Every response carries an exact cost block.
The honesty layer: every pattern ships its base rate
Most pattern and signal APIs hand a model a confident-looking "double_bottom", 0.86 and let it quote that blind. patternfetch attaches an evidence block to every detected pattern — the backtested historical hit-rate for that exact pattern, timeframe and confidence band, the pattern-free baseline for the same market and horizon, and a cluster-robust interval on the difference — measured with no lookahead (chart patterns are scored only from the bar they become knowable). A hit rate on its own cannot be read: a drifting market moves it away from 50% with no pattern involved. Measured against the baseline instead, three of the 105 buckets we tested clear an uncorrected interval — fewer than the ~5.3 that chance alone would produce — and the only one that lands above its baseline (double_top, 1d, +9.78pp, n=149) does not survive correcting for 105 comparisons; on US stocks it is 0 of 60. The evidence block reports that, instead of laundering a shape score into a confident call. Impersonal market data, not advice. See the method →