Skip to content

v6.10.7

Latest

Choose a tag to compare

@wallneradam wallneradam released this 03 Oct 15:09
· 2 commits to main since this release

Behavior changes

  • ScriptRunner knows the last bar of a list feed. last_bar_index defaulted to 0, so a script run from Python saw last_bar_index == 0 on every historical bar unless the caller passed it. Both last_bar_index and last_bar_time now default to None: a list or tuple ohlcv_iter (outside live mode) supplies both from its last bar, and any other iterable (a generator, a reader) leaves them tracking the current bar, as on a realtime bar. Explicit values are used as given.
  • An unknown inputs key is an error. ScriptRunner(inputs=...) / import_script(inputs=...) raise ValueError for a key that is not a main() parameter name (an input title, a typo), instead of silently ignoring it. The error lists the valid names.

Features

Live mode for programmatic runs

  • ScriptRunner(live=True) runs a feed of closed history, then LIVE_TRANSITION, then live updates (OHLCV(is_closed=False) ticks and is_closed=True closes). A closed live bar's result is yielded before the runner reads the next item from the feed. Run as plain history, a feed waiting on the market got each bar's result one bar late, because the historical loop reads one bar ahead to detect the last bar. Strategy orders start at the transition; the warmup bars only build state.
  • OHLCVReader.get_last_bar_time(start, end) returns the open time of the last real bar of a range, skipping the phantom gap records of legacy files.

Fixes

  • Live: an unclosed tick older than the forming bar is dropped with a warning instead of opening a new bar under an earlier timestamp.
  • Standalone runs (python script.py data) and pyne benchmark pass last_bar_time, so scripts see the final bar's time on historical bars, as with pyne run.
  • An input of a strict-compiled script (parameter id suffixed with __global__) is overridden by its plain name, the way the .toml spells it.

Documentation

  • ScriptRunner guide: live mode, the last_bar_index / last_bar_time defaults, unknown inputs. The live data feed integration pattern uses live=True, and the live mode architecture page describes the current transition and live phase.