Hi,
What would be the correct way of emmiting daily insights after market close when using minute data using Algorithm Framework?
For example, with simple Symbol data like this:
class SymbolData:
closing_prices: typing.Optional[RollingWindow]
def __init__(self, security: Security, algorithm: QCAlgorithm):
self.Security = security
self.Symbol = security.Symbol
self.closing_prices = RollingWindow[float](Parameters.momentum_tracking)
self.algorithm = algorithm
algorithm.Consolidate(self.Symbol, Resolution.Daily, self.record_closing_price)
def record_closing_price(self, consolidated: TradeBar):
self.closing_prices.Add(consolidated.Close)
Update funuction that is responsible for emmiting insights will only be called on Market Close, but at that time SymbolData will not have updated "closing_prices" list. It will be available right after the market close but Update will not be called until the next morning. A workaround that I can think of is a Schedule after market close, which will, for example, call Update, but I am not sure if it is a propper way. Also, since update is called every minute, but insights are meant to be emmited only at the end of the day, is it ok to return an empty list or should it return None instead?
Aram Darakchian
Solved it by changing the logic to do the checks/emmiting insigts on AfterMarketOpen.
Aram Darakchian
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!