Fixes time zone (#7128)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled

If we use `.astimezone(dt.tzinfo)`, the new time was convering the timezone from local (e.g. PST) to GMT (dt.tzinfo). In this case, we only want to remove the timezone to enable the operation.
This commit is contained in:
Alexandre Catarino
2023-03-22 22:02:11 +00:00
committed by GitHub
parent 1c81f5d028
commit 7feb46fec5
@@ -35,7 +35,7 @@ class BaseFrameworkRegressionAlgorithm(QCAlgorithm):
# With this procedure, the Alpha Model will experience multiple universe changes
self.AddUniverseSelection(ScheduledUniverseSelectionModel(
self.DateRules.EveryDay(), self.TimeRules.Midnight,
lambda dt: symbols if dt < self.EndDate.astimezone(dt.tzinfo) - timedelta(1) else []))
lambda dt: symbols if dt.replace(tzinfo=None) < self.EndDate - timedelta(1) else []))
self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(31), 0.025, None))
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())