Repository navigation
Overloads are decided from the types, as in Pine
Pine selects an overloaded function's implementation from the static argument types; PyneCore used to select it from the values at run time. The two differ where an int-typed expression holds a fractional value ((R + z) / 8), where an empty container matches the first implementation of its kind, and where a method called by name is decided between an int and a float implementation. The type pass now settles each overload call site and writes the chosen implementation's index into the call's pin; the runtime binds that implementation without re-checking the arguments.
- Positional and keyword calls both get an indexed pin. The runtime binds keywords onto the pinned implementation, including the compiler's renamed parameter spellings, and falls back to value dispatch only when a call's shape differs from the one the pin was made for. A pin without an index dispatches from the values, as before.
- Module-level calls are pinned too (
__bind_pinned__), and a method called by name passes an indexed pin on to the export it finds. - A wildcard position (an argument the pin has no character for, such as a UDT or enum value) decides an index only where every candidate agrees on it, and only an implementation that declares the argument's class there is named.
- New codes: E0071 (an argument of unknown type) and E0072 (the overload is not decided). Indistinguishable candidates (identical signatures, implementations that differ only in parameter names or in keyword-only parameters) are reported instead of silently running the first one. Both codes are hard errors only for Edge modules under
PYNE_EDGE_STRICT. - Keyword-only parameters take no part in overload selection.
ta.pivothigh,ta.pivotlowandta.rangetype their source explicitly, so their internal calls are pinned.
Simple and Const qualifier markers
Pine allows overloads that differ only by qualifier (simple string this beside string this). Simple[T] and Const[T] in pynecore.types keep such implementations distinct: they are plain T at run time and are read only by the type pass, which sends a const argument to the Const implementation before the Simple one before the unmarked one, a simple argument to the Simple one before the unmarked one, and a series argument to the unmarked one. Positional and keyword calls are decided alike.
- A parameter whose history is read takes the marker either way round:
Simple[Series[float]](what PyneComp writes) orSeries[Simple[float]]. A newSeriesQualifierAST step normalizes the first form into the second right after import normalization; before,Simple[Series[float]]failed with aNameErrorat run time, andSeries[Simple[float]]ran but its marker was not read. - See "Qualifiers:
SimpleandConst" indocs/overview/differences.md.
Type inference
- A
forcounter has the type of itsfromexpression alone (measured on TradingView v5 and v6); an int counter under a float bound is no longer refused as an index. cond ? <float container> : <int container>is accepted for arrays, matrices and map values, typed as the first branch (was E0023).- A map keyed by an enum is typed.
request.seedis typed by its expression;ta.vwapis a float, or a tuple of three floats whenstdev_multis given.- Adding or subtracting two flag sets of one class (
display.*,text.format_*) gives that class. - A lib string constant (
format.volume,text.align_right,line.style_dashed) joins with a string. Only overload groups that select at run time take a pin, somath.max,math.min,math.round,line.newand the other typing-only overload groups no longer report E0026 or add a state slot. - A lib parameter given both by position and by keyword (
ta.sma(close, source=close)) is reported as E0066 instead of failing at run time with aTypeError. - Overload calls are typed from the implementations the runtime can reach; only the selected implementation is walked; an untyped nested implementation is typed per call.
- A function local is bound once per Pine variable it spells, so two sibling-block variables that share a Python name are no longer reported as one variable with two types.
- Fixes around imports, exports and lib signatures: imports named in a module-level class body,
map.new()in a ternary arm, library aliases over builtin namespaces,__ren__keyword spellings,box.copy/line.copy/label.copysignatures, a module class sharing a container name, a library reaching its own exported methods by name, export signature shims andfor [key, value] in map. - The per-module context ceiling of the type pass is 5000 (the largest of a thousand published scripts needs 546).
Edge profile
- Pine enums (a
StrEnumclass ofmember = 'title'assignments) and the prefix unpacka, b = f(...)[:2]are admitted; edge rules revision 2026.11.3. - Named Unicode escapes in strings are rejected in edge modules.
- A library export's signature shim (
class _ProtocolX(Protocol)) is no longer read as a Pine class, so an overloaded export is no longer a type conflict with itself.
Data providers
- Provider hub (
python -m pynecore.core.plugin.hub): one process holds the real provider instances, and live processes reach them over a loopback connection whenPYNE_PROVIDER_HUBis set. Clients of one symbol and timeframe share one connection and onewatch_ohlcvloop. The hub serves market data only and loads plugin configs itself, so no credential leaves it. It can run on a fixed port (--port), and clients reconnect to a restarted hub. - CCXT provider memory: providers of one exchange and config in a process share one client, a single-symbol provider leaves the option chains out of the market list, and the stream reuses the loaded markets.
- A
ProviderError(unknown symbol, bad credentials) is reported as itself, not as an internal error (I0004).
Live trading
barstate.islastis true on the final history bar, so last-bar tables and labels draw before the first live update.- On venues whose history revises a fresh bar, a bar taken from the history is checked again 30 seconds after its close (or twice the publish lag), and a revision is logged with the differing values.
- A socket close that arrives after the history has already settled the slot is reported as delivered, not as a missed close.
Broker
- A re-entry under a Pine id whose earlier entry an earlier run instance filled and closed no longer reuses the old client order id.
- Live TP/SL legs of a position resumed after a restart are bound to their exit for cancel judgement, so an external cancel of them applies the
on_unexpected_cancelpolicy. - No false "external reduction" for the bot's own engine-trigger partial close while its fill is in flight, nor for a protective leg the venue fired before its fill event arrived.
- The one-way bracket stall is timed (
BOOK_INCOMPLETE_GRACE_S, 30 s) instead of counted in syncs. - A stop whose fill is still queued is no longer reported as missing.
Performance
- Modules that import a module publishing an
@overloadgroup ran every AST step in Python since the native interface reader declined them; they run natively again.
Breaking changes
timestamp()no longer accepts thedate_stringkeyword; usedateString.pyne compile --stricthas no effect (hidden, still accepted);PyneComp.compile()andAPIClient.compile_script()accept and ignorestrict.- Hand-written overload code: a call the types decide now runs the implementation Pine selects, even where the value dispatch picked another one before (for example an int-typed expression holding a fractional value).