I continue to receive a runtime error message each time I try t run a backtest. It will run for a month or so and then give me this error. Anyone know what the problem is?
Error Message:Runtime Error: In Scheduled Event 'EveryDay: 11', Collection was modified; enumeration operation may not execute.Stacktrace:QuantConnect.Scheduling.ScheduledEventException: In Scheduled Event 'EveryDay: 11', ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.Dictionary`2+Enumerator[TKey,TValue].MoveNext () [0x00013] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0 at QuantConnect.Algorithm.CSharp.TestAlgorithm.CleanContracts () [0x00087] in <ef784a9ac7e7494cb624457bd36ee0f0>:0 at QuantConnect.Algorithm.CSharp.TestAlgorithm.Schedule1Fired () [0x000b0] in <ef784a9ac7e7494cb624457bd36ee0f0>:0 at QuantConnect.Scheduling.ScheduleManager+<>c__DisplayClass14_0.<On>b__0 (System.String name, System.DateTime time) [0x00000] in <98c88ae28c7a4d6394051ec2103eb0d3>:0 at QuantConnect.Scheduling.ScheduledEvent.OnEventFired (System.DateTime triggerTime) [0x00027] in <98c88ae28c7a4d6394051ec2103eb0d3>:0 --- End of inner exception stack trace ---
Jon Quant
Without seeing the actual algorithm my best guess is that you're performing modifications on the Dictionary while you're performing a loop on it. To alleviate this, you need to make a copy of the Dictionary prior to the loop, traverse the loop using the original variable and then perform modifications on the copy.
Hunter Morley
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!