Docs / Endpoints
Best & worst days
POST/v1/best-daysunits: 2daily
The best and worst days with dates, what buy-and-hold returned against missing the best (or the worst, or both) 5, 10, 20 or 30 days, and how closely the best days cluster around the worst ones.
Add "async": true to run it as a job, and "webhook_url" to be called when it finishes (Jobs & async). Calls estimated above 1,000 units run as jobs automatically.
Parameters
| Field | Type | Default | Description |
|---|---|---|---|
symbolrequired | string | — | Ticker. |
top_n | integer | 10 | Best and worst days to list, ≤ 100. |
miss_counts | array of integer | [5, 10, 20, 30] | How many best (and worst) days to leave out, up to 8 values. |
start_date | date | — | YYYY-MM-DD. First date to include. Default: the full history available. |
end_date | date | — | YYYY-MM-DD. Last date to include. Default: the latest bar. |
Example request
What if you missed SPY's 10 best days? Read the walkthrough →
Request
POST /v1/best-days{ "symbol": "SPY", "start_date": "2000-01-01" }
The same call with curl, Python and JavaScript
curl https://clickapis.com/v1/best-days \
-H "Authorization: Bearer $CLICKAPIS_KEY" \
-H "Content-Type: application/json" \
-d '{"symbol":"SPY","start_date":"2000-01-01"}'import os, requests
r = requests.post(
"https://clickapis.com/v1/best-days",
headers={"Authorization": f"Bearer {os.environ['CLICKAPIS_KEY']}"},
json={
"symbol": "SPY",
"start_date": "2000-01-01"
},
timeout=60,
)
print(r.json()["data"])const r = await fetch("https://clickapis.com/v1/best-days", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.CLICKAPIS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"symbol": "SPY",
"start_date": "2000-01-01"
}),
});
console.log((await r.json()).data);Example response
Response 200 OK
{ "ok": true, "data": { "symbol": "SPY", "start": "2000-01-03", "end": "2026-11-12", "days": 6756, "top_n": 10, "buy_hold": { "total": 7.303326, "annualized": 0.081702 }, "best": [ { "rank": 1, "date": "2008-10-13", "return": 0.145244, "below_sma200": true }, { "rank": 2, "date": "2008-10-28", "return": 0.116727, "below_sma200": true }, { "rank": 3, "date": "2025-04-09", "return": 0.105025, "below_sma200": true }, { "rank": 4, "date": "2020-03-24", "return": 0.090593, "below_sma200": true }, { "rank": 5, "date": "2020-03-13", "return": 0.085467, "below_sma200": true }, { "rank": 6, "date": "2009-03-23", "return": 0.071682, "below_sma200": true }, { "rank": 7, "date": "2008-11-24", "return": 0.069355, "below_sma200": true }, { "rank": 8, "date": "2020-04-06", "return": 0.067188, "below_sma200": true }, { "rank": 9, "date": "2008-11-13", "return": 0.062329, "below_sma200": true }, { "rank": 10, "date": "2008-10-20", "return": 0.060053, "below_sma200": true } ], "worst": [ { "rank": 1, "date": "2020-03-16", "return": -0.109409, "below_sma200": true }, { "rank": 2, "date": "2008-10-15", "return": -0.098422, "below_sma200": true }, { "rank": 3, "date": "2020-03-12", "return": -0.095682, "below_sma200": true }, { "rank": 4, "date": "2008-12-01", "return": -0.088524, "below_sma200": true }, { "rank": 5, "date": "2008-09-29", "return": -0.078348, "below_sma200": true }, { "rank": 6, "date": "2020-03-09", "return": -0.078075, "below_sma200": true }, { "rank": 7, "date": "2008-11-20", "return": -0.074118, "below_sma200": true }, { "rank": 8, "date": "2008-10-09", "return": -0.06988, "below_sma200": true }, { "rank": 9, "date": "2011-08-08", "return": -0.065055, "below_sma200": true }, { "rank": 10, "date": "2008-11-19", "return": -0.064127, "below_sma200": true } ], "missing": [ { "missed": 5, "miss_best_total": 3.96313, "miss_best_annualized": 0.061243, "miss_worst_total": 12.612483, "miss_worst_annualized": 0.101725, "miss_both_total": 7.136561, "miss_both_annualized": 0.080888 }, { "missed": 10, "miss_best_total": 2.603629, "miss_best_annualized": 0.048714, "miss_worst_total": 18.594933, "miss_worst_annualized": 0.116717, "miss_both_total": 7.504165, "miss_both_annualized": 0.082661 }, { "missed": 20, "miss_best_total": 1.111241, "miss_best_annualized": 0.028115, "miss_worst_total": 33.155102, "miss_worst_annualized": 0.139978, "miss_both_total": 7.684429, "miss_both_annualized": 0.083504 }, { "missed": 30, "miss_best_total": 0.345935, "miss_best_annualized": 0.011084, "miss_worst_total": 54.167369, "miss_worst_annualized": 0.16044, "miss_both_total": 7.942401, "miss_both_annualized": 0.084682 } ], "clustering": { "window_days": 14, "best_near_a_worst": 7, "best_near_a_worst_share": 0.7, "worst_near_a_best": 9, "worst_near_a_best_share": 0.9, "best_days_below_sma200_share": 1.0 }, "notes": [ "Missing a day = holding cash (0% return) that day instead of the asset; all other days compound.", "Clustering: how many of the top 10 best days fell within 14 calendar days of one of the top worst days (and the reverse).", "below_sma200: the prior close was under its 200-day average (null before 200 bars of history)." ] }, "meta": { "op": "best-days", "units": 2, "cost_usd": 0.0, "billing": "internal", "free_call": false, "free_calls_left": 0, "balance_usd": 5.0, "ms": 1, "interval": "1day", "data_as_of": "2026-11-12", "partial_last_bar": false } }
Every response has the same envelope: ok, data and meta (op, units, cost_usd, ms, interval, billing, balance_usd, data_as_of, partial_last_bar). Numbers are decimals (0.05 = 5%), dates ISO, and a value that cannot be computed is null.