Simple function of quantmod not working anymore

孤人 提交于 2019-12-04 18:17:17

问题


I am turning in my thesis tomorow and I'm getting a very bizzare error message with quantmod which I never had during the last weeks while working with this package. I can't manage to import data specificly of Dow Jones index (^DJI). I get the following error message:

getSymbols("^DJI",src="yahoo", from='2005-6-01', to='2012-6-21')

Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  : 
impossible to open the URL 'http://chart.yahoo.com/table.csv?s=^DJI&a=5&b=01&c=2005&d=5&e=21&f=2012&g=d&q=q&y=0&z=^DJI&x=.csv'
Also : Message d'avis :
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
impossible to open : the status HTTP was '404 Not Found'

I almost feel embarased to ask such a simple question. I really don't understand where the problem is.. these for example work just fine

getSymbols("AAPL",src="yahoo", from='2005-6-01', to='2012-6-21')
getSymbols("^NDX",src="yahoo", from='2005-6-01', to='2012-6-21')

So where is the problem? thank you very much for your help I really appreciate it !


回答1:


For some reason, yahoo does not currently provide that data. You can see on the yahoo website that it currently says "Historical quote data is unavailable for the specified date range."

I do not know ifthis is temporary or permanent, but I would guess that it is temparary because as you noted, "^NDX" still works. Since today is a holiday in the United States, it is possible that Yahoo is doing maintenance.

If it becomes available before it is too late for you, I would suggest saving the data either with save or with FinancialInstrument:::saveSymbols.common so that you could load it back using getSymbols(*, src='FI')

If it's not up by the time you need it, you have a couple alternatives that may or may not suit your needs. You could use getSymbols.FRED to get the closing values of the index since 1886

getSymbols("DJIA", src='FRED')

Or, you could use the DIA ETF which is actually tradeable and is a decent proxy for the index

getSymbols("DIA", src='yahoo')


来源:https://stackoverflow.com/questions/11337249/simple-function-of-quantmod-not-working-anymore

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!