⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Security Session contains bars with invalid time/end_time #9208

@DerekMelchin

Description

@DerekMelchin

Expected Behavior

The following algorithm runs without error

class SessionErrorAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2021, 1, 7)
        self._spy = self.add_equity("SPY", Resolution.DAILY)
        self._spy.session.size = 35
        self.set_warm_up(timedelta(60))
        
    def on_data(self, data):
        if self.is_warming_up:
            return
        bars = list(self._spy.session)[::-1]
        for b in bars:
            b.end_time

Actual Behavior

Runtime Error: The added or subtracted value results in an un-representable DateTime. (Parameter 't')
at on_data
b.end_time
in main.py: line 19 (Open Stack Trace)

The time of the problematic bar has a year of 9999 too

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions