Hey guys,
I get the following error for my code:
Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'NoneType'>) method. Please checkout the API documentation
I went through the code step by step and the error occurs due to introducing a few lines of code that update the stop market order price of a bought stock whenever the price goes up (or at least, the program doesn't have any errors when I leave these lines of code that provide the trailing mechanism out). It doesn't immediately give an error, only the next time the OnData tries to access the Data.keys() object for the symbol that has just received a StopMarketOrder update! I suspect something is going wrong with inserting the tickets of the StopMarketOrders into a dictionary, which I use to update the limit price later on as well. I can't seem to figure out what exactly is going wrong here, would anyone have any idea how to solve this dynamic accessing issue? I have commented the code in line 170 because I couldn't upload the erroneous backtest.
NewPrice = self.CurrentPrice[symbol] * (1 - self.StopPercentage)
response = self.StopLossOrder[symbol].UpdateLimitPrice(NewPrice, symbol)
Thank you in advance!
Derek Melchin
Hi Lars,
The error is related to the custom brokerage model. There seems to be a problem with the Python wrapper. If we remove the calls to SetBrokerageModel, the error goes away.
To track our progress of addressing this issue, subscribe to the following GitHub Issue:
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Lars Snoeijink
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!