Trying to create market smith rs rating on quantconnect. I tried to get some data in onData method by simply printing the symbol. But nothing was printed. I think I need to register the equity. But how do I do that without doing it in initialize method? thanks
# region imports
from AlgorithmImports import *
# endregion
class GeekyTanSardine(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2024, 10, 1)
self.SetEndDate(2024, 10, 1)
self.SetCash(100000)
self.AddEquity("AAPL", Resolution.Daily)
self.accessDate = 0
self.universe_settings.resolution = Resolution.DAILY
self._universe = self.add_universe(self.MyCoarseFilterFunction)
self.symbolDict = {}
def MyCoarseFilterFunction(self, coarse):
filtered = [f for f in coarse if f.has_fundamental_data]
return [f.Symbol for f in filtered]
def OnData(self, data: Slice):
if self.Time.day != self.accessDate:
for symbol, trade_bar in data.bars.items():
self.Debug(symbol)
self.accessDate = self.Time.day
Mia Alissi
Sources: Custom Data Linked Iconic Type Add Data On Securities Changed Regression Algorithm, Idea Streams #11 - Replicating a Goldman Sachs Index Using Quant Strategies, Leveraged ETFs With Systematic Risk Management, Momentum Effect In Commodities Futures, Asset Growth Effect
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.
William Chau
I have similar code. But the backtest prints nothing
William Chau
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!