While25 - Programmable Trading Platform
Home
SDK
BlogCardsSupportDownload
While25

A programmable trading platform.

Download While25Book a call

Order managementRisk managementChartsAI assistantCompare

Python SDKSDKDownload

AboutBlogWhile CardsCareersSupportContact

Interactive BrokersAlpacaZerodhaUpstoxAll brokers

TermsPrivacyLicenceRiskAIAcceptable useNotices

While25 is software. It is not a broker, dealer, exchange or investment adviser, and nothing on this site is a recommendation to buy or sell any instrument. Orders you place route to your own brokerage account; While25 never holds funds or securities.

Trading carries risk of loss, including losses greater than your deposit on leveraged products. Backtests and simulations do not predict future returns. Broker and exchange names are trademarks of their owners. We plan to add Coinbase, Binance and Robinhood; you cannot connect them yet.

© 2026 While25

while25
Start here
  • Quickstart
  • Writing a module
Declaring
  • Module types
  • Subscriptions
  • Inputs
  • Plots & style
Calling
  • Market data
  • Instrument rules
  • Options, futures & combos
  • Portfolio
  • Orders
  • Chart
  • Panels & UI
  • Workspace
  • Context
  • Errors
Contents · Writing a module
Start here
  • Quickstart
  • Writing a module
Declaring
  • Module types
  • Subscriptions
  • Inputs
  • Plots & style
Calling
  • Market data
  • Instrument rules
  • Options, futures & combos
  • Portfolio
  • Orders
  • Chart
  • Panels & UI
  • Workspace
  • Context
  • Errors
SDK/Start here/Writing a module
← PreviousQuickstartNext →Module types

Writing a module

A module is a class; the base class decides its kind. The folders are what the runtime re-registers at every start: indicators/, strategies/, monitors/, apps/.
indicators/zscore.py
# indicators/zscore.py
import while25
from while25 import Indicator, Plot, Level
from while25.inputs import Int

class ZScore(Indicator):
    id      = "zscore"
    label   = "Z-Score"
    overlay = False                       # its own pane, below price
    inputs  = [Int("length", default=20, minimum=2, maximum=500)]
    plots   = [Plot("z", color="#e0a34a")]
    levels  = [Level(2.0, style="dashed"), Level(-2.0, style="dashed")]
    warmup  = lambda params: int(params.get("length", 20))

    def compute(self, ctx):
        n    = int(while25.params.get("length", 20))
        rows = while25.bars                   # the chart's own series, oldest first
        if len(rows) < n:
            return None

        close, out = [float(r["close"]) for r in rows], []
        for i in range(len(close)):
            if i < n - 1:
                out.append(float("nan"))          # warm-up renders as a gap
                continue
            w    = close[i - n + 1:i + 1]
            mean = sum(w) / n
            sd   = (sum((x - mean) ** 2 for x in w) / n) ** 0.5
            out.append(0.0 if sd == 0 else (close[i] - mean) / sd)

        self.times = [int(r["time"]) for r in rows]   # one per value
        return {"z": out}
FolderKind
indicators/name.pyIndicator
strategies/name.pyStrategy
monitors/name.pyMonitor
apps/name.pyApp — a custom panel; one that imports a Strategy class trades
name.pyAnalysis — a one-off script, read-only
An indicator receives its series
while25.bars is the chart’s own series, oldest first, replaced whole every pass; while25.forming the unclosed bar or None; while25.future_times the projected grid. candles(source="live") inside compute() raises LIVE_IN_COMPUTE. warmup (an int, or a callable of the params) says how many bars you need; a short chart then reports “warming up” instead of drawing nothing.
You can predict past the last bar
self.times may run PAST the newest candle: values dated onto while25.future_times render to the right of price. A value dated at a time the chart has no bar for is not drawn.
The package is the API
Inside a running module every call is package-level: while25.candles, while25.buy, while25.subscribe, while25.ui.push, while25.log. There is one module per process, so nothing needs passing around. The ctx a handler receives is that same object — use it when you want the explicit style, or bind a fake with while25.use(fake) in a test. Shorten the name yourself if you like: import while25 as w25.
Everything is synchronous
Each module owns its own process, so a blocking call costs nothing anyone else can see. There is no event loop to yield to — never write async def or await.
← PreviousQuickstartNext →Module types
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.