Hi, I'm following the bootcamp tutorial 11.
Below is the source code of the first subtask.
# region imports
from AlgorithmImports import *
# endregion
from datetime import datetime
from QuantConnect.Data.UniverseSelection import *
from Selection.FundamentalUniverseSelectionModel import FundamentalUniverseSelectionModel
class T11LiquidValueStocks01RequestingaFundamentalUniverse(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2016, 10, 1)
self.SetEndDate(2017, 10, 1)
self.SetCash(100000)
self.AddUniverseSelection(LiquidValueUniverseSelectionModel())
self.UniverseSettings.Resolution=Resolution.Hour
#1. Create an instance of our LiquidValueUniverseSelectionModel and set to hourly resolution
self.AddAlpha(NullAlphaModel)
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.SetExecution(ImmediateExecutionModel())
# Define the Universe Model Class
class LiquidValueUniverseSelectionModel(FundamentalUniverseSelectionModel):
def __init__(self):
super().__init__(True, None, None)
#2. Add an empty SelectCoarse() method with its parameters
def SelectCoarse(self, algorithm, coarse):
return Universe.Unchanged
#2. Add an empty SelectFine() method with is parameters
def Selectine(self, algorithm, Fine):
return Universe.Unchanged
Once I run the backtest, I'm getting the following error
20240814 00:17:27.768 ERROR:: During the algorithm initialization,
the following exception has occurred:
FundamentalUniverseSelectionModel.__init__() takes from 1 to 3 positional
arguments but 4 were given
at __init__
super().__init__(True, None, None)
in main.py: line 24
at Initialize
self.AddUniverseSelection(LiquidValueUniverseSelectionModel())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in main.py: line 14
FundamentalUniverseSelectionModel.__init__() takes from 1 to 3 positional
arguments but 4 were given
FundamentalUniverseSelectionModel.__init__() takes from 1 to 3 positional
arguments but 4 were given
at __init__
super().__init__(True, None, None)
in main.py: line 24
at Initialize
self.AddUniverseSelection(LiquidValueUniverseSelectionModel())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in main.py: line 14
FundamentalUniverseSelectionModel.__init__() takes from 1 to 3 positional
arguments but 4 were given
I'm guessing that “FundamentalUniverseSelectionModel” __init__ method has been changed.
How can I make this code work?
Mia Alissi
Sources: Fundamental Universe Selection Model changes, GitHub source code for FundamentalUniverseSelectionModel
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.
Uhahahaha
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!