Skip to Content
While25SDK docs
Writing modules

Typed inputs

Settings the user edits in a form, validated before your code runs, read as while25.params.

import while25
from while25 import Strategy
from while25.inputs import Float, Int, Symbol

class Breakout(Strategy):
    id = "breakout"
    inputs = [
        Int("length", default=20, minimum=2, maximum=200),
        Float("threshold", default=1.5),
        Symbol("instrument"),
    ]

    def on_start(self, ctx):
        self.length = while25.params["length"]

Import the types directly rather than from while25 import inputs — inside a class body the inputs attribute shadows the module, so inputs.Int would raise NameError.

The platform renders these as a configuration form and validates before your code runs. On a strategy the form is part of the "Deploy LIVE — real money" window: one field per input, in the order declared, each filled with what was last entered for it on this machine, else its default.

A Symbol input is a search box over the same instruments the platform's own search finds (a continuous futures series is left out: no order can be placed on one); its value is the instrument key picked, and while25.params[name] reads it once the module runs. Declare as many as you need — each is its own field, read by its own name. Because the value only exists once the module runs, a module that watches it turns its prices on with while25.subscribe(key, on_tick=...), never with @on.tick (see above).

Six types: Int(name, default, minimum, maximum, step), Float(...) the same, Bool(name, default=False), Str(name, default=""), Enum(name, choices=[...], default) and Symbol(name). Every one takes label=, the field's name on the form (the key when left out); Int and Float take step=, the increment the form steps by. A default outside its own bounds, or not among its choices, is refused when the class is declared. Values arrive typed: while25.params["length"] is an int, and a value the form could not coerce or that is out of range fails the start, naming the input, before your code runs.