Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added return_fig boolean parameter to create_full_tear_sheet() and create_simple_tear_sheet() #694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nikoulis
Copy link

Modified create_full_tear_sheet() and create_simple_tear_sheet() to optionally return matplotlib figures based on the return_fig boolean parameter, in analogy to other tear sheet functions, such as create_returns_tear_sheet(), create_position_tear_sheet() etc. Now these two tear sheet functions can be used outside of IPython (%matplotlib inline) environments to capture these tear sheets and display them, convert them to pdf files etc.

If return_fig==True, create_full_tear_sheet() now returns the following dictionary containing all the matplotlib figures that were created internally:

{
'returns': fig_returns,
'interesting_times': fig_interesting_times,
'position': fig_position,
'txn': fig_txn,
'round_trip': fig_round_trip,
'capacity': fig_capacity,
'perf_attrib': fig_perf_attrib
}

And if return_fig==True, create_simple_tear_sheet() returns the matplotlib figure already created internally.

@reisenmachtfreude
Copy link

reisenmachtfreude commented Sep 17, 2023

Thanks for your pr. I need this functionality as well.

Since I just want to programmatically store pyfolio results for later analysis I can go this way
jupyter nbconvert --to pdf backtrader_backtest_pyfolio.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants