abbass2 / pyqstrat

A fast, extensible, transparent python library for backtesting quantitative strategies.
BSD 3-Clause "New" or "Revised" License
353 stars 57 forks source link

The 'i' indexer is greater than the length of my timestamps? #25

Closed BlackArbsCEO closed 9 months ago

BlackArbsCEO commented 2 years ago

within the trading rule parameters trading_rule(contract_group, i, timestamps, indicators, signal, account, strategy_context), how is the i generated?

my timestamps are len 1986 but the indexer has a value of 2548. I'm not sure how that can happen.

~\AppData\Local\Temp/ipykernel_9196/1456800533.py in model_predict_trading_rule(contract_group, i, timestamps, indicators, signal, account, strategy_context)
     76                     curr_equity
     77                     * risk_percent
---> 78                     / indicators.c[i]  # long only * np.sign(signal_value)
     79                 )
     80 

IndexError: Exception: index 2548 is out of bounds for axis 0 with size 1986 at rule: <class 'function'> contract_group: IWM index: 2548
abbass2 commented 2 years ago

That should not be possible. If you can develop a simple standalone case, I could take a look.

On Sun, Jan 16, 2022 at 2:28 PM Brian @.***> wrote:

within the trading rule parameters trading_rule(contract_group, i, timestamps, indicators, signal, account, strategy_context), how is the i generated?

my timestamps are len 1986 but the indexer has a value of 2548. I'm not sure how that can happen.

~\AppData\Local\Temp/ipykernel_9196/1456800533.py in model_predict_trading_rule(contract_group, i, timestamps, indicators, signal, account, strategy_context) 76 curr_equity 77 risk_percent ---> 78 / indicators.c[i] # long only np.sign(signal_value) 79 ) 80

IndexError: Exception: index 2548 is out of bounds for axis 0 with size 1986 at rule: <class 'function'> contract_group: IWM index: 2548

— Reply to this email directly, view it on GitHub https://github.com/abbass2/pyqstrat/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2VYULTYDME3TNJW5W2TUWMTALANCNFSM5MDFOUHA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>