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 · Market data
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/Market data
← PreviousPlots & styleNext →Instrument rules

Market data

Served by the engine, which owns the candle cache and the tick buffer. Symbols are always canonical keys — EQ:US:AAPL, FUT:US:MNQ:202609, CRYPTO:GLOBAL:BTC-USD — never a bare ticker.
PYwhile25.candles(symbol, interval="1D", *, start="", end="", limit=0, source="live", hours=None, adjust=None) → list[dict]
Closed bars for one instrument, oldest first. source picks the store; the three are different questions, not fallbacks. while25.data.candles is the same call.
Parameters
symbolstrrequired
Canonical key, e.g. EQ:US:AAPL.
intervalstroptionaldefault "1D"
The chart’s intervals: 1m 5m 15m 30m 1h 1D 1W 1M ... Unknown raises UNKNOWN_INTERVAL on every source.
sourcestroptionaldefault "live"
live: the series a chart or an @on.bar line is filling; never fetches (NO_SERIES when nothing watches it). historical: a vendor pull, cached. intraday: today’s bars from the vendor. Not for an indicator’s compute(), which reads while25.bars.
start / endstroptionaldefault ""
ISO dates, inclusive; historical only. start is honoured back to 2012, intraday within 25,000 bars from end; a start not reached is logged and the rows carry .effective_start.
limitintoptionaldefault 0
Newest N rows. 0: no cap.
hoursstr | Noneoptionaldefault None
"eth": the full session. "rth" is refused.
adjuststr | Noneoptionaldefault None
"split" where the vendor states it. The rows say what came in .adjustment: "raw", "split", or None where the vendor states nothing (never read as raw).
PYwhile25.historical(symbol, interval="1D", *, start="", end="", limit=0, hours=None, adjust=None) → list[dict]
source="historical". A failed vendor fetch raises IO_ERROR even when earlier bars are cached.
PYwhile25.intraday(symbol, interval="5m", *, limit=0, hours=None) → list[dict]
source="intraday". Today only; 1m 5m 15m 30m 1h only, else UNSUPPORTED_INTERVAL.
PYwhile25.history(...) → list[dict]
Deprecated alias for candles(..., source="live").
Row keys
timeintrequired
The bar’s open time, epoch milliseconds.
open / high / low / close / volumefloatrequired
The bar.
Returns
list[dict], carrying .session, .adjustment, .effective_start
.session is "regular" or "full".
Raises
NO_SERIESLIVE_IN_COMPUTEUNKNOWN_INTERVALNO_DATAIO_ERRORBAD_RANGENOT_READY
A data call with no answer in 30 s raises TimeoutError.
PYwhile25.history_span(symbol, interval, start, end, *, hours=None, adjust=None) → dict
Every bar between two ISO dates, fetched on its own worker at the vendor’s pace (a chart goes first), no cache, no cap. Blocks until the span is in: call it from on_start, a schedule or a run, never a tick handler. Progress shows in the module’s log; a Stop cancels it.
Response keys
barslist[dict]required
As candles() returns them, plus regular.
missing_dayslist[str] | Nonerequired
Finished trading days of the calendar with no bar, ISO dates; None when no calendar is known.
covered_from / covered_to / first_bar_msstr / str / int | Nonerequired
The dates covered and the first bar’s time.
calendarstrrequired
"XNYS", "XBOM", "CMES", "24/7"; "" when unknown.
vendor / vendor_requests / vendor_notesstr / int / listrequired
Who served it, how many requests, the stretches it said held nothing.
session / adjustmentstr / str | Nonerequired
As on candles().
A week of 1-hour bars
r = while25.history_span("CRYPTO:GLOBAL:BTC-USD", "1h", "2026-10-18", "2026-10-25")
r["missing_days"]          # [] on a 24/7 calendar; ["2026-10-20"] names a hole
r["vendor_requests"]       # how many requests the vendor needed
Raises
TOO_WIDEVENDOR_PACINGPERMISSIONNOT_SUPPORTEDBUSYTIMEOUTCANCELLED
One span at a time per module. Given up after 180 s of silence or 30 minutes.
PYwhile25.warmup(symbol, interval, bars, *, hours=None) → list[dict]
The last bars finished bars (1 to 10,000) of one of the strategy’s own @on.bar lines, fetched like history_span() and checked before it is handed on. Call it in on_start and let a refusal raise.
The checks
every trading day presentMISSING_DAYS · NO_CALENDARoptional
A day of the exchange calendar with no bar refuses; so does an instrument with no calendar known.
nothing unfinishedoptional
A bar still forming is left out.
enough barsNOT_ENOUGH_HISTORYoptional
Fewer than asked, after one wider fetch.
joins the live barsWARMUP_JOINoptional
Same grid as the live line, no bar missing between them. On an intraday line it waits 15 s after the line attached.
Returns
list[dict], carrying .session, .adjustment, .vendor, .calendar
Rows with an @on.bar bar’s keys (time_ms, not time). A live bar the warm-up already gave is not delivered again.
Warm up, then carry on
KEY = "CRYPTO:GLOBAL:BTC-USD"

def on_start(self, ctx):
    rows = while25.warmup(KEY, "1m", 20)        # the 20 finished bars before now, checked
    self.closes = [r["close"] for r in rows]

@on.bar(KEY, "1m")
def on_bar(self, ctx, bar):
    self.closes = (self.closes + [bar["close"]])[-20:]
Raises
MISSING_DAYSNO_CALENDARNOT_ENOUGH_HISTORYWARMUP_JOINBUSYTOO_WIDEVENDOR_PACINGTIMEOUTCANCELLED
PYwhile25.quote(symbol) → dict | None
The latest quote. None when the terminal has no data for the symbol.
Keys — every figure None until seen, never 0
ltpfloat | Nonerequired
The last traded price: None until it has traded, even with a bid and an ask.
bid / askfloat | Nonerequired
Top of book; one side is often absent on IBKR.
open / high / low / prev_close / volumefloat | Nonerequired
Session figures.
time / as_ofint | Nonerequired
The venue’s stamp; when the engine last saw data for it.
market_openbool | Nonerequired
None when the engine cannot say.
Raises
NOT_READYNO_ENGINE
PYwhile25.quotes(symbols) → list[dict | None]
One entry per symbol asked, in that order; None where there is no data.
PYwhile25.data.news(symbols, *, start="", end="", source="", limit=0) → list[dict]
News articles, oldest first — answered by the engine’s news path, the same one the platform’s news panel reads, so a script can never see a different story than the screen.
Parameters
symbolsstr | list[str]required
One symbol or up to 10 — an 11th raises INVALID.
startstr | intoptional
ISO date or epoch ms; inclusive lower bound. The SDK reads dates and tz-less datetimes as UTC. A range in the PAST works like historical bars: the engine seeks back through the archive to reach it, and returns an empty list — not the nearest articles — when nothing falls inside.
endstr | intoptional
ISO date or epoch ms; a bare date is inclusive to end-of-day.
sourcestroptional
Exact outlet name; empty means all sources.
limitintoptional
Per symbol. 0 → default 50; hard cap 200.
Returns
list[dict]
symbol, time_ms, title, url always; author, excerpt, body, source, sentiment, sentiment_score only when the vendor returned them — an absent field is an absent key, never 0 (a score of 0.0 is a real, neutral reading; test with "sentiment_score" in row, not truthiness). in_market_hours is True/False when the engine could decide against the exchange calendar, None when it could not. The list itself carries two honesty attributes: rows.truncated — the engine hit its page cap while older matching articles may exist — and rows.errors — per-symbol FAILED/PARTIAL codes for vendor fetches that fell over mid-query, so an empty result for a listed key is a vendor failure, never a quiet news day.
A live counterpart: @on.news(symbol)
A module method decorated @on.news(symbol) runs once per live article, receiving the same dict shape — with symbol spelled as the module declared it, and in_market_hours always None (live pushes are not session-tagged). Two modules watching one symbol share one upstream subscription; the first to stop cannot cut the second’s feed, and neither can the user closing the platform’s news panel. A refused subscription — the connection’s live-news limit, or a bare symbol the instrument index does not know — logs an error to the console instead of failing silently. Both surfaces need a news provider on the engine — news() raises NO_PROVIDER without one (loudly, because an empty list would look like a quiet news day, which is a different fact), while a subscription goes through and never fires.
Raises
INVALIDNO_PROVIDERNOT_READYFAILEDSIDECAR_DOWN
PYwhile25.subscribe(key, on_tick=None) → bool · while25.unsubscribe(key) → bool
One more live instrument at runtime, for as long as the module runs. With on_tick= one of the module’s own methods, every tick calls it as an @on.tick line would; without it, quote(key) reads the latest. The engine’s refusals (over the plan’s limit, no vendor) are a warning on the module, not a raise.
A symbol a setting named
def on_start(self, ctx):
    self.coin = while25.params["coin"]                  # a Symbol input
    while25.subscribe(self.coin, on_tick=self.on_coin)

def on_coin(self, ctx, tick):
    ...
PYwhile25.market.is_open(key) → bool | None
Whether the instrument’s session is open; None when the engine cannot say.
PYwhile25.universes() → list[str] · while25.universe(name) → list[dict] · while25.universe_info(name) → dict
Index members from the terminal’s dated registry ("ndx100", "banknifty"). Rows: symbol, name, canonical_id. An unknown index raises ValueError naming the known ones.
← PreviousPlots & styleNext →Instrument rules
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.