Back to Community
Research / notebook / tear sheet errors, ZeroDivisionError and NoSuchSymbols

I have been struggling to get consistent results when using the tear sheets, I often get one of these two errors and I haven't been able to isolate the situations that cause the errors to occur, anyone have any insight?

Loading notebook preview...
Notebook previews are currently unavailable.
8 responses

Dustin,

Does your algorithm hold any positions overnight? If not, try adding some code to buy 1 share of a random stock, and hold it during the entire backtest. Then try running the tear sheet.

No, both of the algorithms I have issues with are flat at the end of the day, that's a very interesting idea, I should have some time later this morning to add a little bit of code and try it again.

Thanks for the suggestion Frank, I added some code to simply buy and hold one share of a random penny stock and that did seem to fix the NoSuchSymbol error. However, when I run the tear sheet with bt.create_full_tear_sheet(round_trips=True) so I can analyze the trades a bit further it still logs a ZeroDivisionError on some backtests and not on others, any idea on that?

Dustin,

I think there should be a fix for that issue soon enough. See the following thread:

https://www.quantopian.com/posts/new-feature-comprehensive-backtest-analysis-pyfolio#58924b60768ee6156d3d95e6

Hi Dustin, we just released an update to pyfolio that is a start for better compatibility with algorithms that trade intraday. Test it out if you get the chance. See my posts at the end of Frank's link if you want more detail.

If you still find yourself getting the ZeroDivisionError, could you post the error message here? You can pass estimate_intraday=False to return to the previous functionality for intraday strategies if that's causing problems.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Excellent, thanks guys, I will read the linked thread and try out the new version of pyfolio.

Just tried out the new pyfolio that has been deployed to research, all issues now seem to be fixed and all the round_trips data makes sense. Thanks for the help and the great work on pyfolio!

Just as fyi, if you don't hold anything overnight I still get NoSuchSymbols (at least for SPY as the intra day position). 1 stock held overnight seems to fix it.
Simple redacted notebook attached.

Loading notebook preview...
Notebook previews are currently unavailable.