Read the results
What distance, score, window and report_url mean.
GET /task-result/{task_id} returns the matches for a finished search.
{
"count": 42,
"results": [
{
"symbol": "BTCUSDT",
"distance": 0.118,
"score": 0.882,
"start": 150,
"mu": 0.003,
"p_win": 0.61,
"spread_bps": 2.5
}
],
"full_series": {}
}
The fields that matter
| Field | Meaning |
|---|---|
symbol | The market that matched |
distance | How far the window is from your sketch; lower is better |
score | 1 - distance; higher is better |
start | Where the matched window starts in the series |
mu | Drift of the window |
p_win | Historical direction score for the window |
spread_bps | Spread at the time of the match, in basis points |
full_series is only populated when the search was asked to keep the candles. It can be
large. For a dashboard, read results and fetch a chart only for the coin the person
opens.
Filtering and ranking
The server returns matches already sorted by distance. Client-side ranking is usually a
mistake: a lower distance is a better shape match, while p_win describes what happened
after similar shapes in the past. They answer different questions.
A practical ranking for a watchlist:
1. distance <= your tolerance
2. prefer symbols with p_win >= 0.5
3. break ties with spread_bps (lower is tradable)
Do not present any of these as a recommendation. The API returns observations, not trading
signals; your product owns the wording.
One coin
curl -s -H "X-API-Key: $DEJABARS_KEY" \
"$API/task-result/<task_id>/symbol/BTCUSDT"
This is the endpoint to call when a person clicks a row in your UI. It avoids transferring
the whole result again.
When a result looks empty
count: 0means no window passedmax_distance. Raise the tolerance or the period.- A result with only a few symbols is normal: the matcher is strict by design.
statusintask-statusmust becompletedbefore you read the result. Polling too
early returns a not-found or an incomplete payload.
- A search on a short period sees fewer windows.
period_days: 30on1his a good
baseline; 1d/1w need a longer period.
Keep the raw payload
Store the task id with the account and the pattern hash. The result is stable, and the
task id is the only handle you need to fetch it again:
task_id 9f2c…
pattern_hash 0.4200,0.5100,0.4700,0.6300,0.5800
timeframe 1h
mode geo
That tuple is enough to explain later which sketch produced which list.
Open the interactive reference and run the operation with your key.
