Your Regime Backtest Is Probably Cheating
To backtest "go risk-off in a bear regime," you need to know what the regime was on each past day. The trap: most historical regime labels are drawn after the fact, with full knowledge of what came next. That's lookahead bias, and it quietly inflates every backtest built on it.
The /api/v1/quant/timeline endpoint gives you a daily market-regime label from 2019 to now that doesn't cheat: it's produced by the same model that serves live, with no hindsight relabeling.
A Daily Label, 2019 to Now
The timeline is a daily series of the market regime label, covering every major chapter of the modern crypto market:
- The March 2020 COVID crash.
- The 2021 bull and its blow-off.
- The LUNA / FTX bear of 2022.
- The 2024 ETF bull.
Every day is labeled by the final trained model run over its full training history, and the whole series is regenerated on every retrain so it always reflects the current model — not a frozen legacy one.
Is This Lookahead-Biased?
No — and that's the entire point. Two properties make it honest:
- Same model, live and historical. The labels come from the exact model that scores today's market, not a separate hindsight pass tuned to the past.
- No relabeling. Days aren't re-tagged because of what happened after them; the label is the model's read of the data up to that point.
So a strategy you test against the timeline sees the same kind of label it will see live. That's the difference between a backtest that survives contact with production and one that doesn't.
Pulling the Timeline
Filter from any start date with the start parameter:
curl -H "X-API-Key: cdk_live_your_key" \
"https://cryptodataapi.com/api/v1/quant/timeline?start=2022-01-01"{
"model_version": "fv2", "count": 1276,
"entries": [
{"date": "2022-05-09", "regime": "bear"},
{"date": "2022-11-08", "regime": "vol_spike"},
{"date": "2024-01-11", "regime": "bull"}
],
"note": "Daily majority label from the trained model over its full training history"
}The FTX week (2022-11-08) lands in vol_spike and the ETF approval (2024-01-11) in bull — exactly what you'd want the labels to say.
Timeline vs the Parquet Regime History
Two products, two jobs:
| /quant/timeline | Regime-history Parquet | |
|---|---|---|
| Shape | Daily majority label | Hourly probability distributions |
| Range | 2019 → now | 2020 → now |
| Delivery | JSON via API, date-filterable | Bulk Parquet download |
| Best for | Quick joins, agent lookups, label backtests | Heavy quantitative backtests |
Use the timeline when you want "what regime was it that day?" in JSON; use the Parquet history when you need the full hourly probability matrix.
Which Regimes Are in the Vocabulary?
The timeline uses the same six-state market vocabulary as every other quant endpoint, so a label means the same thing live and historically:
bull— sustained risk-on uptrend.bear— sustained downtrend.range— directionless, contained.choppy— noisy, low-conviction.vol_spike— volatility shock / crisis.squeeze— compressed, pre-expansion.
Raw HMM states map many-to-one onto these labels — the labels are the API contract. Pull the canonical list any time from /quant/regimes.
How to Backtest With the Timeline
import httpx, pandas as pd
tl = httpx.get("https://cryptodataapi.com/api/v1/quant/timeline?start=2020-01-01",
headers={"X-API-Key": "cdk_live_your_key"}).json()["entries"]
reg = pd.DataFrame(tl)
reg["date"] = pd.to_datetime(reg["date"])
# join the daily regime onto your OHLC and test a regime-gated rule
df = ohlc.merge(reg, on="date", how="left")
df["in_market"] = df["regime"].isin(["bull", "range"])- Regime gating: only deploy a strategy in regimes where it historically worked.
- Transition study: measure forward returns after each regime change.
- Live parity: reuse the same gate live via /quant/market — identical label space.
Backtest on labels you'll actually get in production, not hindsight-perfect ones.



