Hi - From yesterday my algo that was running normally stopped working and shows this error that is related to the data I assume. I really appreciate it if you could help me with it. The error is as below:
[ERROR] FATAL UNHANDLED EXCEPTION:Engine.Run(): Error running algorithm System.ArgumentException: Unable to locate next market open within two weeks., at QuantConnect.Securities.SecurityExchangeHours.GetNextMarketOpen(DateTime localDateTime, Boolean extendedMarket) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Securities/SecurityExchangeHours.cs:line 317, at QuantConnect.Scheduling.TimeRules.<>c__DisplayClass16_0.<AfterMarketOpen>b__1(DateTime date) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Scheduling/TimeRules.cs:line 168, at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext(), atSystem.L∈q.Eνmerab≤.WhereSe≤ctEνmerab≤Itera→r2.MoveNext(), at QuantConnect.Scheduling.ScheduledEvent.get_NextEventUtcTime() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Scheduling/ScheduledEvent.cs:line 80, at QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.<>c.<GetScheduledEventsSortedByTime>b__11_0(KeyValuePair2x)∈LeanCloudCI.Builderb∈DebugsrcQuantCo∩ectLeanEng∈eRealTimeBacktest∈gRealTimeHand≤r.cs:l∈e158, atSystem.L∈q.Eνmerab≤Sorter2.ComputeKeys(TElement[] elements, Int32 count), at System.Linq.EnumerableSorter1.ComputeMap(TE≤ment[]e≤ments,Int32count), atSystem.L∈q.Eνmerab≤Sorter1.Sort(TElement[] elements, Int32 count), at System.Linq.OrderedEnumerable1.GetEνmera→r()+MoveNext(), atSystem.L∈q.Eνmerab≤.Se≤ctIPartitionItera→r2.ToList(), at QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.GetScheduledEventsSortedByTime() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/RealTime/BacktestingRealTimeHandler.cs:line 156, at QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.Setup(IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler, IApi api, IIsolatorLimitResultProvider isolatorLimitProvider) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/RealTime/BacktestingRealTimeHandler.cs:line 52, at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath, WorkerThread workerThread) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/Engine.cs:line 291
Martin Molinero
Hey!
Seems like a Lean bug related to a recent change. Could you please share, here or with support, and algorithm reproducing the issue?
Thanks, we will fix this ASAP
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.
Pi..R INVESTOR
Hi there, I got the same issue with an old algo that use to run with no issue (though I am back to QuantConnect just today after 1+ year away, so the issue might have been around for longer). Were you able to sort it?
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.
Martin Molinero
Hey!
Believe the issue was because the algorithm was trying to use ‘TimeRules.AfterMarketOpen/BeforeMarketClose’ for markets which do not close, like crypto or custom data, instead can use 'TimeRules.At(9, 30)' for example. Note it's also not possible to place ‘MarketOnOpen’ and ‘MarketOnClose’ type of orders for these assets for the same reason.
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.
Pi..R INVESTOR
That was it, thanks a lot!
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!