Hey there,

I'm trying to consolidate 500ticks data using TradeBarConsolidator,

using the following reference : 

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DataConsolidationAlgorithm.py

I tried to adapt it to futures:

class DynamicCalibratedContainmentField(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 3, 1) # Set Start Date self.SetEndDate(2020,3,2) #Set End Date self.SetCash(50000) ticker = Futures.Indices.NASDAQ100EMini self.AddFuture(ticker, Resolution.Tick ) #self.ESSMA = self.SMA(futureES.Symbol, 2) CountConsolidator = TradeBarConsolidator(500) CountConsolidator.DataConsolidated += self.BarHandler self.SubscriptionManager.AddConsolidator(ticker, CountConsolidator) def BarHandler(self, sender, bar): # With hourly data the bar period is 3-hours self.Debug(str(bar.EndTime - bar.Time) + " " + bar.ToString()) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' for contract in data.FutureChains: contracts = list(filter(lambda x: x.Expiry > self.Time, contract.Value)) if len(contracts) == 0: return self.Debug(f"{self.Time} Last Price: {contracts[0].LastPrice}")

Is the following request supported?

Author