Skip to content

Runtime State

Lifecycle components receive the same StrategyContext as strategies, alpha models, and insight pipes. Use ctx.variables() for shared runtime state that should not become AQS configuration.

Good uses for ctx.variables():

  • alpha model state seeded during startup
  • per-symbol metadata initialized in OnInitLogic
  • cached universe metadata
  • counters, timestamps, and runtime-only flags
  • diagnostics needed by teardown or result review

Keep user-tuned inputs in constructor arguments. Keep mutable runtime bookkeeping in ctx.variables() so the AQS property panel stays focused on real configuration.

Use constructor configuration for values the user should tune before a run, such as thresholds, timeframes, or symbol filters. Use ctx.variables() for values produced during the run, such as:

  • last processed timestamp
  • per-symbol counters
  • warm-up diagnostics
  • feature snapshots
  • teardown summaries

That split keeps generated AQS nodes clean while still giving runtime code a shared state surface.