I am hitting the a runtime error when trying to backtest locally with LeanCLI.
20220628 11:51:24.477 ERROR:: Extensions.SetRuntimeError(): Extensions.SetRuntimeError(): RuntimeError at 6/27/2022 4:00:00 AM UTC. Context: Consolidators update
System.ArgumentOutOfRangeException: Rolling window is empty (Parameter 'i')
at QuantConnect.Indicators.RollingWindow`1.get_Item(Int32 i) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Indicators/RollingWindow.cs:line 143
I have the data locally in:
data/forex/oanda/minute/audusd/20220628_quote.zip
Can someone help me to decipher the stack trace? I can't see which rolling window might be the problem as I have a few, was hoping it would point me to a line.
20220628 11:51:24.031 TRACE:: Debug: Algorithm starting warm up...
20220628 11:51:24.477 ERROR:: Extensions.SetRuntimeError(): Extensions.SetRuntimeError(): RuntimeError at 6/27/2022 4:00:00 AM UTC. Context: Consolidators update
System.ArgumentOutOfRangeException: Rolling window is empty (Parameter 'i')
at QuantConnect.Indicators.RollingWindow`1.get_Item(Int32 i) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Indicators/RollingWindow.cs:line 143
--- End of stack trace from previous location ---
at Python.Runtime.PythonException.ThrowLastAsClrException()
at Python.Runtime.Dispatcher.TrueDispatch(Object[] args)
at Python.Runtime.Dispatcher.Dispatch(Object[] args)
at __System_Action`1\[\[QuantConnect_Data_Market_QuoteBar\, QuantConnect_Common\, Version=2_5_0_0\, Culture=neutral\, PublicKeyToken=null\]\]Dispatcher.Invoke(QuoteBar )
at QuantConnect.Algorithm.QCAlgorithm.<>c__DisplayClass517_0`1.<AddConsolidator>b__1(Object sender, IBaseData consolidated) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Algorithm/QCAlgorithm.Indicators.cs:line 3112
at QuantConnect.Data.Consolidators.DataConsolidator`1.OnDataConsolidated(IBaseData consolidated) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Data/Consolidators/DataConsolidator.cs:line 103
at QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase`2.OnDataConsolidated(TConsolidated e) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Data/Consolidators/PeriodCountConsolidatorBase.cs:line 314
at QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase`2.Scan(DateTime currentLocalTime) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Data/Consolidators/PeriodCountConsolidatorBase.cs:line 260
at QuantConnect.Lean.Engine.AlgorithmManager.Run(AlgorithmNodePacket job, IAlgorithm algorithm, ISynchronizer synchronizer, ITransactionHandler transactions, IResultHandler results,
IRealTimeHandler realtime, ILeanManager leanManager, IAlphaHandler alphas, CancellationToken token) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/AlgorithmManager.cs:line
505
20220628 11:51:25.754 TRACE:: Engine.Run(): Exiting Algorithm Manager
20220628 11:51:25.772 TRACE:: FileSystemDataFeed.Exit(): Start. Setting cancellation token...
20220628 11:51:25.797 TRACE:: FileSystemDataFeed.Exit(): Exit Finished.
20220628 11:51:25.841 TRACE:: Engine.Run(): Sending runtime error to user...
20220628 11:51:25.877 ERROR:: Runtime Error: Rolling window is empty (Parameter 'i') in RollingWindow.cs:line 143
Rolling window is empty (Parameter 'i') in RollingWindow.cs:line 143
Alexandre Catarino
Hi John M ,
The runtime error is “Rolling window is empty (Parameter 'i')” which means that the algorithm is trying to access an index of the RollingWindow, e.g. self.window[0], and no item has been added up to that point.
I suggest checking for readiness before accessing the values:
Best regards,
Alex
John M
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!