Some recent change on the backend has made previously working algorithms start coredumping early in backtests.

I have a very simple algorithm that reproduces this. I couldn't attach it in the normal way because it doesn't show up in the menu, having ended in a runtime error. Also it won't let me include the "share" URL. But here's the code.

 

class IndicatorAlpha:
    # This alpha just tries to recreate a buggy trade
    def __init__(self):
        self.indicator = {}
    
    def Update(self, algorithm, slice):
        return []

    def OnSecuritiesChanged(self, algorithm, changes):
        for removed in changes.RemovedSecurities:
            if removed.Symbol in self.indicator:
                del self.indicator[removed.Symbol]

        for added in changes.AddedSecurities:
            indicator = IndicatorExtensions.Times(algorithm.CMO(added.Symbol, 24, Resolution.Minute), -1)
            #algorithm.Log(f"Created indicator {indicator}")
            self.indicator[added.Symbol] = indicator

class SleepyRedSnake(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 1, 1)  # Set Start Date
        self.SetEndDate(2018, 12, 31)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash

        self.AddAlpha(IndicatorAlpha())

        self.SetExecution(ImmediateExecutionModel())
        self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel())

        self.UniverseSettings.Resolution = Resolution.Minute
        self.SetUniverseSelection(QC500UniverseSelectionModel())


    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
        '''

        # if not self.Portfolio.Invested:
        #    self.SetHoldings("SPY", 1)

 

 

Author