Open eigenfoo opened 7 years ago
Proposal: we'll have a class called analysis
which will serve as a container for all floats/series/dataframes produced by a tear sheet. This class can be instantiated by any tear sheet: i.e. we'll optionally return a round_trips_analysis
object of we call create_round_trips_tear_sheet
and pass in return_analysis=True
.
@twiecki @gusgordon thoughts?
Yes, I like that solution @georgh0021. Would analysis also include plots - ie matplotlib plt
or ax
objects? If not, analysis
could also just be a dict that returns all the stats in the perf_stats
table - that solution is much simpler.
Returning the plots is partially redundant, because we have a return_fig
option on the tear sheets already. So I favor the dict solution, but I'm open.
@gusgordon I mainly just wanted a class so we could tab-complete on class attributes... 😃 But a dict would be easier to implement.
I agree about not needing to include plt
and ax
objects in the dict, however, I think we need to be more ambitious that just returning perf_stats
: I'd like it so that if I called create_round_trips_tear_sheet
, I'd get the round_trips
dataframe, as well any other objects that are outputted, such as sector_round_trips
.
Yup, agree. That all makes sense.
On Jul 28, 2017, at 2:08 PM, George Ho notifications@github.com wrote:
@gusgordon I mainly just wanted a class so we could tab-complete on class attributes... 😃 But a dict would be easier to implement.
I agree about not needing to include plt and ax objects in the dict, however, I think we need to be more ambitious that just returning perf_stats: I'd like it so that if I called create_round_trips_tear_sheet, I'd get the round_trips dataframe, as well any other objects that are outputted, such as sector_round_trips.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Maybe return a named tuple.
The more general way to solve this would be to convert pyfolio to an OO-style. Then one could do algorithm.create_full_tear_sheet()
, algorithm.perf_stats
, etc
Currently, pyfolio takes inputs, feeds them into the
compute
functions, plots the output, and then (usually) throws away the results of thecompute
functions. This is undesirable, both for Q internal use and open-source use.Ideally, we would like
create_x_tear_sheet
to return an object that contains all the results of pyfolio analysis. E.g. around_trips_analysis
object/dict that I can query to find all numerical output or features. This will make pyfolio much more useful for algo analysis.