Open eranhirs opened 6 years ago
Work in progress using pyfolio.create_full_tear_sheet
.
Problems run into & fixed:
pyfolio 0.7.0
is the latest working version.transactions
requires reformatting, fixed using extract_transactions
.transactions
requires a symbol
column, fixed with code below.benchmark_rets
is required, otherwise it tries fetching from Yahoo Finance the data, fixed.create_full_tear_sheet
only works with daily returns
, fixed with code below.Todo:
positions
requires a different format, for now I removed positions
from the call.APPROX_BDAYS_PER_MONTH = 21
is incorrect for crypto.Here is the code so far:
transaction_df = extract_transactions(perf)
transaction_df['symbol'] = transaction_df['sid'].apply(lambda x: x.base_currency)
returns_daily = perf.returns.resample("D", how="ohlc")['close']
benchmark_returns_daily = perf.benchmark_period_return.resample("D", how="ohlc")['close']
pyfolio.create_full_tear_sheet(returns_daily, transactions=transaction_df, benchmark_rets=benchmark_returns_daily)
Does this help? https://forum.catalystcrypto.io/t/a-shot-at-pyfolio/89
Thanks @sam31415 this helps! Managed to use gen_round_trip_stats
which is great 👍
In any case, it is still using pyfolio 0.7.0
, ideally would like to upgrade to pyfolio 0.9.0
like described in the issue.
Dear Catalyst Maintainers,
Description of Issue
Trying to use pyfolio with catalyst. Specifically, the Full tear sheet report like in this example: https://quantopian.github.io/pyfolio/notebooks/zipline_algo_example/
As documented here: https://github.com/enigmampc/catalyst/issues/73 You have to use
pip install empyrical==0.2.2
otherwise I get the errorImportError: cannot import name information_ratio
So I did and it solved that specific error.
What happened instead?
Now I get the error
{AttributeError}module 'empyrical.utils' has no attribute 'default_returns_func'
Reproduction Steps
pip install pyfolio
pip install empyrical==0.2.2
perf
from catalystdef analyze
, runimport pyfolio
and thenpyfolio.create_full_tear_sheet(perf.returns, positions=perf.positions, transactions=perf.transactions)
What steps have you taken to resolve this already?
In this issue https://github.com/quantopian/zipline/issues/1855 It seems they solved this problem, which doesn't require downgrading
empyrical
.Here is another user having the same problem as I do: https://github.com/quantopian/empyrical/issues/91
Anything else?
Catalyst should have documentation on adding pyfolio as it really seems as a great tool for visualizing the results.