Skip to content

Behavioural stats

The behavioural leak breakdown and discipline score for one client — the same analytics that power TradLyt's own dashboard, driven by the trades you've synced.

GET /users/{user_ref}/stats

Requires the stats feature on your account.

While the analysis is running

Right after a sync that added trades, the behavioural analysis runs asynchronously. Until it finishes, /stats returns a lightweight status — poll it (every ~2–3s) and show a spinner:

{ "user_ref": "CLIENT00423", "status": "analysing", "stage": "detecting_patterns" }

stage progresses rebuilding → detecting_patterns → ml_scoring → done. Once complete, the same call returns the full stats with status: "ready".

Response (ready)

{
  "user_ref": "CLIENT00423",
  "status": "ready",
  "tradlyt_score": 62,
  "total_behavioural_cost": 48200.0,
  "top_leak": {
    "id": "revenge_trading",
    "label": "Revenge Trading",
    "cost": 21400.0,
    "severity": "high"
  },
  "patterns": [
    { "id": "revenge_trading", "label": "Revenge Trading", "cost": 21400.0, "severity": "high" },
    { "id": "overtrading",     "label": "Overtrading",      "cost": 14300.0, "severity": "medium" }
  ]
}
Field Type Description
status enum ready = the stats below are current; analysing = analysis in progress, poll again.
stage string \| null Progress stage while analysing (rebuilding / detecting_patterns / ml_scoring).
tradlyt_score integer \| null 0–100 discipline rating (higher = better). null until the client has enough history.
total_behavioural_cost float \| null Total ₹ lost across all detected behaviours.
top_leak object \| null The single largest leak by ₹ cost. null when nothing is firing.
patterns[] array Every behaviour with a cost > 0, each with id, label, cost (₹ lost), and severity.

The id values match the behavioural patterns listed in the pre-trade pattern reference.

What to surface

top_leak is the highest-leverage thing to show a client ("₹21,400 lost to revenge trading"). tradlyt_score is the at-a-glance trend metric. The full patterns[] array powers a "where your money goes" breakdown.