Add python syntax check (#8651)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled

* Add python syntax check

* Fix some python regression algorithms

* Fixing more bugs
This commit is contained in:
Martin-Molinero
2025-03-28 10:36:26 -03:00
committed by GitHub
parent 581e87809b
commit 513ced31d7
155 changed files with 667 additions and 587 deletions
@@ -45,14 +45,14 @@ class BasicTemplateIndexDailyAlgorithm(QCAlgorithm):
self.settings.daily_precise_end_time = True
def on_data(self, data: Slice):
if not self.Portfolio.Invested:
if not self.portfolio.invested:
# SPX Index is not tradable, but we can trade an option
self.MarketOrder(self.spx_option, 1)
self.market_order(self.spx_option, 1)
else:
self.Liquidate()
self.liquidate()
# Count how many slices we receive with SPX data in it to assert later
if data.ContainsKey(self.spx):
if data.contains_key(self.spx):
self.BarCounter = self.BarCounter + 1
def OnEndOfAlgorithm(self):
@@ -60,8 +60,8 @@ class BasicTemplateIndexDailyAlgorithm(QCAlgorithm):
raise ValueError(f"Bar Count {self.BarCounter} is not expected count of {self.ExpectedBarCount}")
for symbol in [ self.spx_option, self.spx ]:
history = self.History(symbol, 10)
history = self.history(symbol, 10)
if len(history) != 10:
raise ValueError(f"Unexpected history count: {history.Count}")
raise ValueError(f"Unexpected history count: {len(history)}")
if any(x for x in history.index.get_level_values('time') if x.time() != time(15, 15, 0)):
raise ValueError(f"Unexpected history data time")