Skip to content

v6.4.6+ runtime raises TypeError on barstate.isconfirmed outside request.security #58

@Zombajo

Description

@Zombajo

Summary

pynesys-pynecore==6.4.8 raises TypeError: 'bool' object is not callable at main-scope barstate.isconfirmed references in PyneComp-emitted strategy scripts, outside request.security.

This reproduces on both cached PyneComp v6.0.31 output and freshly recompiled PyneComp v6.0.33 output. A hand-written minimal @script.indicator using barstate.isconfirmed runs successfully on the same v6.4.8 venv, so the failure appears to be an interaction between the compiled-strategy output shape and the v6.4.6+ AST/module-property transformation pipeline.

Environment

  • OS: Windows
  • Python: 3.13
  • Runtime: pynesys-pynecore==6.4.8
  • Compiler outputs tested:
    • Cached PyneComp v6.0.31
    • Fresh PyneComp v6.0.33, recompiled 2026-05-24 via pyne compile --force

Reproduction

Using fresh v6.4.8 runtime:

pyne -w <workdir> run TH_v1_2.py BINANCE_BTCUSDTP_30m_full.ohlcv
pyne -w <workdir> run WW.py BINANCE_BTCUSDTP_30m_full.ohlcv

Observed errors

TH:

File: scripts/TH_v1_2.py:546 in main
    if barstate.isconfirmed and bar_index >= 12:
TypeError: 'bool' object is not callable

WW:

File: scripts/WW.py:147 in main
    if barstate.isconfirmed:
TypeError: 'bool' object is not callable

Control (proves it's an interaction, not the property itself)

The hand-written minimal script below runs successfully on the same v6.4.8 venv:

from pynecore.lib import barstate, close, plot, script

@script.indicator("barstate minimal")
def main():
    plot(1 if barstate.isconfirmed else 0, "confirmed")

Likely cause

The runtime's module-property transformer appears to rewrite barstate.isconfirmed into a call form, but the runtime initializes lib.barstate.isconfirmed = True as a bool in pynecore/core/script_runner.py. That creates a callable/non-callable mismatch for this compiled strategy shape.

This has the same surface symptom as the older request.security subprocess issue, but this repro is outside request.security; the TH/WW scripts do not use HTF security calls.

Suggested resolution

Either:

  1. Restore backward-compatible handling for compiled strategy references to barstate.isconfirmed, or
  2. Change runtime initialization so the AST-transformed call contract receives a callable marker, or
  3. Document the exact compiler/runtime compatibility boundary if a newer PyneComp output shape is required.

Note: a fresh PyneComp v6.0.33 recompile still reproduces, so "recompile with current PyneSys" did not resolve this in the 2026-05-24 test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions