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 · Errors
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/Errors
← PreviousContext

Errors

Every while25.data, while25.portfolio and while25.orders call is a round-trip to the engine, and a refusal raises — it never comes back as a result object with ok=False. There is nothing to check on the happy path.
Handling a refusal
import while25
from while25 import While25Error

try:
    rows = while25.data.candles("EQ:US:AAPL", "5m", limit=200)
except While25Error as e:
    if e.code == "NO_SERIES":
        while25.log("not being watched yet — open it on a chart")
        return
    raise                       # anything else is not ours to swallow
PYWhile25Error(RuntimeError)
.code is the machine-readable string in the table below; .message is the prose. Branch on the code — message wording changes, codes do not. It subclasses RuntimeError, so an existing except RuntimeError still catches it.
CodeRaised byCause and what to do
NO_SERIEScandles(source="live")Nothing is watching that symbol at that interval. "live" never fetches: open it on a chart, declare @on.bar for it, or ask source="historical".
LIVE_IN_COMPUTEcandles(source="live") in compute()An indicator reads while25.bars. A second series drifts from the drawn one after a scrollback.
UNKNOWN_INTERVALcandles, warmup, @on.barNot an interval the engine knows ("1m" "5m" "15m" "30m" "1h" "1D" "1W" "1M" ...). Never read as another.
NO_DATAcandles(source="historical")The vendor returned nothing for that instrument and window.
IO_ERRORcandles(source="historical")The vendor fetch failed. Cached bars are not handed back as the answer; ask again.
BAD_RANGEcandles(source="historical")start is after end.
UNSUPPORTED_INTERVALcandles(source="intraday")Intraday serves 1m, 5m, 15m, 30m and 1h only.
TOO_WIDE · VENDOR_PACING · PERMISSION · NOT_SUPPORTEDhistory_span, warmupThe vendor's own refusal, in its words. A walk it stopped short raises too; partial bars are not returned.
BUSYhistory_span, warmup · any order callOne span at a time per module. On an order call: the script-order lane is full — back off.
CANCELLEDhistory_span, warmupThe module's Stop stopped the fetch.
MISSING_DAYS · NO_CALENDAR · NOT_ENOUGH_HISTORY · WARMUP_JOINwarmupA trading day with no bar; no calendar known; too few finished bars after one wider fetch; the bars do not join the live grid. Each ends the start.
INSTRUMENT_NOT_FOUNDdata.instrument, comboThe key names no listed instrument.
NO_PROVIDERnewsNo news vendor is configured.
SUB_CAP · NO_VENUE · BAD_INTERVAL · BAD_HOURSa subscriptionNot a raise: a warning on the module, which runs with the keys it did get.
NO_LIVE_GRANTany order callNo human has deployed this module. Nothing is simulated.
GRANT_STALE · GRANT_ENDED · MODULE_NOT_RUNNING · MODULE_HALTEDany order callThe code changed since the deploy; the grant ended with a Stop; the module stopped or halted. Deploy again.
MODULE_STOPPINGany order callThe Stop has begun. Never retry: the trader's Stop decides.
ORDER_RIGHTS · NOT_A_STRATEGYany order callOnly a Strategy, or an App importing one by name, trades. Raised before anything leaves the process.
NOT_IN_RUN · IMPORT_TIME_DATAorders, option, future, combo, subscribeCalled from a one-shot run, or while the file was loading. Move it into on_start or a handler.
TIMEOUTplace, bracket, combo, cancel, modify, square_offNo answer in 25 s and THE ORDER MAY HAVE BEEN PLACED. Retry with e.idempotency_key (a duplicate answers DUPLICATE_ORDER), or watch @on.order. Never resend under a fresh key.
TIMEOUThistory_span, warmup, option, futureNothing reported for 180 s, or a venue lookup past 30 s. Ask again.
DUPLICATE_ORDERplace, bracket, comboThis idempotency_key was already accepted. A corrected resubmit needs a fresh key.
NOT_ORDER_OWNER · WRONG_LANEcancel, modify, square_offNot this module's order.
NOT_WORKINGcancel, modifyThe order is not open. A bracket's stop answers this until the entry fills.
BAD_ORDER_TYPE · BAD_PRODUCT · BAD_VALIDITY · BAD_HOURS · BAD_TAG · BAD_NOTIONALplacean order type that is not MKT, LMT, STP, STP LMT, MIT, LIT or TRAIL written exactly so, or MOO/MOC/LOO/LOC; a product outside delivery/intraday/margin/normal; a validity the broker does not take (the message lists them); hours other than "eth"; a tag over 20 characters; quantity and amount both stated.
BAD_GROUP · UNSUPPORTEDplace, brackettake_profit with no stop_loss; an entry type a bracket cannot place; a percent trail on a bracket; group="simple" with a protective leg. oco/oto are UNSUPPORTED.
BAD_REDUCE_ONLY · BAD_HELD_BY · BROKER_HELD_UNSUPPORTED · BAD_TRAILplacereduce_only off a stop/if-touched/trailing order; held_by not "local"/"broker" or on a market/limit order; a broker that cannot hold that type there; a trail the holder does not take.
NO_BRACKET · NOTHING_HELD · MARKET_CLOSED · NOT_LIVEsquare_offNo open bracket or combo of this module has that id; its entry has not filled (cancel it instead); its market cannot take the close; not on the live account. Nothing was sent.
BAD_COMBO · BAD_PRICE · NOT_AN_OPTION · NO_LOT_SIZE · COMBO_LEG · COMBO_REFUSEDcombo, cancel, modifyNot 2–10 legs or a contract twice; a limit leg without a price or a market leg with one; a non-option leg; no lot size on file; a leg's own id (a combo is cancelled whole); the placer's refusal, in its words.
NOT_READYany while25 callThat subsystem is still coming up. Ask again; never read it as flat or empty.
NO_ENGINE · SIDECAR_DOWNany while25 callThe engine is not attached to the Python process, or the process is down.

Raised without a code

These come from the runtime rather than from an engine refusal, so they carry no code.

ExceptionWhen
ValueErrorRefused by the SDK before anything is sent: side not BUY/SELL; quantity= and amount= neither, both, or not positive; amount= with a bracket; a figure not exact to 9 fraction digits (0.1 + 0.2 is refused, never rounded); a stated price of 0 or below; take_profit= without stop_loss=; reduce_only/held_by where they cannot apply; a trail of 0; hours other than "eth"; modify() with nothing to change; warmup() for a line the module does not declare; malformed option/future/combo arguments.
TimeoutErrorA DATA call got no answer within 30 s. An order call never raises this: it raises While25Error TIMEOUT, which carries the idempotency key.
SubscriptionError · OrderRightsErrorWhile25Error subclasses: a subscribe() refused at once (.keys; NOT_RUNNING / BAD_REQUEST), and an order call from a kind that may not trade (.kind; ORDER_RIGHTS).
RuntimeErrorThe pipe to the engine is gone. While25Error subclasses it, so an existing except RuntimeError still catches a refusal.
A handler that raises halts the module
An uncaught exception stops routing for that module, deliberately: a strategy that raised part-way through an entry is holding a position it has lost track of, and the next event would run the same handler again. The process stays alive so the traceback is readable; restarting clears it.
← PreviousContext
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.