search
Find similar historical chart patterns by query string, raw bar sequence, or cohort similarity. Returns a cohort ID for further analysis.
Instructions
Entry point: find similar historical patterns and return a cohort_id.
Three modes:
- mode="text" (default): pattern search by query string or
symbol+date+timeframe. Cheap, fast, ~50ms.
Examples:
search(query="NVDA 2024-08-05 1h")
search(symbol="NVDA", date="2024-08-05", timeframe="1h")
- mode="live_bars": find historical analogs of a raw bar sequence
the agent constructed (not yet stored in our DB). Pass `bars`
as a list of {open, high, low, close, volume, timestamp}.
- mode="similar": find cohorts most similar to a given (symbol,
date) anchor at the cohort level, not the chart-pattern level.
Useful for "what other setups historically clustered with this
one?"
Returns: {status, data: {cohort_id, anchor, n_matches, top_matches,
survivorship}, meta}. The cohort_id can be chained into `cohort`,
`analyze`, or `explain` to compose richer responses without re-running
kNN.
Args:
query: 'SYMBOL YYYY-MM-DD [timeframe]' (alt to symbol+date)
symbol, date, timeframe: anchor components (alt to query)
top_k: cohort size (10-2000)
mode: "text" | "live_bars" | "similar"
bars: list of OHLCV dicts (mode="live_bars" only)
cross_timeframe: search across timeframes (mode="live_bars" only)Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| symbol | No | ||
| date | No | ||
| timeframe | No | ||
| top_k | No | ||
| mode | No | text | |
| bars | No | ||
| cross_timeframe | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |