quantopian / pyfolio

Portfolio and risk analytics in Python
https://quantopian.github.io/pyfolio
Apache License 2.0
5.61k stars 1.76k forks source link

No factor_returns passed to create_returns_tear_sheet() #513

Open kakavegeta opened 6 years ago

kakavegeta commented 6 years ago

Since I want to save the figures, so I directly call the function create_returns_tear_sheet() and try to save the results, but I found that there is no kwargs to pass in factor_returns, so that the plot function plot_rolling_fama_french() receives no factor_returns. As a result, in my resulting figure, there is no information under title "Rolling Fama-French single factor betas". Therefore I wonder is I missing something?

luca-s commented 6 years ago

plotting.plot_rolling_fama_french eventually calls timeseries.rolling_regression, which loads Fama-French data.

factor_returns : pd.DataFrame, optional
    Data set containing the risk factors. If none, will load Fama-French.
    See utils.load_portfolio_risk_factors.

Probably when you ran your code the data couldn't be loaded (network issue? Fama-French data not available on the server? I don't know.)

kakavegeta commented 6 years ago

@luca-s Thank you so much! And I know where I am missing. Since I use Chinese market data so I cannot match Fama-French data. So I just directly call plotting.plot_rolling_fama_french() and pass localized fama-french data. But I think the create_returns_tear_sheet() should allow to pass factor_returns. Thanks for your immediate reply ! (^_^)