-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Describe the bug
The bar evaluated in the strategy function is using the value of the next bar in the future.
To Reproduce
Create a simple strategy:
"""
@pyne
"""
from pynecore.lib import bar_index, open, script, strategy
@script.strategy()
def main():
if bar_index < 10:
print("----------------------------------------")
print("bar_index=", bar_index, " open=", open)
if bar_index == 3:
strategy.entry(id="unique-trade-id", direction=strategy.long)
return {}Add a debug print statement in pynecore/lib/strategy/__init__.py:534:
print('pynecore/lib/strategy/__init__.py:534')
print('price=',price, ' h=', h, ' l=', l)Execute the script:
uv run pyne run simple ccxt_kraken_USD_JPY_15
Expected behavior
The strategy should use the value of the current bar.
Screenshots
Execution log:
Environment:
- OS: macOS
- Version: 15.5 (24F74)
- Python version: 3.13
- How you ran the script: cli
pyne run
Additional context
version:
name = "pynesys-pynecore"
version = "6.3.1"
Metadata
Metadata
Assignees
Labels
No labels