robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.38k stars 940 forks source link

capm_returns function should not amend the prices dataframe #353

Closed samatix closed 2 years ago

samatix commented 3 years ago

The capm_returns function should not amend the prices dataframe when the returns_data is True.

Currently, if returns_data is True, the returns dataframe is equal to the prices dataframe. A new column is added for the market returns as "mkt" which impacts as well the prices dataframe.

This behavior is not expected and the prices dataframe should be copied before.

robertmartin8 commented 3 years ago

Good spot, will push this with the next patch