Skip to content

Backtest Log Time != IAlgorithm.Time #9103

@AlexCatarino

Description

@AlexCatarino

Expected Behavior

The timestamps match

Actual Behavior

Image

Potential Solution

N/A

Reproducing the Problem

class EnergeticSkyBlueButterfly(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2025, 10, 29)
        self.set_cash(100000)
        self.add_equity("SPY", Resolution.MINUTE) 
        #self.schedule.on(self.date_rules.every_day('SPY'),self.time_rules.after_market_open('SPY', 10),self._market_open)
        self.schedule.on(self.date_rules.every_day('SPY'),self.time_rules.after_market_open('SPY', 11),self._market_open)
        self.schedule.on(self.date_rules.every_day('SPY'),self.time_rules.after_market_open('SPY', 12),self._market_open)
        self.schedule.on(self.date_rules.every_day('SPY'),self.time_rules.after_market_open('SPY', 13),self._market_open)
    def on_data(self, data: Slice):
        if not self.portfolio.invested:
            self.set_holdings("SPY", 1)
    def _market_open(self):
        self.log(str(self.Time))

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions