Hello guys,

I encountered this issue recently once i tried to work on futures in a FutureUniverseSelectionModel. I even splitted futures i need in to categories, based on exchanges they are traded. I separated them, to see where the issue is. Because if I dont use FutureUniverseSelectionModel, but initialize them separatly, it works. 

I found on the forum here a answer, suggestion, but the thread was created some time ago. And it does not work anymore. Probably something has been changed. 

Anyways here is a copy from the concole:

Runtime Error: SystemError : <bound method 'OnWarmupFinished'> returned a result with an error set SystemError : <bound method 'OnWarmupFinished'> returned a result with an error set (Open Stacktrace)

from FuturesUniverseSelectionModel import FuturesUniverseSelectionModel class ParticleQuantumThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 1, 1) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.UniverseSettings.Resolution = Resolution.Minute self.SetUniverseSelection(FuturesUniverseSelectionModel(self.SelectFuturesSymbols)) self.symbol = {} def OnData(self, data): # Loop over each available futures chain from slice.FutureChains data for chain in data.FutureChains: self.popularContracts = [c for c in chain.Value if c.OpenInterest > 500] if len(self.popularContracts) == 0: continue sortedByOIContracts = sorted(self.popularContracts, key=lambda k: k.OpenInterest, reverse=True) self.liquidContract = sortedByOIContracts[0] under = self.liquidContract.UnderlyingSymbol self.Plot("Future", str(under), self.liquidContract.LastPrice) self.Plot("Volume", str(under), self.liquidContract.Volume) self.Plot("OpenInterest", str(under), self.liquidContract.OpenInterest) if under not in self.symbol: self.symbol[under] = self.liquidContract.Symbol if self.symbol[under] == self.liquidContract.Symbol: continue else: self.symbol[under] = self.liquidContract.Symbol self.Debug(f"{self.symbol[under]} -- Expiry: {self.liquidContract.Expiry.date()}, {self.Time}") def SelectFuturesSymbols(self, utcTime): softTickers = [ Futures.Softs.Cocoa, Futures.Softs.Sugar11CME, ] energyTickers = [ Futures.Energies.CrudeOilWTI, Futures.Energies.NaturalGas, Futures.Energies.Gasoline, Futures.Energies.HeatingOil, ] metalTickers = [ Futures.Metals.Gold, Futures.Metals.Copper, ] currencyTickers = [ Futures.Currencies.CAD, Futures.Currencies.JPY, Futures.Currencies.CHF, Futures.Currencies.EUR, Futures.Currencies.GBP, ] grainTickers = [ Futures.Grains.Wheat, Futures.Grains.Corn, Futures.Grains.Soybeans, Futures.Grains.SoybeanMeal, Futures.Grains.SoybeanOil, Futures.Grains.Oats, ] indexTickers = [ Futures.Indices.SP500EMini ] indices = [ Symbol.Create(indexTickers, SecurityType.Future, Market.CME) for ticker in indexTickers] energy = [ Symbol.Create(energyTickers, SecurityType.Future, Market.NYMEX) for ticker in energyTickers] grains = [ Symbol.Create(grainTickers, SecurityType.Future, Market.CBOT) for ticker in grainTickers] softs = [ Symbol.Create(softTickers, SecurityType.Future, Market.NYMEX) for ticker in softTickers] metals = [ Symbol.Create(metalTickers, SecurityType.Future, Market.Comex) for ticker in metalTickers] currencies = [ Symbol.Create(currencyTickers, SecurityType.Future, Market.CME) for ticker in currencyTickers] # allTickes = indices + energy + currencies + grains + metals + energy + softs return energy ################################ from Selection.FutureUniverseSelectionModel import FutureUniverseSelectionModel from datetime import date, timedelta class FuturesUniverseSelectionModel(FutureUniverseSelectionModel): def __init__(self, select_future_chain_symbols): super().__init__(timedelta(1), select_future_chain_symbols) def Filter(self, filter): return (filter.Expiration(timedelta(0), timedelta(180)) .OnlyApplyFilterAtMarketOpen())

Author