Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A potential bug in portfolio optimization? #2

Open
johnsonice opened this issue Mar 16, 2021 · 0 comments
Open

A potential bug in portfolio optimization? #2

johnsonice opened this issue Mar 16, 2021 · 0 comments

Comments

@johnsonice
Copy link

johnsonice commented Mar 16, 2021

in your fundamental_portfolio.ipynb, under "4. Potfolio Optimization using pypfopt", you have this two lines
p1_return_table_pivot=p1_return_table.pivot_table(index = 'datadate',columns = 'tic', values = 'daily_return')
S = risk_models.sample_cov(p1_return_table_pivot)
I think you should use
S = risk_models.sample_cov(p1_return_table_pivot,returns_data=True)

I am reading the documentation, sample_cov assumes the first argument to be price data rather than returns. you will have to specify returns_data=True in this case, since you're using return data directly? (let me know if I got it wrong)
https://pyportfolioopt.readthedocs.io/en/latest/RiskModels.html?highlight=sample_cov#pypfopt.risk_models.sample_cov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant