Optimize a portfolio given historical stock data.