Back

Getting stack traces ?

Hey all,

I am trying to diagnose where in my code I am causing a null ptr dereference, (error message is "2014-12-27T17:27:22-05:00 Backtest Error: Error initializing algorithm for backtest check: Object reference not set to an instance of an object"). Is there a way to get a stack trace, or some more information where exactly the problem occurred? By now, I have outcommented pretty much everything, so it is a bit puzzling that the exception is still thrown.

Cheers,
Thomas
Update Backtest








Not currently in the plan, but its an interesting idea and not hard to add. I will take a peak at the run-time error handlers this evening :) It may take a few days longer to add to the IDE.
0

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.


Hey there,

another (related) question: It seems to me that I don't see Debug() output if an exception is thrown during the execution, only if the execution went through smoothly. Is that intended? Am I doing something wrong?

Not having output when something goes wrong makes debugging harder ;)

Cheers,
Thomas
0

Great catch I didn't think about that. Please try with Error("") method in a try-catch handler - it will highlight red in the console, and it also should return even if there is a runtime error. We will put in better handling for returning Debug messages as well on a crash.
0

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.


Hey there,

While we're on the topic, it seems that Error() and Debug() are currently member functions of the QCAlgorithm class. I think it would be really helpful if these functions were made static, so it is more convenient to call them from other classes that may be instantiated by a QCAlgorithm - handing around the this ptr is a but clumsy :-)

Cheers,
Thomas
0

Hey there,

also, Log() doesn't actually seem to produce output in my logs. I haven't used any Log() before today, and immediately only get the message

You currently have a maximum of 100kb of log data per backtest, and 100kb total max per day.Please upgrade your account, or contact us to request more allocation here: https://www.quantconnect.com/contact

Cheers,
Thomas
0

Hey! Thank you - great suggestion again. I can't adjust Debug really since its so popular, but Console.Write is an override we made and I've re-jigged it so now it will be static and public so you can access anywhere :) I also added "Console.Error" to call the QCAlgorithm Error handler behind the scenes for you.

We're imagining the new node now, it will take several hours but we should able to deploy a brand new cloud tonight with lots of improvements :)
0

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.


Hey Thomas - just an update - we've deployed the stack traces, they appear as a link next to the runtime errors in console. They will be more helpful when the project is open sourced and you can understand the underlying engine calls as well.
0

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.


Update Backtest





0

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.


Loading...

This discussion is closed