The base class decides what a module may do. All four share the lifecycle hooks.
Base
Purpose
Entry point
Indicator
Returns named series the chart draws.
compute(self, ctx) → dict
Strategy
May place orders, once a human has deployed it from the Code panel.
@on.* handlers
Monitor
Produces verdicts and notifications. Never orders.
@on.schedule
App
Drives a custom panel.
on_start(self, ctx) or run(self, ctx)
PYon_start(self, ctx) · on_stop(self, ctx)
on_start runs first, before any handler; the module reads starting until it returns, so a warmup() there delays only its first decision, and a raise puts it in error. on_stop runs once at a Stop, a restart of its code or the app closing: from then while25.alive() is False and every order call raises MODULE_STOPPING. It may log and read what the module holds, and has two seconds. State on self lives for the deployment.
PYrun(self, ctx)
Called once after on_start, for work with a beginning and an end. Nothing else of the module runs meanwhile, so a loop checks while25.alive() each pass and returns when it is False.
When the computer sleeps, nothing runs
No price or bar reaches a module, no order goes out, and the engine’s held stops fire late, on the first price after waking. The module is not stopped; its log and the app say how long the sleep was, and the missed bars are not delivered after the fact.
PYcompute(self, ctx) → dict | None
Indicators only. Returns {plot_name: values} and sets self.times to matching epoch-millisecond timestamps, one per value — which may extend past the newest candle to forecast forward. Return None to draw nothing. Use float('nan') for a gap — never 0.
The SDK itself has no dependencies, so you can write and unit-test a module on a plain Python install before it ever touches the platform. numpy and pandas are available in the runtime. Get the desktop app to run it — Python runs beside the engine, which a browser cannot host.