We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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};")
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
self.consolidate
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;
N/A
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']
QC Cloud
master
The text was updated successfully, but these errors were encountered:
Martin-Molinero
Successfully merging a pull request may close this issue.
Expected Behavior
The following algorithm logs the current close price of SPY
Actual Behavior
The logs show that the identity indicator isn't updated correctly
but if I comment out the
self.consolidate
method, it isPotential Solution
N/A
Reproducing the Problem
Run algorithm above
To print out the correct close values in the research environment, run
System Information
QC Cloud
Checklist
master
branchThe text was updated successfully, but these errors were encountered: