I'm fairly new to Python as well as QuantConnect (previously a Javascript dev), and I'm needing help on this one.
I'm trying to get to where I have a List of Numpy arrays where each Numpy array has 20 rows of Historical data and indicators for each row. However, each subsequent array I want to have it's previous 19 bars of historical data for that bar. So kind of like this:
From data like this:
Datetime SMA EMA MACD RSI OpenPrice NextOpenPrice
9/3/19 12:55 35 34 8 3 34.17 35.01
9/3/19 12:50 34 33 9 2 33.18 34.17
9/3/19 12:45 32 33 8 3 32.48 33.18
9/3/19 12:40 32 32 9 3 32.12 32.48
I want the Numpy arrays to look like this:
print(resultset)
resultset[
array( [ [ 35, 34, 8, 3, 34.17, 35.01],
[ 34, 33, 9, 2, 33.18, 34.17], [ 32, 33, 8, 3, 32.48, 33.18], [ . . . ] [ ---total of 20 rows-- ], [ . . . ], [ 27, 28, 5, 1, 26.48, 26.89] ] ),array( [ [ 34, 33, 9, 2, 33.18, 34.17], <----Notice how this next array starts on the second row of the first array
[ 32, 33, 8, 3, 32.48, 33.18], [ 32, 32, 9, 3, 32.12, 32.48], [ . . . ] [ ---total of 20 rows-- ], [ . . . ], [ 26, 27, 4, 1, 26.13, 26.48] ] ), . . . ---nparrays for each group of bars back 240 bars--- ---meaning a rolling group of 20 bars for each 240 bars--- . . . ] I'm having trouble adding the indicators to the historical data as well as figuring out how to get those rolling 20 bars into each array. You'll also notice I have the times in increments of 5 minutes. I'm also having trouble getting both history data and indicators matched up correctly on increments of 5 minutes. I know I'm supposed to use a Consolidator, but I can't figure out how to get that to work for history and indicators and the times be matched up correctly. I hope this makes sense and someone can help me Thank you
Jonathan Ganucheau
Alex from QuantConnect was able to help me with this.
Thank you, Alex!
Jonathan Ganucheau
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!