Hello, I am new here.. Nowadays I met a problem with data. Ideally, I would like to use daily close price to derive the signals such as MACD or MA, but the date of time series looks not correct..(It should be my mistake)
As the figure shows, the daily close prices during a week are from Tuesday to Saturday (2021-12-07 to 2021-12-11) but it should be from Monday to Friday (2021-12-06 to 2021-12-10)…
Here is what I did:
(1) Set a time zone:
self.SetTimeZone("America/New_York")
(2) Add a security:
self.security = self.AddEquity("SPY", Resolution.Daily)
(3) Set a Schedule (I would like to get the signal 5 mins before the market close)
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.BeforeMarketClose('SPY', 5), self.calculate_signal)
(3) Pull Historical data (close price)
self.df_SPY = self.History(self.Symbol("SPY"), 100)["close"]
Can anyone help me with this?
Best,
Arthur
Fred Painchaud
Hi Arthur,
Please check out
Daily bars end at midnight, so when your algo receives them, it is midnight so it is the next day. The Monday daily bar arrives at 00:00:00 on Tuesday, Tuesday on Wednesday, …, Friday on Saturday. So the dates you see are the end times.
Fred
Jared Broad
@David - some futures markets are open Sunday, so the daily bar ends Monday.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
David Gordon
:) Jared Broad , I stand corrected. Thanks for the quick reply.
Arthurchen_2022
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!