Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-8.94
Tracking Error
0.342
Treynor Ratio
0
Total Fees
$0.00
class DynamicCalibratedContainmentField(QCAlgorithm):

        def Initialize(self):
            self.SetStartDate(2020, 4, 1)  # Set Start Date
            self.SetEndDate(2020,5, 1)    #Set End Date
            self.SetCash(50000) 

            ticker = Futures.Indices.NASDAQ100EMini
            future = self.AddFuture(ticker, Resolution.Minute)
            future.SetFilter(0, 90)
    
            self.consolidator_by_symbol = {}
            self.calls = 0

        def OnData(self, data):
            for chain in data.FutureChains:
                contracts = list(chain.Value)
                if len(contracts) == 0:
                    continue
                
                sortedByOIContracts = sorted(contracts, key=lambda k : k.OpenInterest, reverse=True)
                contract = sortedByOIContracts[0]
                
                if contract.Symbol in self.consolidator_by_symbol:
                    continue
                
                CountConsolidator = QuoteBarConsolidator(timedelta(days=1))
                CountConsolidator.DataConsolidated += self.BarHandler
                self.SubscriptionManager.AddConsolidator(contract.Symbol, CountConsolidator)
                self.consolidator_by_symbol[contract.Symbol] = CountConsolidator
                
            
        def BarHandler(self, sender, bar):
            self.Log(f"Consolidated bar received at {self.Time}")