Enable daily precise end time by default (#8254)
API Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled

* Default daily precise end times

- Enable by default daily precise end times. Updating stats
- Minor fix for algorithm manager consolidator updates, adding new regression test
  asserting behavior and updating others
- Minor fix for SubscriptionData creator avoid round down on warmup if
  not appropiate
- Adjust consolidators to emit on daily strict end times if requested
  daily resolution and setting enabled
- Updating regression algorithms

* Skip daily data on extended market hours

* Some cleanup and self review

* Revert unrequired change
This commit is contained in:
Martin-Molinero
2024-08-14 12:49:56 -03:00
committed by GitHub
parent d2d366e3f9
commit 7879795207
203 changed files with 2517 additions and 1984 deletions
+3 -16
View File
@@ -43,10 +43,9 @@ class RegressionAlgorithm(QCAlgorithm):
self.__last_trade_trade_bars = self.time
for kvp in data.bars:
period = kvp.value.period.total_seconds()
if self.round_time(self.time, period) != self.time:
pass
bar = kvp.Value
if bar.is_fill_forward:
continue
symbol = kvp.key
holdings = self.portfolio[symbol]
@@ -55,15 +54,3 @@ class RegressionAlgorithm(QCAlgorithm):
self.market_order(symbol, 10)
else:
self.market_order(symbol, -holdings.quantity)
def round_time(self, dt=None, round_to=60):
"""Round a datetime object to any time laps in seconds
dt : datetime object, default now.
roundTo : Closest number of seconds to round to, default 1 minute.
"""
if dt is None : dt = datetime.now()
seconds = (dt - dt.min).seconds
# // is a floor division, not a comment on following line:
rounding = (seconds+round_to/2) // round_to * round_to
return dt + timedelta(0,rounding-seconds,-dt.microsecond)