https://devhubby.com/thread/how-to-optimize-portfolio-allocation-based-on