I a looking for a way to request historical data from the last calendar month. I see you can use delta 7 for calendar weeks and delta 365 for calendar years, but I could not find anything for a calendar Month. I'm sure it is because unlike a week or year, the number of days in a month varies. So I'm asking if someone knows a way I can get historical data by the calendar month, please let me know below. Whether it is your own creativity or an api I don't know about.
I'm a longer-term trader and 85% of the problems I face would be solved if QC just had a simple weekly and monthly calendar resolution. Instead of using delta and Consolidators (can't use consolidators inĀ self.History(). If there is a way let me know that would also solve this current problem)
Douglas Stridsberg
Hi,
Monthly consolidation is available, please see this example algo for more information.
Consolidators can definitely be used with the History() call. You simply need to call the consolidator's .Update()Ā method on each of the received rows of daily history. This example shows how to do it for indicators, but the process is much the same for consolidators.
Ez Buckets
Douglas StridsbergĀ
Could you provide a template on how I would get the consolidated data into the history() function. My understanding from what I read and what I was told is that it only takes in resolutions.
Douglas Stridsberg
Hi,
What exactly are you looking to achieve with the history call? I thought you were trying to "warm up" a consolidator so-to-speak, using the History function, but it would seem that's not what you want.
Mostly people use the history call to warm up indicators - if you have a consolidator you want to use instead, it's a simple case of registering the indicator to use that consolidator directly. When the consolidator has new data, it will push it straight to the indicator.
Ez Buckets
Douglas StridsbergĀ
Am I am trying to use history() to get the past calendar month data values. Then make trades based on those data values (ex: open, high, vol etc). Ā So basically how someone can use delta 7 and delta 365 to get the calendar week and year data values in the history() function. I want to do the same for the calendar month.
Ā
Also a quick side question, is their a way I could use history() to get the data values from a specific historical bar or is rolling window the only way to achieve that.
Douglas Stridsberg
I see.
I would do the following:
Running multiple History() requests is slow and inefficient. It's better to let the algorithm get the data and update the rolling window for you.
Ez Buckets
Douglas StridsbergĀ , won't using rolling windows require the algorithm to collect and fill up all the windows before it can use the data. So for example, if I have 2 rolling windows the current month and last month. Won't the algo have to "warm-up" and do nothing for 1 whole month before it has data to use? And a more extreme of if I wanted the last 8 monthsĀ (9 rolling windows) then the algo would have to collect data for 8 months before it can start executing, or have I missed understood how rolling windows work?
Douglas Stridsberg
No - you can still use a rolling window even if it's not fully populated. You just need to be very careful with not trying to access the empty elements.
A better approach is simply to tell your algorithm to warm up beforeĀ it starts, so that all your windows are ready and populated. There are examples in the documentation and github on how to do this. If you've registered the consolidator with the subscription manager, you can use SetWarmup() in the Initialize() method.
John Paul Dulay
Hello all,
I am trying to obtain a tradebar dataframe that has monthly timeseries in the Research environment. Below is the block of code I have that outputs a tradebar dataframe in daily resolution.
Ā
Ez Buckets
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!