Hi all;
I may not be understanding something here. But when I use QC500UniverseSelectionModel.py (from Universe Selection documentation), when it runs I get:
During the algorithm initialization, the following exception has occurred: TypeError : No constructor matches given arguments: (<class 'int'>, <class 'function'>)
at CreateCoarseFundamentalUniverse
return CoarseFundamentalUniverse(universeSettings in FundamentalUniverseSelectionModel.py: line 49
TypeError : No constructor matches given arguments: (<class 'int'>, <class 'function'>)
I looked up FundamentalUniverseSelectionModel.py and it has (at line 50, not 49)"
return CoarseFundamentalUniverse(universeSettings, lambda coarse: self.FilteredSelectCoarse(algorithm, coarse))
I don't see any CoarseFundamentalUniverse(). If it was a call in the parent class it would be self.CoarseFundamentalUniverse(). A google search does not show me that method.
Amy I missing something? If so, what? Or is this code incomplete?
thanks - dave
Varad Kabade
Hi David,We tried using the QC500UniverseSelectionModel it works without any issue.To import the QC500 universe, we can write:
in the Initialize method. We have created an example algorithm showing the same. Refer to the attached backtest.Best,Varad Kabade
David Thielen
When it runs for you, where does it find the method CoarseFundamentalUniverse()?
thanks - dave
Fred Painchaud
Hi David,
If I may, CoarseFundamentalUniverse is a class, so the code is trying to create an instance of that class. But since in your case you get
TypeError : No constructor matches given arguments: (<class 'int'>, <class 'function'>)
then for some reason, you are using QC500UniverseSelectionModel in a way that such constructor is being called. That line of code
return CoarseFundamentalUniverse(universeSettings, lambda coarse: self.FilteredSelectCoarse(algorithm, coarse))
seems outdated, dating back when such a constructor existed for CoarseFundamentalUniverse.
The way you use QC500UniverseSelectionModel makes that call but let's say the “usual” way to use QC500UniverseSelectionModel does not. It still looks like a bug to me but you would need to share the code you have that throws the error so the LEAN devs can modify the offending Python code…
Fred
David Thielen
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!