Hi together,
I struggle around and need help: How can I use signals from indicators, like from the InvestorSentimentSurveyAlphaModel?
I guess, that I should extend the "Update" area with some kind of signal; but in addition to that: How could I use that signal afterwards for deciding "buying stocks or not"?
Thank you very much in advance!
class InvestorSentimentSurveyAlphaModel(AlphaModel):
def __init__(self, algorithm):
## Add Quandl data for AAII Investor Sentiment Survey
self.bullBearSpread = algorithm.AddData(QuandlData, 'AAII/AAII_SENTIMENT',Resolution.Daily).Symbol
def Update(self, algorithm, data):
insights = []
# Return if no data
if not data.ContainsKey(self.bullBearSpread): return insights
# This Alpha model uses the Bull-Bear spread from AAII Investor Sentiment Data.
# A Bull-Bear spread is the difference in percentage between bullish investors and the percentage of bearish investors.
# A positive Bull-Bear spread might be a leading indicator that predicts an equity market rally.
# Similarly, a negative Bull-Bear spread might be a leading indicator that predicts an equity market selloff.
return insights
def OnSecuritiesChanged(self,algorithm,changes):
## The Quandl Symbol, self.bullBearSpread, will appear in changes.AddedSecurities
pass
class QuandlData(PythonQuandl):
def __init__(self):
## Retrieve the data from the the Quandl object, specifying the data field used on Quandl
self.ValueColumnName = "BULL-BEAR SPREAD"