Skip to Content
While25SDK docs

While25 Python SDK

Write trading strategies, chart indicators, monitors and panels in plain Python, and run them on the While25 platform.

A strategy in the code editor, beside the chart it trades

What you can build

What it isRead more
StrategyCode that places orders when your rules say soYour first module
IndicatorA line, histogram or zone drawn on the chartIndicators
MonitorCode that watches the market and alerts youMonitors
AppA panel of your own in the platformPanels
BacktestAny logic, any model, any mix of instruments and timeframesBacktests

You write a Python class. While25 feeds it prices, sends its orders to your broker, and draws what it produces.

Install

pip install while25

Python 3.11 or newer, no dependencies, fully typed. You can write and test your code on any computer; to run it against live markets, use While25 Desktop.

A strategy in 10 lines

import while25
from while25 import Strategy, on

class BuyTheDip(Strategy):
    id = "buy_the_dip"
    label = "Buy the dip"

    @on.bar("EQ:US:AAPL", "1D")              # runs once a day, when the bar closes
    def on_day(self, ctx, bar):
        if bar["close"] < bar["open"] * 0.97:   # fell 3% today
            while25.buy("EQ:US:AAPL", 10)

Open the Code Editor in While25, paste it, and press Run. The platform shows the strategy as armed and lists every order it sends.

Open source

The SDK is Apache-2.0 and developed in the open: github.com/Aayush2504/while25-sdk. Bug reports and ideas are welcome in its issues. For AI assistants, every page here is also served as Markdown: add .md to its address. llms.txt at the root of these docs lists every page, and llms-full.txt holds them all in one file.