Fix Security.IsMarketOpen for cases outside regular MH and last bar (#7343)

* Fix Security.IsMarketOpen for cases outside regular MH and last bar

* Minor changes

* Move bar check of IsMarketOpen into FillModel

* Minor changes

* Minor changes

* Minor changes
This commit is contained in:
Jhonathan Abreu
2023-07-03 13:40:31 -04:00
committed by GitHub
parent 240d7db8e2
commit d39a9420d5
9 changed files with 322 additions and 17 deletions
@@ -51,7 +51,7 @@ class BasicTemplateOptionsDailyAlgorithm(QCAlgorithm):
contracts = sorted(chain, key = lambda x: x.Expiry)
# if found, trade it
if len(contracts) == 0 or not self.IsMarketOpen(contracts[0].Symbol): return
if len(contracts) == 0: return
symbol = contracts[0].Symbol
self.MarketOrder(symbol, 1)