QuantConnect/Lean

snake_case Error Messages for Python

Opened this issue · 0 comments

Expected Behavior

This algorithm throws an error message with the method names in snake_case

class MyAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2024, 12, 11)
        self.add_equity('SPY', Resolution.DAILY).symbol
        self.set_warm_up(timedelta(7))
    
    def on_data(self, data):
        if not self.portfolio.invested:
            self.set_holdings('spy', 1)

Actual Behavior

Backtest Handled Error: This operation is not allowed in Initialize or during warm up: OrderRequest.Submit. Please move this code to the OnWarmupFinished() method.

Potential Solution

N/A

Reproducing the Problem

Run the algorithm above.

System Information

QC Cloud

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue