I'm trying to figure out how exactly the insights returned from my alpha model works. I'm particularly confused about the insight period. As far as I understand, it's a timedelta that shows how long your insight is valid for, and after that period, the position should be automatically closed. 

However, that is not really the behavior I'm getting when trying to test it out. 

For example, in the attached code, the backtest sells my position the following day after 2 hours (so 26 hours) instead of the original 2 hours added as a timedelta period. 

Also, would there be a way to set the insight period to None so that the position wouldn't liquidate unless it was told? 

def Initialize(self): self.SetStartDate(2020, 9, 9) self.SetEndDate(2020, 9, 10) self.UniverseSettings.Resolution = Resolution.Hour self.SetUniverseSelection( ManualUniverseSelectionModel(Symbol.Create("SPY", SecurityType.Equity, Market.USA) ) self.AddAlpha(MyAlphaModel()) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) self.SetRiskManagement(NullRiskManagementModel()) self.SetExecution(ImmediateExecutionModel()) class MyAlphaModel: def Update(self, algorithm, data): if data["SPY"] is None: return insights = [] if algorithm.Time.date() == date(2020, 9, 9): insights.append(Insight.Price("SPY", timedelta(hours = 2), InsightDirection.Up)) return insights def OnSecuritiesChanged(self, algorithm, changes): # Handle security changes in from your universe model. pass