Hello!
I encountered the ff error in my program:
Runtime Error: Exception : Please register to receive data for symbol 'A RPTMYV3VC57P' using the AddSecurity() function...at CoarseSelectionFunction in main.py:line 113
CoarseSelectionFunction (lines 83 - 118):
def CoarseSelectionFunction(self, coarse):
Initial_Universe = [x for x in coarse if x.HasFundamentalData]
Filtered_Universe = []
for x in Initial_Universe:
ticker_symbol = x.Symbol
#security_key = x.key
#We only want equities that satisfy the following screening criteria
#US stocks, min volume of last 50 trading days above 500K shares
#Min price of $1 per share
#Min dollar volume of $2.5M over same 50 day time period
if x.DollarVolume > 2500000 and x.Price > self.value_MinStockPrice and x.Volume > 500000:
Filtered_Universe.append(x)
#For every stock that satisfy the screening criteria, compute the RSI
for x in Filtered_Universe:
x.RS_Index = self.RSI(x.Symbol, self.value_RSIDays, Resolution.Daily)
#Then, sort the stocks according to the highest RSI:
Filtered_Universe.sort(key=lambda x: x.RS_Index, reverse=True)
return [i.Symbol for i in Filtered_Universe]
To fix the error, I put the ff. code in main.py under the initialize function:
self.AddSecurity(SecurityType.Equity,'A RPTMYV3VC57P', Resolution.Daily)
However, I still get the following error:
Runtime Error: Exception : Please register to receive data for symbol 'AA WF7IHVI76I5H' using the AddSecurity() function...at CoarseSelectionFunction in main.py:line 113
What is the best way to fix the error?
Appreciate the response!