mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.93k stars 855 forks source link

Tearsheet disappers after executing in Terminal #215

Closed nyk96 closed 8 months ago

nyk96 commented 7 years ago

I have successfully installed qstrader by following the instructions from the Readme. But unfortunately, whenever I try to execute 'python buy_and_hold_backtest.py' The file executes, I can see the Tearsheet but it disappears within a second and I don't know where it gets saved. Hence, if anyone can help me out regarding the same, it would be great. Thanks

dieterjansen commented 7 years ago

Hi nyk96,

In the commit on 2017-04-13 a change was made to the qstrader/statistics/tearsheet.py modele which changed:

plt.show()

to:

plt.show(block=False)

This has the effect of showing the tearsheet briefly but immediately closing the plot window. This is a useful behaviour if you are running multiple backtests from a script such as when you want to optimize parameters.

To get the plot.show() function to block instead so you can see the tearsheet just change /home/user/venv/qstraderp3/lib/python3.5/site-packages/qstrader/statistics/tearsheet.py around line 637 back to “plt.show()” or “plt.show(block=True)”. When you exit the plot viewer, the blocked backtest will continue and complete.

The path above is where the tearship.py module is installed by convention on a Linux/virtualenv install. With a Windows/Anaconda or OS.X/Anaconda there will be a slightly different path but you can probably work out where the tearsheet.py file is with a search.

I expect there will eventually be a better way to override this behaviour but its a little beyond my skills to make the required changes.

Cheers, Dieter.

From: nyk96 Sent: Monday, July 3, 2017 3:53 AM To: mhallsmoore/qstrader Cc: Subscribed Subject: [mhallsmoore/qstrader] Tearsheet disappers after executing in Terminal (#215)

I have successfully installed qstrader by following the instructions from the Readme. But unfortunately, whenever I try to execute 'python buy_and_hold_backtest.py' The file executes, I can see the Tearsheet but it disappears within a second and I don't know where it gets saved. Hence, if anyone can help me out regarding the same, it would be great. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Kroid commented 7 years ago

How about to auto-save result figure (tearsheet) to png/jpg file in out directory?