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 · Panels & UI
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/Calling/Panels & UI
← PreviousChartNext →Workspace

Panels & UI

An App owns a CUSTOM PANEL, a tab that names the app the way a chart tab names its instrument. Saving the file under apps/ is what registers it: the tab appears under VIEW → Custom panels and survives restarts, reloads and a synced layout on another machine.

Start, Stop, Restart and Remove live on the panel itself, because the panel is the application's source of truth. Close stops the app and closes the tab without touching the file, and deleting the file is what removes the panel for good.

The module declares its layout once, at import, and afterwards only pushes values into named slots. While25 owns every pixel.

apps/desk.py
# apps/desk.py
import while25
from while25 import App, on
from while25 import ui

ui.panel("desk", "Trading Desk")
ui.layout(
    ui.row(ui.metric("pnl", "Day P&L"), ui.metric("pos", "Positions")),
    ui.chart("equity", "Equity curve"),
    ui.table("fills", "Recent fills"),
)

class Desk(App):
    id = "desk"

    @on.schedule(every="5s")
    def refresh(self, ctx):
        p = while25.portfolio.snapshot()
        while25.ui.push("pnl", p.get("day_pnl"))
        while25.ui.push("pos", len(while25.portfolio.positions()))
PYui.panel(panel_id, label="")
Names the panel this file declares.
PYui.layout(*widgets)
The panel’s tree, declared once at import.
PYui.row(*children)
A horizontal group.
PYui.metric(slot, label="") · ui.chart(slot, label="", live=False) · ui.table(slot, label="") · ui.text(slot, label="")
The four built-in leaf widgets. Each owns a named slot you push into. A chart slot fed a Wiz-shaped spec renders the platform’s interactive chart surface — hover, tooltips, legend. Declare live=True only when the chart redraws at data rate: that buys a lightweight SVG fast path showing axis min/max and the x extent instead of full interactivity. The default is right for anything a person reads.
PYui.view(slot, label="")
The platform’s own components, when you would rather not write markup (and the backtest view). Push a dict of blocks describing what to show — header, tiles, kv, table, badges, text, progress, chart, html, section, row, divider — and the While25 renders it in its own components. A chart block is the interactive Wiz surface by default ( "live": true for the SVG fast path), and an html block is your own markup as one sandboxed section — so custom HTML and an interactive chart share one panel, side by side in a row.
PYui.html(slot, label="")
The app’s own page, and the default for a panel — a dashboard, a desk, a styled report, a custom grid. Push a markup string; your markup and CSS render as written, charts included (inline <svg> or CSS bars). Declare it as the layout’s only widget and the view becomes the whole panel (full height, no caption, no padding); put it alongside other widgets and it is one content-sized section among them, its height tracking its own content. label is optional here — pass one for a caption, omit it and your own <h1> leads.
PYthe frame you render into
Not a bare iframe. The platform’s theme tokens resolve inside — var(--color-amber), --color-profit, --color-loss, --color-text-dim, --color-surface-2 and more — and follow a theme switch. Bare markup arrives styled (headings, zebra tables with tabular numerals, code blocks, lists), with helper classes .card, .tile, .grid, .row, .num, .profit, .loss, .muted. Three faces by role — IBM Plex Mono for data, Inter for prose, JetBrains Mono for code — on a four-step scale. That brand theme is the default, not a rule: it sits in a lower cascade layer, so any CSS you write wins over it, and the platform never snaps or strips anything you write. Build on the tokens and classes and the page reads as part of the platform. Links open in the system browser (https only).
HTML and CSS — scripts never run
The fragment renders in a sandboxed frame with no script permission: <script>, on* handlers and javascript: URLs are inert, so an onclick would silently do nothing. Compute in Python and push new markup instead. CSS animations, transitions and :hover do work — that is the motion you have. The frame isolates styles both ways, and vh units resolve against the frame rather than the window.
PYwhile25.ui.push(slot, value)
Send a value to a declared slot. If you push to a slot you never declared, the SDK logs it and drops it rather than raising — a typo in a display label should not halt a module.
PYwhile25.ui.backtest_block(equity, trades, *, title=None, subtitle=None, currency=None, stats=None, benchmark=None, notes=None) → dict
A results view as ONE block in a ui.view slot: statistic tiles, equity curve, drawdown, monthly table and trade list, drawn by the terminal. equity is (time, value) pairs; a trade needs entry_time exit_time entry exit pnl. Times are epoch milliseconds or a datetime. Nothing is invented: sharpe and the like appear only when passed in stats.
apps/sma_backtest.py
ui.layout(ui.view("main"))

while25.ui.push("main", {"blocks": [
    while25.ui.backtest_block(equity, trades, title="SMA 20/50",
                              subtitle="EQ:US:AAPL · 1D", currency="USD",
                              notes="Signals on the close, fills at the next open; no costs.")]})
while25.viz is not displayed anywhere
A call only prints a console line saying so. An app’s own panel is the one place results show: a chart block in ui.view, the backtest block, or ui.html.
Display only, for now
metric, chart, table, text and html show what a module computed. None of them accept input or call back into Python. The interaction model is a deliberate separate design pass — freezing a half-considered callback contract that third parties must live with would be worse than waiting.
← PreviousChartNext →Workspace
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.