Skip to content

Instantly share code, notes, and snippets.

@xoba
Created January 3, 2012 23:26
Show Gist options
  • Save xoba/1557537 to your computer and use it in GitHub Desktop.
Save xoba/1557537 to your computer and use it in GitHub Desktop.
loading yahoo finance data directly into R
yahoo <- function(s) read.csv(file=paste('http://ichart.finance.yahoo.com/table.csv?s=',s,'&c=1900&f=2012&g=d',sep=''));
ticker = 'AAPL'
dat = yahoo(ticker);
plot(main=ticker, xlab='date', ylab='close price',
as.Date(dat$Date),dat$Adj.Close,type='l',log='y');
grid();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment