If I am trying to backtest one of the example algos in the algorithm frame work page, I get below error.
Algorithm.Initialize() Error: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): Please ensure that one class inherits from QCAlgorithm. in AlgorithmPythonWrapper.cs:line 136 Please ensure that one class inherits from QCAlgorithm. Stack Trace: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): Please ensure that one class inherits from QCAlgorithm. in AlgorithmPythonWrapper.cs:line 136 Please ensure that one class inherits from QCAlgorithm. (Open Stacktrace)
What exactly am I missing?
Louis Szeto
Hi Reduktion
The examples are not complete algorithms but just examples of the AlphaModel class. It is a part of the whole algorithm. To use it, please do so by using .AddAlpha in .initialize method in a sub-class inherited from QCAlgorithm class in main.py:
Then the algorithm will do the EMA Crossing Strategy on the universe included (in here, SPY).
Best
Louis Szeto
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.
Reduktion
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!