Closed ggerber closed 2 years ago
@ggerber good point – I'll fix this in the next release (hopefully this week!)
The **kwargs and/or "log_returns" arguments are not applied to the "mean_historical_return" function (line 97 in expected_returns.py). This means that the "log_returns" argument is not passed through when "return_model" is called (line 67 in expected_returns.py)
The same issue applies to: ema_historical_return and capm_return
My mistake – will fix that soon
Describe the bug expected_returns.py defines a function "returns_from_prices" with args: prices and log_returns(=False).
risk_models.py defines a function "sample_cov" which internally calls "returns_from_prices" without the arg log_returns. Hence, "sample_cov" does not allow for the option to use logreturns.
Expected behavior sample_cov should include the argument log_returns(=True) which gets passed on to the internal call returns_from_prices(prices, log_returns). This will allow covariance matrices to be based on logreturns and not only raw returns
Code sample Add a minimal reproducible example (see here).
Operating system, python version, PyPortfolioOpt version e.g MacOS 10.146, python 3.7.3, PyPortfolioOpt 1.2.6
Additional context Add any other context about the problem here.