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 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
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 future = self.AddFuture(ticker, Resolution.Tick) 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 = TickConsolidator(500) CountConsolidator.DataConsolidated += self.BarHandler self.SubscriptionManager.AddConsolidator(contract.Symbol, CountConsolidator) self.consolidator_by_symbol[contract.Symbol] = CountConsolidator def BarHandler(self, sender, bar): self.calls += 1 def OnEndOfAlgorithm(self): self.Log(f"Calls: {self.calls}")