Back

Recreating Matching Data Timeframes

Hey guys, I have a few of questions about how OnData and the subscriptions work and their comparison to consolidators and different time frames.  In particular, I'm curious when/where/how an hourly data and minutely (or hour/daily, etc.) data subscription would line up.

1. What's considered the first, second, and last bar timeframes of hourly data?  Is this 9:30AM (or 9:00AM?), 10:00AM, and 4:00PM?  Similarly, how many hourly bars would actually get processed in a single day?

2. If recreating the hourly bars (or daily for that matter) using consolidators with minutely data, what frames would need to referenced to get them to line up correctly?  I'm concerned that if an hour subscription is based on hourly timed data and a minute subscription is based on minute data they could be off should the minute data not be filled once or twice in an hour period.  

Say that you had an hour data subscription in one algrorithm and then in a second algorithm you have a consolidator that is subscribed minute data and consolidates 60 minutes. If the first alrogirthm's OnData fills its hour bar at 11:00AM updating from the previous 10:00AM bar and the second algorithm missed 2 minutes of data  points along the way would the second algorithm's consolidator report an hourly bar data 11:02 AM?

Part of the reason I'm wondering about this is that if OnData reacts to receiving data and at a higher resolution would cover a trading day, would making a consolidator actually cover these same OnData events or would it possibly lose the ability to process one event if no data is received for a short time and have the event pushed down the line?

3. I know the "self.Time" function exists and can be called to log a comparable time frame, however, I've not had much work with the function. Can this function be used in lieu of OnData/Consolidators for lining up the market times correctly?

 

Sorry for the longwinded post and thanks in advance for any answers!

 

 

Update Backtest







0

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.


 

Hi Brad, 

Thanks for sharing your questions! I’d like to respond with the following for now, and go a bit more in depth if needed tomorrow. 

#1. In LEAN the hourly bars deliver data from 9:00AM to 4:00PM. Since the market opens at 9:30AM, the first bar is from 9:00AM to 10:00AM but only contains a half hour of data (while the market’s open). There are 7 bars of hourly data for a single day except for market holidays.  

#2. Good call. You would need to have the minute consolidator only consolidate from 9:30AM-10AM, then every hour. As for daily data, it is consolidated from midnight to midnight. In general, you shouldn’t have a problem with missing data. In live we send the consolidated bars with wall clock time (so we wouldn’t wait until 11:02, for example). 

#3. You can use self.Time as a clock to access specific times during the day with self.Time.hour == 10 and self.Time.minute == 0  for 10AM. You would not use self.Time for the same reason as a consolidator.

Thanks, 

Sherry 

1

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.


Thank you for your repsonse! This is exactly what I was looking for.  I think I have a much better understanding of the data delivery now.

0

Update Backtest





0

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.


Loading...

This discussion is closed