I developed an algorithm and back tested it, which worked fine when I ran it it over about three years. When I ran the same algorithm over about 10 years I got the error message below. Can anybody explain to me what that means?
Thanks,
Markus
Error Message
[ERROR] FATAL UNHANDLED EXCEPTION: at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally), at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally), at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body), at QuantConnect.Lean.Engine.DataFeeds.UniverseSelection.ApplyUniverseSelection(Universe universe, DateTime dateTimeUtc, BaseDataCollection universeData) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/DataFeeds/UniverseSelection.cs:line 164, at QuantConnect.Lean.Engine.DataFeeds.SubscriptionSynchronizer.Sync(IEnumerable`1 subscriptions, CancellationToken cancellationToken)+MoveNext() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/DataFeeds/SubscriptionSynchronizer.cs:line 224, at QuantConnect.Lean.Engine.DataFeeds.Synchronizer.StreamData(CancellationToken cancellationToken)+MoveNext() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/DataFeeds/Synchronizer.cs:line 101,WorkerThread.<.ctor>b__7_0(): WorkerThread(): exception thrown when running task System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown., at System.RuntimeMethodHandle.GetDeclaringType(RuntimeMethodHandleInternal method), at System.RuntimeType.GetMethodBase(RuntimeType reflectedType, RuntimeMethodHandleInternal methodHandle), at System.Diagnostics.StackFrameHelper.GetMethodBase(Int32 i), at System.Diagnostics.StackFrame..ctor(StackFrameHelper stackFrameHelper, Int32 skipFrames, Boolean needFileInfo), at System.Diagnostics.StackTrace.CaptureStackTrace(Int32 skipFrames, Boolean fNeedFileInfo, Exception e), at System.Diagnostics.StackTrace..ctor(Exception e, Boolean fNeedFileInfo), at System.Exception.get_StackTrace(), at System.Exception.ToString(), at QuantConnect.Logging.Log.Error(String method, Exception exception, String message, Boolean overrideMessageFloodProtection) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Logging/Log.cs:line 96, at QuantConnect.Logging.Log.Error(Exception exception, String message, Boolean overrideMessageFloodProtection) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Logging/Log.cs:line 109, at QuantConnect.Extensions.SetRuntimeError(IAlgorithm algorithm, Exception exception, String context) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Extensions.cs:line 3509, at QuantConnect.Lean.Engine.Engine.<>c__DisplayClass10_1.b__9() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/Engine.cs:line 340, at QuantConnect.Util.WorkerThread.<.ctor>b__7_0() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Util/WorkerThread.cs:line 62
Mia Alissi
Hello Melanie,
The error message you're seeing,
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown
, indicates that your algorithm is running out of memory. This can happen when your algorithm is trying to use more memory than is available.When you run your algorithm over a longer time period, it needs to process more data. If your algorithm uses a lot of memory for each unit of time it processes, then increasing the time period increases the memory usage, which can lead to an out of memory error.
There are a few ways you might be able to address this:
Optimize your algorithm to use less memory: This could involve changes like using more memory-efficient data structures, reducing the amount of data your algorithm needs to keep in memory at once, or simplifying your algorithm's logic.
Increase the memory available to your algorithm: If you're running your algorithm on your own machine, you might be able to make more memory available by closing other programs. If you're running your algorithm on QuantConnect, you might need to upgrade to a higher level plan that provides more memory.
Reduce the time period you're running your algorithm over: If you can't reduce your algorithm's memory usage or increase the available memory, you might need to run your algorithm over a shorter time period.
If you continue to have trouble, you might want to reach out to QuantConnect's support at support@quantconnect.com for more specific guidance.
Best,
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.
Melanie Schiefele
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!