I'm rebalancing my portfolio every week and I'm using the algorithm framework.

To send correct signals I send insights with duration of 5 days at time of the rebalance: basically with the following code (which works but I'm wondering if there is better / more correct way):

 

insights = [] for eq, weight in pos.items(): if weight != 0: insight = Insight.Price(eq, timedelta(days=5), InsightDirection.Up, weight, weight) insight.Weight = weight insights.append(insight) self.EmitInsights(Insight.Group(insights))

 

 

Is this correct way to do this? How I specify a signal that is active until next week start day so that the position is never liquidated (for example with InsightWeightingPortfolioConstructionModel and ImmediateExecutionModel)

Author