How to get factor_loadings and factor_returns from a <
qexec.research.backtest.BacktestResult
> Object?
Also how to get specific_returns or common_returns series?
How to get factor_loadings and factor_returns from a <
qexec.research.backtest.BacktestResult
> Object?
Also how to get specific_returns or common_returns series?
Hi Munidar, I came across the same requirement and stumbled upon your question while Googling for an answer. To get all attributes of a BacktestResult object, use the following code:
bt = get_backtest('your_backtest_id')
dir(bt)
You will get the following list (as of writing):
['algo_id',
'attributed_factor_returns',
'attrs',
'benchmark_security',
'capital_base',
'create_bayesian_tear_sheet',
'create_full_tear_sheet',
'create_interesting_times_tear_sheet',
'create_perf_attrib_tear_sheet',
'create_position_tear_sheet',
'create_returns_tear_sheet',
'create_simple_tear_sheet',
'create_txn_tear_sheet',
'cumulative_performance',
'daily_performance',
'end_date',
'factor_exposures',
'frames',
'from_stream',
'launch_date',
'orders',
'positions',
'preview',
'pyfolio_positions',
'pyfolio_transactions',
'recorded_vars',
'risk',
'scalars',
'start_date',
'stoppages',
'transactions']
To me, the most interesting at the moment is bt.daily_performance as I wish to find out the cause of a particular jump in profitability. To answer your questions:
bt.attributed_factor_returns.