I created a dictionary of lists, with symbols as keys. When I try to pass one of the lists to a function, it says it is two arguments, one of which is a "QuantConnect.Algorithm.QCAlgorithm" and the other seems to be the list. I believe there may be some workaround but I would like to understand why this is happening because I have no idea. I attached a backtest with the offending line commented out (line 245). The dictionary and lists are populated from lines 197-203, with the function call starting at line 116. It can be seen the call at line 128 outputs "QuantConnect.Algorithm.QCAlgorithm", with the call at line 131 seemingly outputting the list (it is supposed to be some integer from 1-10, but I do not supply it because the call gives an error about being given 4 arguments instead of 3). Thanks.
Dahui
Took another look -- is self automatically passed to all functions?
Shile Wen
Hi Dahui,
In Python, class functions always has the first argument be the instance of the class. Please see here for more information on this.
Best,
Shile Wen
Dahui
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!