If I have a hourly resolution, and I considate to Daily, how does Lean calculate OHLC values?
1. Does it consoldate 8 hours (assuming 8hours = 1 day) for every hour bar generated? meaning would i have 8 1day bars (with moving consolidation of rolling hours) ?
2. Just for testing purposes, I created a 15 min consolidator on hourly resolution and assumed it would throw an exception. But it still returned values. Curious to know why and how that happens
Thanks!
Aaron Janeiro Stone
I would recommend the Opening Range Breakout bootcamp to get a hang of it. Basically, a consolodator picks up the data in OnData until the requirement set in Initialize is met (e.g.,
self.AddEquity("TSLA", Resolution.Minute)
self.Consolidate("TSLA", timedelta(minutes=30), self.OnDataConsolidated)
will take the first 30 minutes to consolodate, the data being acquired over 30 instances of OnData). When the requirement is met (in this case, 30 minutes), whatever you define in
def OnDataConsolidated(self, bar):
will occur to the bar object created.
Aaron Janeiro Stone
And just to be clear, the bar object is a "consolodation" of the smaller resolutioned values picked up in the OnData passes (being minutes in the example I gave)
Rakesh Gopal
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!