Skip to content

KB/api

GET /api/v1/signals/drawdown-risk/history

Last verified

Auto-generated. This article is rebuilt from FastAPI route introspection by scripts/build_api_kb.py. Edit the route docstring in app/ and re-run the script β€” do not edit this file directly.

GET /api/v1/signals/drawdown-risk/history

Handler: app.signals.routes.get_drawdown_risk_history
Methods: GET

Description

Back-calculated drawdown-risk score per trading day for the last days.

The composite score is NOT persisted β€” it is recomputed here from the stored input legs in daily_signals (every leg IS a kept column), running the SAME assembly the live /signals/drawdown-risk route uses: for each target date, current = the leg values as of that date, baselines = the trailing window up to that date, net_gex_rank = the 252d gex percentile up to that date. A faithful recompute, not a stored snapshot.

horizon (optional): when supplied, selects which horizon’s composite to back-calculate. 10d / 20d keep the gamma leg (full composite); 40d / 60d drop it (macro-only) β€” the gamma leg’s measured skill lives at 10-20d, so the longer-horizon trend sparklines exclude it, exactly mirroring the per-horizon split in compute_drawdown_risk_horizons. When horizon is OMITTED the TOP-LEVEL response shape is byte-identical to the pre-horizon full-composite behaviour (no horizon key, gamma leg included); each point is an ADDITIVE SUPERSET β€” the legacy trade_date/score/band/n_available keys are unchanged plus four nullable below-flip beta_* keys (#545, null when the beta leg is inactive), non-breaking for any consumer that ignores unknown JSON keys. An unsupported horizon returns HTTP 400 with the supported list (the 1-3d hazard slot is intentionally not a recompute target).

Caveat (DOCTRINE P0): older dates carry fewer legs β€” ofr_fsi_funding (the heaviest, 1.5Γ—) is NULL before its source landed, so pre-that-date points slightly understate. Each point surfaces n_available so the consumer sees the leg count. For the recent ~30d window all legs are present. Powers the Drawdown-lens sparkline on The Engine.

Parameters

In Name Type Default Description
query days int 30
query window int 504
query horizon Optional[str] Optional drawdown-risk horizon for the trend sparkline. One of 10d / 20d / 40d / 60d. OMITTED (default) returns the legacy full (gamma + macro) 20d composite per day, byte-identical to the pre-horizon response. 10d / 20d serve the same full composite (the gamma leg’s skill lives at 10-20d); 40d / 60d serve the macro-only composite (gamma leg EXCLUDED, since net_gex_rank is unvalidated past 20d). The 1-3d hazard slot is NOT supported here β€” it is a frozen hazard estimate, not the z-composite this route recomputes.

Curl

curl -s https://bigclawd.com/api/v1/signals/drawdown-risk/history