Skip to content

v6.10.10

Latest

Choose a tag to compare

@wallneradam wallneradam released this 13 Oct 20:40
· 1 commit to main since this release

Pine compatibility

Number and string output

  • str.tostring without a format prints like TradingView (Java DecimalFormat('#.##########')): ties are decided by the exact value, values outside (1e-21, 1e21) print in exponential form (1E21), arrays print element by element ([1, 2.5]), matrices one row per line, and a result without a non-zero digit is never signed (0, not -0).
  • format.mintick rounds to whole ticks half away from zero and pads to the tick's decimals (1.10000); format.percent prints the unscaled value with two decimals (0.50%); format.volume picks K/M/B/T on the raw magnitude with up to three decimals (1.235M); a , in the mask groups digits.
  • str.format and log.* use MessageFormat's #,##0.### default number style (grouped thousands, ints and floats print alike), print float array elements with Java's Double.toString (1.0E21), round with DecimalFormat's tie rules and keep the sign of -0.0.
  • str.format and log.* reject arguments TradingView cannot format (matrix, map, color, drawing, user type) with a TypeError instead of printing a Python repr; log.* checks at the call site.
  • str.format_time follows Java SimpleDateFormat: three-digit SSS milliseconds, quoted text, week/day/zone fields and Java zone names; an unquoted unknown letter raises ValueError; the default format is yyyy-MM-dd'T'HH:mm:ssZ; a na time formats as the epoch. GMT+0530-style offsets keep their minutes.
  • Output no longer depends on whether a number arrived as a Python int or a float, including the visual-data stream (gradient fill values included).

String na

  • A na string is the empty string (TradingView v5 and v6): na("") is true, a typeless na concatenates as nothing, and string functions treat it as "". A typeless na literal at a string sink (declaration, reassignment, string parameter or default, ternary arm, string container element, string map key) is emitted as ''.
  • A typeless na passed to a lib string parameter is "" at run time (label.new(x, y, na), array.join(a, na), ticker.new(na, na) is ":"), and the text "na" in study metadata (plot-family, hline, bgcolor, barcolor and fill titles, plotchar/plotshape text, alertcondition title and message).
  • plotchar draws only the first character of char, and its default character is TradingView's star.
  • Strategy orders treat an empty comment, alert message or oca_name as unset.

Math

  • Series math.tan reproduces the value TradingView's runtime computes bit for bit (previously the platform tan, which differed on a large share of arguments). The native extension carries a compiled twin.
  • % in Pyne code is Pine's truncated remainder (sign of the dividend, -7 % 3 is -1); a zero divisor or a na operand gives na. x /= y and x %= y no longer raise ZeroDivisionError, and division honors the sign of a zero divisor (1 / -0.0 is -inf).
  • Constant folding folds %, math.log, math.pow and math.tan bit-exact to Java StrictMath, and math.log10 as log(x) / log(10), matching TradingView's compile-time folding. Every folded constant zero is embedded unsigned, as TradingView does for const-qualified zeros; input, simple and series arithmetic keeps -0.0.

Types, containers and inputs

  • An int written into a float array, matrix or map is stored as a float, including copied-in int containers and conversions that differ per call site.
  • Overloads select by the static element type of array and matrix arguments, empty containers included.
  • input.float / input.price with an int default return a float (array.from(input.float(5), 3.0) prints [5.0, 3.0]).
  • matrix.add_row / matrix.add_col raise ValueError before changing the matrix when the supplied array does not match the opposite dimension; only a 0x0 matrix takes its size from the array. A short row was padded with na and a long one truncated before. (#89)
  • One-argument nz returns 0.0 for a number and transparent black for a color.

Methods

  • Every call site of a method keeps its own state (var and series), as on TradingView. All call sites used to share one instance, and that state was reset on every calc_on_order_fills fill and live tick. An overloaded method called in callable form now selects by the static argument types like a direct call.

request.security

  • Fixed a deadlock when main() returned early on a confirmed chart bar while a consumer (for example a daily context) waited for that bar.
  • A run releases its named OS semaphores at teardown, so a process running many scripts no longer fails with "No space left on device" when it creates the next context.

Libraries

  • A library export that carries per-call-site state, called from a script, no longer fails with TypeError: No matching implementation in ta.highest, ta.lowest, ta.highestbars and ta.lowestbars.

Broker / live trading

Features

  • Per-plugin fill report grace: BrokerPlugin.fill_report_grace_s declares how long a position change can show in get_position() before the fill that explains it arrives. None keeps the 120 s engine default; the startup contract probe rejects anything but None or a positive, finite number. The plugin authoring guide explains how to choose it.
  • Reduce-coverage check: resting reduce orders above the held size are cancelled, bot-owned orphan orders are cancelled when the durable journal proves they belong to the run, and an exit whose stop leg is missing on the venue on two consecutive passes is re-armed with a fresh bracket.

Fixes

  • Exit fills that do not reduce the book (flat book, or the fill's own side) are no longer booked as a new position. The engine holds the fill, defers new entries and settles it against the venue after the confirmation grace: dropped when the venue matches the book, adopted when the venue matches the book plus the fill, dropped otherwise. (#91)
  • External flatten is confirmed over the fill grace on every flat venue reading; a partial-bracket close could previously clear the book on the first reading and then book a phantom opposite position from its own fill.
  • Venue rejects of exits and closes no longer halt the run: a stale exit is retired, a refused spec is held while the parent works, a held parent's exit is re-sent once and closed defensively after a second reject; close rejects retry once per bar and quarantine new entries after three. Stop coverage is judged per exit, so a pyramid parent that lost its stop is re-armed.
  • Stop signals (SIGTERM, SIGINT) arriving during a sync are deferred until it completes, so a dispatched venue request is always recorded; after a stop the run waits up to 15 s for the fills of dispatched market orders, before the broker event stream is torn down.
  • Opposite market entries: a market entry waits (bounded, 600 s) while an already dispatched opposite market entry's fill has not reached the book, then reverses close-then-open; a netting venue could fold both into a flat position before.
  • Spot: a close and any re-armed exit stay withheld after a pre-cleared exit leg reported already filled, until its fill reaches the book (bounded, 600 s); script closes against a flat book are dropped; a fully filled software bracket leg cancels its sibling.
  • A bracket attach rejected because its SL/TP is already crossed at the fill price is treated as Pine's immediate exit instead of an error close.
  • A venue-rejected entry is released when the script re-issues it on a later bar.
  • Self-healing connection losses log as warnings without tracebacks, and a deferred entry is reported once per read outage instead of on every sync retry.

Tooling

  • ensure_config caches per config class and file, so a subclass reads and creates its own TOML file; regenerating a config no longer duplicates a table section whose header has a comment, quoted key or inner spaces, and a regenerated file that would not parse is not written. (#90)
  • Tests under pytest 9.1: the import hook installs behind pytest's assertion-rewrite finder, so Pyne-code test modules no longer collect zero tests. The dev and cibuildwheel requirements ask for pytest 9.1. (#92)
  • The Pyne Edge gate accepts in, not in and assert with no message or a string literal message (edge rules profile 2026.09.2).
  • The Rich log formatter keeps the rendered message on the shared record, so later handlers no longer see the bare pattern.