Hi All,
Ive spent the last two years of my QC coding time on Python, but wanted to take a dip into C#. The first thing I did was to take the base template algo and add a child class in so that I can store each of my active stocks inside a seperate instance (for trading multiple stocks at a time seperately). before even adding anything to the class, It hates it, and errors out. I have spent hours looking at this trying to read C# help but I cant crack why its doing it. It seems to say im creating multiple classes under QCAlgo but this is clearly named as a child of the FocusedGreen Buffalo so I dont know.
Please Help :)
Alexandre Catarino
Hi MatteMatto ,
The Lean engine only accepts one instance of QCAlgorithm, since the algorithm manager only manages one.
It looks for the algorithm class (inherited from QCAlgorithm) in the main.py file for Python algorithms. For C# algorithms, it's "fancier", and it uses reflection to find a class that inherits from QCAlgorithm. If you have a class that inherits from a class that inherits from QCAlgorithm - the “grandchild” of QCAlgorithm, it will find multiple instances of QCAlgorithm.
Best regards,
Alex
MatteMatto
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!