[R-SIG-Finance] quantmod and yahoo historical data download error - did yahoo changed the url?
Samo Pahor
samo.pahor at gmail.com
Thu Sep 18 11:32:53 CEST 2014
Daniel, thanks.
Not working for me if I use like this:
> getSymbols("SPY", verbose=TRUE, from="2014-09-17", to="2014-09-18")
downloading SPY .....
trying URL 'http://ichart.finance.yahoo.com/table.csv?s=SPY&a=8&b=17&c=2014&d=8&e=18&f=2014&g=d&q=q&y=0&z=SPY&x=.csv'
Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
cannot open URL
'http://ichart.finance.yahoo.com/table.csv?s=SPY&a=8&b=17&c=2014&d=8&e=18&f=2014&g=d&q=q&y=0&z=SPY&x=.csv'
In addition: Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
cannot open: HTTP status was '404 Not Found'
But magically works if I use:
> getSymbols("SPY", verbose=TRUE)
downloading SPY .....
trying URL 'http://ichart.finance.yahoo.com/table.csv?s=SPY&a=0&b=01&c=2007&d=8&e=18&f=2014&g=d&q=q&y=0&z=SPY&x=.csv'
Content type 'text/csv' length unknown
opened URL
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
....
downloaded 104 Kb
done.
[1] "SPY"
So it look something is wrong with from/to...
Or, that data is not actually available on Yahoo for the 17th... Since:
> getSymbols("SPY", verbose=TRUE)
downloading SPY .....
trying URL 'http://ichart.finance.yahoo.com/table.csv?s=SPY&a=0&b=01&c=2007&d=8&e=18&f=2014&g=d&q=q&y=0&z=SPY&x=.csv'
Content type 'text/csv' length unknown
opened URL
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
....
downloaded 104 Kb
done.
[1] "SPY"
> tail(SPY)
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2014-09-09 200.41 200.55 198.91 199.32 88509200 199.32
2014-09-10 199.43 200.20 198.77 200.07 67189500 200.07
2014-09-11 199.27 200.33 199.12 200.30 66774400 200.30
2014-09-12 200.10 200.12 198.56 199.13 117409300 199.13
2014-09-15 199.16 199.32 198.38 198.98 76350000 198.98
2014-09-16 198.61 200.84 198.50 200.48 116070400 200.48
Any ideas?
Best regards,
Samo
2014-09-18 4:55 GMT-04:00 Daniel Cegiełka <daniel.cegielka at gmail.com>:
> 2014-09-18 9:49 GMT+02:00 Samo Pahor <samo.pahor at gmail.com>:
>> Hi,
>>
>> I am facing issues with downloading historical data from yahoo using
>> quantmod this morning:
>> [1] "BAL"
>> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
>> cannot open URL
>> 'http://ichart.finance.yahoo.com/table.csv?s=BAL&a=8&b=17&c=2014&d=8&e=18&f=2014&g=d&q=q&y=0&z=BAL&x=.csv'
>> In addition: Warning message:
>> In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
>> cannot open: HTTP status was '404 Not Found'
>>
>> To me it looks like yahoo change urls (again?)
>
>> rm(BAL)
>> getSymbols("BAL")
> [1] "BAL"
>> tail(BAL)
> BAL.Open BAL.High BAL.Low BAL.Close BAL.Volume BAL.Adjusted
> 2014-09-09 43.50 44.23 43.50 44.03 12600 44.03
> 2014-09-10 43.95 45.24 43.95 45.07 30500 45.07
> 2014-09-11 44.67 45.84 44.67 45.69 43000 45.69
> 2014-09-12 45.45 46.04 45.40 45.61 29600 45.61
> 2014-09-15 44.76 44.76 44.00 44.17 13500 44.17
> 2014-09-16 43.99 44.13 43.83 44.04 8900 44.04
>
> looks ok.
>
> Best regards,
> Daniel
More information about the R-SIG-Finance
mailing list