Skip to content

ta.atr() crashes in PyneCore 6.4.10 with Source subtraction TypeError #64

@cald3ra

Description

@cald3ra

Description

After upgrading from pynesys-pynecore==6.4.9 to 6.4.10, strategies using ta.atr() fail before processing the first bar.

The same strategy and OHLCV data run successfully on 6.4.9.

Minimal reproduction

"""@pyne"""

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


@script.indicator("ATR 6.4.10 reproduction")
def main():
    plot(ta.atr(20), "ATR")
    plot(close, "Close")

Run:

pyne run atr_repro.py MYX_FCPO1_30

Actual behavior

pynecore/lib/ta.py:203 in atr
    return rma(tr(True), length)

pynecore/lib/ta.py:1829 in tr
    val = (high - low) if handle_na else NA(float)

TypeError: unsupported operand type(s) for -: 'Source' and 'Source'

The failure occurs before the first strategy bar is processed.

Expected behavior

ta.atr(20) should return an ATR series as it does under PyneCore 6.4.9.

Regression information

  • PyneCore 6.4.9: works
  • PyneCore 6.4.10: crashes
  • The issue reproduces without request.security(), HTF data or strategy order logic.

Environment

  • Package: pynesys-pynecore==6.4.10
  • OS: Windows 11
  • Python: 3.12.13
  • Execution: PyneCore CLI
  • Data: standard OHLCV with time, open, high, low, close, volume

Additional context

This appears to be a regression in how built-in high and low Source objects are handled inside ta.tr(). Downgrading to pynesys-pynecore==6.4.9 restores normal operation.

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