Construct a stock portfolio using R

The R code below downloads adjusted closing stock prices from Yahoo finance angenerates an efficient frontier based on the correlation and returns from those data. A video describing the output from an earlier version of this program is available at http://youtu.be/O33dF532pRo # R script to read prices from Yahoo and construct a portfolio # updated … Continue reading

R code to compute beta and the Sharpe ratio for a publicly traded stock

The following R code will calculate beta and the Sharpe ratio using adjusted closing prices from Yahoo finance. A video describing the output using an earlier version of this routine is available at http://www.youtube.com/watch?v=U8rNmkFRT1M # calculate beta and the Sharpe ratio suppressPackageStartupMessages(require(quantmod)) BRCM.Quote <- getSymbols.yahoo(“BRCM”, from=”1950-01-01″, verbose=FALSE, auto.assign=FALSE) SPX.Quote <- getSymbols.yahoo(“^GSPC”, from=”1950-01-01″, verbose=FALSE, auto.assign=FALSE) Prices … Continue reading

Position Sizing using the Kelly Criterion

Position Sizing: The Kelly Criterion Position sizing is a key component of successful investing. Determining the sizing of positions can differentiate between a long term winning and a long term losing strategy. A classic formulation for position sizing is called the Kelly Criterion developed by John L Kelly at Bell Labs (http://en.wikipedia.org/wiki/Kelly_criterion).  Kelly’s formulation is … Continue reading