1

I'd like to download the full history of data from Yahoo Finance for several stocks, but I always only get data starting at 2007-01-03. For example:

> library(quantmod)
> e <- new.env() 
> getSymbols( "MSFT", src="yahoo", env=e)
[1] "MSFT"
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
  downloaded length 137552 != reported length 200
> e$MSFT[1,]
#            MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
# 2007-01-03     29.91     30.25     29.4      29.86    76935100      24.28526

I searched stackoverflow questions about the "downloaded length != reported length" warning and I found this question, but the solutions there do not solve the problem.

Community
  • 1
  • 1

1 Answers1

2

The problem is that the default for from is "2007-01-01" for getSymbols.yahoo (and many of the other getSymbols functions). If you want all the available history, set from = "1900-01-01".

R> getSymbols("MSFT", from="1900-01-01")
# [1] "MSFT"
R> MSFT[1,]
#            MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
# 1986-03-13  25.49952  29.24928 25.49952   27.99936  1031788800      0.068281
Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418