I see Debug(...) is a method of the QCAlorithm() class. And it looks like messages passed to Debug() are simply added to an ivar, _debugMessages, which is a list of strings.
I'm trying to output debugging and log messages from other classes, for example from a custom class derived from BaseData. How would you recommend outputting to QuantConnect's console or logs from a class derived from BaseData? Can messages be passed to a global variable for the algorithm?
Michael Handschuh
public static QCAlgorithm Instance;
Then in your Initialize() method:Instance = this;
Then you could use it from within your custom class by the following (assuming your algorithm's name is 'MyAlgorithm':MyAlgorithm.Instance.Log(...)
Jared Broad
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.
Mike Ellertson
Mike Ellertson
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!