Hi,
This is my first community post! I have been revisiting bootcamps lately and creating a few lines of code to understand what is underneath the hood.
I have a question resulted from cloned code:
The line of code self.unco= self.dataframe["close"].unstack(level=1) (assume
self.dataframe = self.History([self.Symbol("IBM"), self.Symbol("AAPL")], 3)) is an invalid operation (probably because the self.dataframe["close"] cannot be possibly unstacked on any direction/dimension other than level=0).
As I backtest the code through Debug, if I place a breakpoint right after the aforementioned line of code, I receive the following feedback when watching the variable self.unco "***TypeError: 'Timestamp' object is not iterable". So, why is it that if I do not place any breakpoints and just let the code be fully backtested I receive no errors, I get a succesful log and I can even go through the data anywhere from StartDate to EndDate although I made a call to self.unco at the end of my Ondata method? My understanding was that if there was an invalid syntax or a call of an invalid function the code will not progress further. Is there anything I am missing here?
Thanks,
Eduardo Valdivia
Adding Clone/ BackTest
Derek Melchin
Hi Eduardo,
We were unable to reproduce the problem. For us, the TypeError is being thrown with or without breakpoints.
The DataFrame returned from the History method can currently only be unstacked using `.unstack(level=0)`. See the attached notebook for reference.
Best,
Derek Melchin
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.
Eduardo Valdivia
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!