My trading algorithm will use minute resolution with extended market hours to make orders and use SMA with daily and weekly resolution. How can I directly request minute and daily resolution at the same time?
I tried to consolidate minute data to daily data but it won't work. Because the daily bar should reflect the regular trading hours. And there is also some early close trading day.
Mia Alissi
You can request minute resolution data with extended market hours and daily resolution data at the same time by using the
AddEquity
method.For minute resolution data with extended market hours, you can use the following code:
This code will subscribe to SPY data at minute resolution and include data from pre and post-market trading hours.
For daily resolution data, you can use the following code:
This code will subscribe to SPY data at daily resolution and only include data from regular trading hours.
Remember, you only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.
For more information, you can refer to the QuantConnect Documentation.
Regarding the issue with consolidating minute data to daily data, it's important to note that the daily bar should indeed reflect the regular trading hours. If you're trying to consolidate minute data to daily data but also want to include extended market hours, you might run into issues because the daily bar is designed to only reflect regular trading hours.
If you need to work with data from extended market hours, you should stick with minute, second, or tick resolution. If you need to analyze data at a daily level, you could consider using rolling windows or other techniques to aggregate the minute-level data in a way that suits your needs.
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.
Shuai Liu
During warm up periods I can only access minute resolution but I need warm up my daily SMA.
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!