在 R 中使用 Quantmod 包加载日本股票信息

发布于 2024-12-27 07:32:33 字数 1331 浏览 1 评论 0原文

我在使用 R/quantmod 包时遇到一个问题。我可以获取韩国的股票信息,但无法获取日本的信息:

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

欢迎您的评论。


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  

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  

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉栀 2025-01-03 07:32:33

你在问题中给出的例子也适合我。我得到了 1971 年以来日元兑美元汇率的时间序列。

然而,如果您正在寻找股价数据而不是外汇(您确实提到了股票信息?)那么也许您应该尝试 RFinanceYJ 软件包,它可以从 Yahoo! 中提取股价数据。日本。

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

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文