Search code examples
rquantmod

I got an error while importing dividend from R


I'm trying to import dividend from R. Some of stocks have errors, and I have no idea what they mean about.

Here are codes I use:

library(quantmod)


mdate <- "2016-01-04"
edate <- "2016-09-03"

Tick <- c("FAM","FCT","FEI","MAIN","WSR","ERF","ETB","ETG","ETJ","ETV","ETW",
          "ETX","ETY","EVG","EVN","EVT","EXG","KIO","MNE","MNP","MPA","MQT",
          "MQY","MTR","MTT","MUA","MUB","MUC","MUE","MUH","MUI","MUJ","MUNI",
          "MUS","MVF","MVT","MYC","MYD","MYF","MYI","MYJ")
  

Dividend_160104 <-
  lapply(Tick,
         function(x) {
           try(getDividends(x, from= mdate, to= edate, src="yahoo"),
               silent = TRUE)
         })
names(Dividend_160104) <- Tick

enter image description here

With the symbols, from 19th which is "MNE", errors show up; "Error in open.connection(file, "rt") If I run with just a few symbols, there is no error, but I have more than three thousands symbols. A few days ago I formatted my hard drive and reinstalled R in my portable hard drive. Is it because of this? Anybody know why it happens?


Solution

  • This partly has to do with tickers that are not valid for yahoo. MNE is not a valid ticker and will give an error. As this issue impacts on how dividends are retrieved, an error here will fail the following tickers as well.

    For more info see github issue 314. At the time of writing, this issue is being handled by the developer.