Hi, I was writing my algorithm that subscribes to hourly data when I realized that the end time of hourly bars are not accurate. (ie. the end time of the first hourly bar is now 10:00am rather than 9:30am, and 11:00am rather than 10:30, etc). Is this a bug or am I writing code incorrectly?
This issue has extended to causing big discrepancies with OHLC prices from other sources outside (e.g. TradingView, etc)
Can someone please help? I have illustrated the issue with the attached code. I am new to quantconnect and python so appreciate more understandable responses. Thanks!
Derek Melchin
Hi Pak,
Hourly bars are passed to the algorithm at the end of each hour. Refer to our Understanding Time documentation.
To get bars passed mid-hour, consider consolidating 1-minute bars into 30-minute bars.
Best,
Derek Melchin
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.
Big Chai
Hi Derek, thanks for your response. However, this will create 30 min bars rather than hourly bars. Is there any way to get exactly hourly bars that start and end on the half hour?
Thanks!
Derek Melchin
Hi Big Chai,
We can accomplish this by creating a custom consolidator. See the attached backtest for an example.
Best,
Derek Melchin
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.
Big Chai
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!