How to decide the balance of the pie percentage?

It looks like numpy and maybe some of the other modules were not installed correctly.

Try doing them one at a time by copy pasting the following into your console:

pip install numpy
pip install matplotlib
pip install pandas_datareader

I noticed these two errors:

ERROR: pandas 0.24.2 has requirement numpy>=1.12.0, but you’ll have numpy 1.8.0rc1 which is incompatible.
ERROR: pandas 0.24.2 has requirement python-dateutil>=2.5.0, but you’ll have python-dateutil 1.5 which is incompatible.

Will try again


Got it working using Terminal. macOS comes with Python 2.7 by default. Found this article which told how to set Python 3 as default for macOS.

1 Like

Leaving this over here for anyone interested: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

Python virtual environments allows you to install dependencies on a per-project basis. That way you don’t mess up with global packages in your system.

btw @nickspacemonkey, I created a PR for fixing hard-coded values in your code if you want to take a look at it. https://github.com/nickspacemonkey/efficient_frontier/pull/1

2 Likes

That’s great! Much more talent than me lol. I hope people find it useful and improve upon it further!

@nickspacemonkey

How often do you recommend running this and adjusting the portfolio?

Also just looking at the wiki:

It is important that the data is available for all of the securities chosen. If there is no historic data for a stock after a certain period, there will be serious errors in the calculation.

Some of my stocks only go back a year. For example Fastly has data back to June 2019. Will this cause serious errors?

Rebalancing can be done as often as you like, monthly, quarterly, etc
 There’s no specific rule, although I would say anything more than monthly would be far too frequent. Even monthly seems like alot of activity to me.

I don’t rebalance by selling to buy the underweight securities though. My deposits go towards the underweighted holdings.

The problem with the lack of data is that it drastically reduces the statistical significance of the results. You are comparing 1 years worth of data with maybe 10 years on a different security. The program doesn’t take this into account and will weight it with the same statistical significance, thus your overall weightings will be less reliable. However if all you want to do is take the total average return of a stock, it works fine.

1 Like