reference
Overview
Studies answer research questions over definition events you already Collected — frequency, forward returns, comparisons — then publish results you can read or pin on the chart.
They do not call ctx.emit and they do not run onBar. Lifecycle is onEvent (each matching event) then onFinish (aggregate and publish). Shared deps/session/budgets are under Shared runtime.
Covered in Shared runtime
Topic | Page |
|---|---|
| |
Session buckets | |
Budgets / lint | |
Annotation helpers (different signatures) |
Unique to studies
Page | Covers |
|---|---|
| |
Event lifecycle | |
Scratch buckets → results | |
Result kinds, | |
Flow events + indicator reads | |
What in-terminal pins are (not hand-coded today) | |
Put on chart / Pin Studio product path |
Studies do not call ctx.emit. Pins are created with Put on chart or the pin orchestrator — not the study authoring agent.
Minimal study
meta({ name: "Tick count", kind: "study" });
flows.declare({ slug: "tick-signal", as: "sig" });
results.declare({ id: "rows", kind: "table", title: "Rows" });
export function onEvent(ctx) {
if (ctx.event.flow !== "sig") return;
ctx.collect("rows", { time: ctx.event.time });
}
export function onFinish(ctx) {
ctx.publish("rows", ctx.collected("rows"));
}