Overall Statistics |
Total Trades 3 Average Win 0% Average Loss -1.79% Compounding Annual Return -3.429% Drawdown 1.900% Expectancy -1 Net Profit -1.734% Sharpe Ratio -1.176 Probabilistic Sharpe Ratio 0.068% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.029 Beta 0.002 Annual Standard Deviation 0.024 Annual Variance 0.001 Information Ratio -2.189 Tracking Error 0.187 Treynor Ratio -11.503 Total Fees $4.29 |
class UncoupledMultidimensionalReplicator(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 5, 8) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.AddEquity('SPY', Resolution.Daily) self.AddAlpha(InvestorSentimentSurveyAlphaModel(self)) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) 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 self.sma = algorithm.SMA(self.bullBearSpread, 10, Resolution.Daily) def Update(self, algorithm, data): if self.sma.IsReady: algorithm.Plot('Custom Data', 'SMA', self.sma.Current.Value) 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. spread = data[self.bullBearSpread].Value if spread > 0: insights.append(Insight.Price('SPY', timedelta(1), InsightDirection.Up)) 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"