Diversification and portfolio selection are integral parts of a finance curriculum. In this article, a multifactor capital asset pricing model is fit for components of the Dow Jones Composite Index using data from Yahoo! Finance. Along with the capital asset pricing model’s Beta, other statistics that are common criteria for portfolio selection are calculated: historic standard deviation (total risk), total return, average daily return, and Sharpe and Treynor measures. Two new commands are introduced, fetchcomponents and fetchportfolio, that automate the entire process. A third new command, fetchyahoooptions, is provided to download and parse equity options data from Yahoo! Finance webpages and, optionally, to calculate the implied volatilities for the downloaded options.