Repository navigation
v6.14.0 carries the same changes as v6.13.6, released again as a minor version because of their scope; v6.13.6 is yanked on PyPI.
Diagnostic codes
Every error a script causes now has a code. The run-time errors of a script are R codes, the rules of Pyne code are P codes, the Pyne Edge profile is E codes, and an error of PyneCore itself is I0004. The registry lives in scripts/errorcodes/registry.toml; the generated pynecore.errorcodes module has one exception class per code, all derived from PyneError (pynecore.core.errors).
- Each class keeps the built-in it replaces as a base, so existing
except ValueError/IndexError/RuntimeErrorhandlers still catch them. pyne runprints a coded error as one line:bar N (time): CODE at <site>: message, with the source location (module, file, line, column) and, for a compiled.pine, the Pine line from the<script>.py.mapsourcemap written beside the code.--tracebackadds the traceback.- Run-time checks raise codes:
talengths, percentiles,math.sum,max_bars_back, loop steps, array/matrix/string errors, na object fields and copies, timeframe/session/date/time zone parsing,request.security(missing data, lower timeframe above the script's, loop-varying expressions, context limit),line.get_price, unavailable built-ins, unknown methods, missingsyminfodetails.ZeroDivisionError,UnboundLocalErrorandint()/round()of inf or NaN get their codes when they leave the script. - Inlined built-ins report their code too: an inlined
array.getout of range is R0010. - A
request.securitycontext stopped by a coded error hands the error to the chart, which raises it marked as the context's. - Data, script and run option errors: R0046 (unreadable or unsupported OHLCV file), R0047 (script not runnable: no
@pyne, nomain, no script decorator,mainnot returning a dict), R0048 (file not found), R0049 (provider unavailable or failed authentication). R0037 names the file and row of importer, CSV and symbol TOML errors. - Pyne code rules (P0001–P0021): the transform's rejections point at their place in the source. The native steps and the wasm entry return the same code and arguments.
- Edge profile (E0001–E0070): the Edge gate and its typed half report one code per message, in Python and natively; E0011 is new (double-underscore names). Every P and E class derives from
PyneSyntaxError, so tracebacks keep their caret. - New codes for the remaining script errors: R0050
call_arguments, R0051series_subscript, R0052argument_out_of_range, R0053export_misuse, R0054security_not_rewritten. A failedassertof the script's own code is R0004. - R0034 in the strategy: the decimal kernels, the price and currency format and the volume merge raise
DecimalInvalidErrorwith the function and reason; a decimal division by zero is R0034 too. - I0004:
pyne runand the standalone runner report an uncoded exception of PyneCore's own code as an internal error, with the traceback and a request to report it.ScriptRunnerre-raises such exceptions unchanged. Errors of the standard library, of the machine, aTypeError, a misspelled name and the broker and plugin APIs are not reported as I0004. runtime.error()raisesScriptRuntimeError(R0005).- Reference docs:
docs/reference/codes/has one page per domain (run-time errors, Pyne code rules, Edge profile) with an anchor per code. - The
pynecore-codesRust crate (no_std) carries the same codes for native consumers;format_argshares its test vectors with Python.
Live trading
- Paper orders fill on every tick with
calc_on_every_tick. An order placed later in a forming bar could fill at the bar's open, at a price from before it existed. Each live update is now filled as it arrives, so an order placed on one tick fills on the next; a level the price stepped over between ticks fills at the tick price. Live paper trading also runs theprocess_orders_on_closepass at bar close. - Forming-bar results:
run_iter(yield_ticks=True)yields every intra-bar live update (is_closed=False), with its plots and closed trades when the body ran on it. - History trades:
ScriptRunner(live_history_trades=True)andpyne run --history-tradeslet live paper trading trade on the warmup bars and continue that position live. Off by default; rejected with a broker and in backtests. The last downloaded bar places no orders while its period was still open at download time (history_as_of). - The live warmup runs only the latest of consecutive same-timestamp items, so a partial downloaded last bar and its caught-up close are one bar.
- Feed status:
live_ohlcv_generator(on_feed_status=...)reports connecting, live, reconnecting (attempt, offline time, error), market closed and stopped. - Provider API:
pynecore.core.provider_downloadoffersdownload_provider_history(_resilient)without terminal output (progress through aDownloadListener, failures raised),require_live_provider()andopen_live_stream(). - Stopping from another thread:
LiveStopends a live stream or a provider download's retry backoff from any thread (DownloadStopped), so a front end without Ctrl-C can stop a live run. The startup backfill no longer holds a stop for the whole join timeout.
Fixes
- The CLI writes stdout and stderr as UTF-8 on every platform; on Windows a redirected stream raised
UnicodeEncodeErroron the first box-drawing glyph (#119). - On Python 3.14, every
hasattr()on a missingsyminfodetail raisedNameError. matrix.concatof a matrix with itself never terminated; negativematrix.reshapedimensions erased the matrix.na_boolpassed positionally or inside an unpacked argument silently fell back toFalse.- The JSON, CSV and TXT importers read
ask_open/ask_high/ask_low/ask_closeback into the bar's ask prices instead of dropping them; a partial ask group is rejected. - The control-flow asserts of
closedtradesandopentradesare explicit checks, sopython -Okeeps their answers.
Breaking changes
NaFieldErroris removed. A field of annaobject raisesNaObjectFieldError(R0043) and a copy raisesNaObjectCopyError(R0044); both still derive fromRuntimeError.
Docs
- The IDE setup guide recommends PyneIDE for Pyne code; the manual pyright configuration stays as a fallback.