Loading stock information of Japan using quantmod package in R [closed]

随声附和 提交于 2019-12-08 12:00:27

问题


I encounter one problem of using R/quantmod package. I can get the stock information for Korea, but I failed in getting the information for Japan:

getSymbols("DEXKOUS",src="FRED") #load Korea
[1] "DEXKOUS"
getSymbols("DEXJPUS",src="FRED") #load Japan   
Error as.POSIXlt.character(x, tz, ...) : 
  character string is not in a standard unambiguous format

Your comments are welcome.


sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C                                                   
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] PerformanceAnalytics_1.0.3.2 quantmod_0.3-17              TTR_0.21-0                  
 [4] xts_0.8-2                    zoo_1.7-4                    Defaults_1.1-1              
 [7] Rweibo_0.0-5                 rjson_0.2.5                  digest_0.5.1                
 [10] RCurl_1.6-6.1                bitops_1.0-4.1              

loaded via a namespace (and not attached):
[1] grid_2.13.1     lattice_0.19-30 tools_2.13.1  

回答1:


The example you give in your question works fine for me too. I get a time series of the yen-dollar rate from 1971 onwards.

However, if you are looking for share price data rather than forex (you did say stock information?) then perhaps you should try the RFinanceYJ package, which extracts share price data from Yahoo! Japan.

require(RFinanceYJ)
sony <- quoteStockXtsData('6758.t', '2011-01-01')
tail(sony,30)


来源:https://stackoverflow.com/questions/8867001/loading-stock-information-of-japan-using-quantmod-package-in-r

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