Back

Using Jupyter Research to troubleshoot my algos

Due to some of the limitations of the IDE with regard to debugging / object exposure, etc. I thought I would test out the Jupyter-based Resarch tool. It's my first exposure to Jupyter, but I love it.

The documentation seems to suggest one should work with a QCAlgorithm wrapper called QuantBook. That's fine for smaller tests. But is there a reason we can't simply import the needed libraries and create our own Class of type QCAlgorithm? 

I would much prefer to do that, since I then will have less work porting the debugged code into my real apps. 

I've done that and it seems to work fine,.. But I ran into a wierdness with the history object that only seems to affect my Reseach algos, but not my IDE ones?

For some reason, the instantiated class does not have a History object, or the History object behaves differently. Could sure use some help. Thanks!

Update Backtest








I've got the bad habit of answring a lot of my own questions. Makes me feel kinda lonely, sometimes. :) Oh well. Maybe some of these comments will be useful to others.

I've found the namespace for QuantConnect.Jupyter at this link.

https://github.com/QuantConnect/Lean/blob/master/Jupyter/QuantBook.cs

From this I see that the QuantBook object only has a few permutations of the History object and fewer that what is available in the IDE.  For example, the following command , given in one of the demos, will not work using the QuantBook object:

        
        # History request using list of tickers
        hist = self.History(self.stocks, 1000, Resolution.Minute)
        

What is still not clear to me is why I cannot create my own python classes in Jupyter and use those to run my code. Don't the import and AddExtension functions import all needed libraries so you could instantiate your own QCAlgortihm instance and run it will all of its properies? I'm new to python and to Jupyter, so I'm confused by this. 

I really really hope someone here will show me that it can be done after all. 

For now, I guess I'm stuck with just using Research and Jupyter to test code snippets, but to rely on the log files of the IDE to debug my actual apps.

1

I came to the same conclusion "using Research and Jupyter to test code snippets, but to rely on the log files of the IDE to debug my actual apps". Even the code snippets are problematic because some methods are supported in one environment and not the other. You noted that the 'History' method in the research environment won't take a list of symbols as an input yet in an alorithm this works fine. I noticed that same behavior.

If it makes a difference, I find your comments (to your own post) helpful... though I can't help with the lonely thing :)

0

Serge - Great to see you working on this. The limitations you listed above "Due to some of the limitations of the IDE with regard to debugging / object exposure, etc. " have made it challenging to gain confidence in my algorithms. Have you explored this further, or opted to use visual studio or another IDE and load LEAN locally? Would love to hear if you've made any progress on this front!

0

Its not officially supported. As Serge was building in unknown unsupported territory it caused strange errors in the algorithm initialization. 

The only real way forward here is for us to add Debugging. Its on our agenda and we're doing our best to get there ASAP.

Bugs before features... 

https://github.com/QuantConnect/Lean/issues?q=is%3Aopen+is%3Aissue+label%3Abug
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.


Understood and have been there with products I've worked on. Thanks for the response.

0

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