Hi there,
Unfortunately, I can't get any further here. I always fail with the same problem. It seems that the problem is that the Rebalance method is not present in the MyAlgorithm object. This could indicate that there is a typing error or that the method has not been defined correctly.
Error Message
During the algorithm initialization, the following exception has occurred: 'MyAlgorithm' object has no attribute 'Rebalance' at Initialize self.Schedule.On(self.DateRules.EveryDay() in main.py: line 39 'MyAlgorithm' object has no attribute 'Rebalance'
Can anybody help?
Thank you!
Mia Alissi
Based on the error message you provided, it seems like you're trying to call a method named 'Rebalance' that doesn't exist in your 'MyAlgorithm' class. This could be due to a typo in the method name or the method might not have been defined at all.
You should define a method named 'Rebalance' in your 'MyAlgorithm' class. Here is a simple example of how you might define it:
In this example, the 'Rebalance' method is called every day at midnight. You would replace the comment with the actual code you want to execute during the rebalance.
If you've already defined the 'Rebalance' method, make sure that it's spelled correctly and that it's properly indented to be part of the 'MyAlgorithm' class. Python is case-sensitive and uses indentation to determine the structure of the code, so a mistake in either of these areas could cause the method to not be recognized.
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.
Maik
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!