Hello,
Currently trying to build an algorithm that uses a custom Universe Selection Model. I'm getting a strange error when I try to backtest the algorithm:
System.Exception: Value cannot be null. (Parameter 'source') in UniverseSelection.cs:line 145
---> System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at QuantConnect.Lean.Engine.DataFeeds.UniverseSelection.ApplyUniverseSelection(Universe universe, DateTime
dateTimeUtc, BaseDataCollection universeData) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/DataFeeds/UniverseSelection.cs:line 145
at QuantConnect.Lean.Engine.DataFeeds.SubscriptionSynchronizer.Sync(IEnumerable`1 subscriptions, CancellationToken
cancellationToken)+MoveNext() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/DataFeeds/SubscriptionSynchronizer.cs:line 237
at QuantConnect.Lean.Engine.DataFeeds.Synchronizer.StreamData(CancellationToken cancellationToken)+MoveNext() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/DataFeeds/Synchronizer.cs:line 101
This appears to me to be an internal error in the QuantConnect Framework. Has anyone else encountered this error while backtesting with a custom Universe Selection Model?
Louis Szeto
Hi Art
We cannot reproduce the problem with insufficient information. Please share the code snippet of the Universe Selection Model for further assistance.
Best
Louis Szeto
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.
Art Richardson
Here is the Universe Selection Model I am using:
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.
Art Richardson
I was bale to resolve the issue. It turns out I was not properly formatting the ‘selected’ variable in the SelectCoarse method in the Universe Selection Model. Previously, the assignment of the variable looked like this:
Once I switched it to the following, everything worked as expected:
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!