Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidator Interferes With Identity Indicator #8017

Open
4 tasks done
DerekMelchin opened this issue May 10, 2024 · 0 comments
Open
4 tasks done

Consolidator Interferes With Identity Indicator #8017

DerekMelchin opened this issue May 10, 2024 · 0 comments
Assignees

Comments

@DerekMelchin
Copy link
Collaborator

Expected Behavior

The following algorithm logs the current close price of SPY

class SmoothTanRhinoceros(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2022, 11, 9)
        self.set_end_date(2022, 12, 15)
        self._symbol = self.add_equity("SPY").symbol
        self.consolidate(self._symbol, Resolution.DAILY, lambda bar: 1)
        self._current = self.identity(self._symbol, Resolution.DAILY)
        min_ = self.min(self._symbol, 5, Resolution.DAILY)
        min_.updated += lambda x, y: self.log(f"{self.time} - Current close: {self._current.current.value};")

Actual Behavior

The logs show that the identity indicator isn't updated correctly

2022-11-11 09:31:00 :	2022-11-11 00:00:00 - Current close: 385.804146685;
2022-11-14 09:31:00 :	2022-11-12 00:00:00 - Current close: 385.804146685;
2022-11-15 09:31:00 :	2022-11-15 00:00:00 - Current close: 389.538145115;
2022-11-16 09:31:00 :	2022-11-16 00:00:00 - Current close: 386.22446588;
2022-11-17 09:31:00 :	2022-11-17 00:00:00 - Current close: 386.547036425;
2022-11-18 09:31:00 :	2022-11-18 00:00:00 - Current close: 386.547036425;

but if I comment out the self.consolidate method, it is

2022-11-11 09:31:00 :	2022-11-11 00:00:00 - Current close: 385.804146685;
2022-11-14 09:31:00 :	2022-11-12 00:00:00 - Current close: 389.538145115;
2022-11-15 09:31:00 :	2022-11-15 00:00:00 - Current close: 386.22446588;
2022-11-16 09:31:00 :	2022-11-16 00:00:00 - Current close: 389.518595385;
2022-11-17 09:31:00 :	2022-11-17 00:00:00 - Current close: 386.547036425;
2022-11-18 09:31:00 :	2022-11-18 00:00:00 - Current close: 385.36427776;

Potential Solution

N/A

Reproducing the Problem

Run algorithm above

To print out the correct close values in the research environment, run

qb = QuantBook()
symbol = qb.add_equity("SPY").symbol
qb.history(symbol, datetime(2022, 11, 5), datetime(2022, 11, 25), Resolution.DAILY).loc[symbol]['close']

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants