Hi all,

Apologies if this is the wrong style of question or if there's another place to put mechanics questions about the API and framework. As the title suggests, I'm a relative beginner here and having difficulty reading the documentation on Consolidators and applying that to a practical (non-example) algorithm. I've read the documentation reference and understand it in broad strokes, as well as read through the example futures consolidation code, but can't seem to distill how to now access a front-month contract within the Consolidator's event method.

My understanding from completing the Futures boot camp is that the OnData() method receives as parameters the slice object, which contains FutureChains to parse down for the front-month contract.

However, the process of registering an event handler for a Consolidator has a different signature, so if I rebase a minute resolution into, say, 90-minute bars, how do I go about parsing the FutureChains (and including additional trading logic) within the OnDataConsolidated() method?

Below is an attempt at a MWE I pieced together quickly to give a code illustration to what I'm attempting to describe.

class BasicTemplateFuturesConsolidationAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetCash(100000) ES = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute) ES.SetFilter(0, 182) self.consolidators = dict() def OnData(self,slice): pass def OnDataConsolidated(self, sender, quoteBar): # This should be called every 90 minutes, after consolidating a minute # interval. How do I access the slice object or otherwise discover a # front-month contract to now begin analyzing/trading? def OnSecuritiesChanged(self, changes): for security in changes.AddedSecurities: consolidator = QuoteBarConsolidator(timedelta(minutes=90)) consolidator.DataConsolidated += self.OnDataConsolidated self.SubscriptionManager.AddConsolidator(security.Symbol, consolidator) self.consolidators[security.Symbol] = consolidator for security in changes.RemovedSecurities: consolidator = self.consolidators.pop(security.Symbol) self.SubscriptionManager.RemoveConsolidator(security.Symbol, consolidator) consolidator.DataConsolidated -= self.OnDataConsolidated

Thanks in advance for any help anyone can provide.