Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Alphalens Problem! create_pyfolio_input not working anymore?!

Hi Friends! I need help!

Yesterday alphalens.performance.create_pyfolio_input suddenly stopped working :(

I loved that you could simulate a backtest directly in research and use pyfolio on it and thereby not having to go into the IDE. This was just awsome and I would really want this to work again!

Seems to be some bad return values in the factor_cumulative_returns() within create_pyfolio_input()
"TypeError: cumulative_returns() takes 1 positional argument but 2 were given"

Does anyone have a workaround?

Thankfull for any help!

Regards

3 responses

The issue was reported in Github. Hopefully, it will be resolved soon.

https://github.com/quantopian/alphalens/issues/374

Hi, does anyone know if this issue was resolved already and how? I'm having the same error.

Seems like it is not fixed. But I've found some work-arounds that is okey to me. The empyrical package has all the metrics from pyfolio, like Sharpe-, Sortino-, Calmar-Ratios. So you could use those on the returns that Alphalens provides (al.performance.factor_returns()). But you wont get "Specific/Total/Common-returns".

If that is what you want, you could use "Analyze Alpha via Thomas Wiecki's Notebook", which plots the returns and then if you want the actual returns number for the period, you find specific/total/common-returns in "factor_stats"
So if you want the total return as a number for instance, type this one:

ep.cum_returns_final(factor_stats['perf_attribution'].loc[:,'total_returns'])

after all plots have been run. (import empyrical as ep).