雅虎财经分红数据调用tidyquant包的tq_get函数时出错(部分交易品种没有分红数据)

问题描述 投票:0回答:0

我的代码:

pacman::p_load("tidyverse","tidyquant")
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
'%&%' <- function(a,b) paste(a,b)

Stocks<-c("MSFT","IWDA.AS")
D  <- tq_get(Stocks, get = "dividends", from = " 2010-01-01",complete_cases = TRUE)

错误:

Error in `dplyr::mutate()`:
ℹ In argument: `data.. = purrr::map(...)`.
Caused by error in `purrr::map()`:
ℹ In index: 2.
Caused by error in `dimnames<-.xts`:
! 'dimnames' applied to non-array
Run `rlang::last_trace()` to see where the error occurred.

问题是 IWDA.AS 没有股息数据,我猜这是一个错误。 (我实际上有一个更长的符号列表,其中有一些符号没有股息数据,不可能消除它们,这里我给出了一个简化的列表。)

相同的代码在 2 年前运行良好,所以我不知道发生了什么变化,是 tidyquant 还是 yahoo finance?

有快速解决方法吗?

('get =“splits”'发生同样的错误。)

r tidyverse yahoo-finance tidyquant
© www.soinside.com 2019 - 2024. All rights reserved.