2
$\begingroup$

Is it possible to download stock-data countrywise with quantmod package for R ?

Hi, I'm wondering if it's possible to download equities countrywise.

Let's say i want all data from the Finnish market.

All Finnish stock symbols ends with .HE, so what I want is

getSymbols("all stocks that ends with .HE", ...)

Thanks !

$\endgroup$
2
$\begingroup$

I don't have perfect solution for above problem, I but can help you out with the alternative. As far as my information you can't download the data country wise. I was also looking for the same. You should have all the symbols first in place. I have prepared a small code which loop through the all available symbols and get historical data from Yahoo.

library(quantmod)
startDate = "2000-01-01"
thePath = " * "
source(paste(thePath,"code\\listOfInstruments.r",sep=""))

for (ii in theInstruments){
  print(ii)
  data = getSymbols(Symbols = ii, 
                    src = "yahoo", 
                    from = startDate, 
                    auto.assign = FALSE)
  colnames(data) = c("open","high","low","close","volume","adj.")
  write.zoo(data,paste(thePath,ii,".csv",sep=""),sep=",",row.names=FALSE)
}

Regarding symbols that you can easily download from exchange and save it, It's a one time job. Rest you can use the above code to get the data life long. I have created database using above code only.

$\endgroup$
0
$\begingroup$

A way is to loop through a list of symbols.

lisym <- c("ELI1V.HE", "KRA1V.HE")
getSymbols(lisym)
ELI1V <- get("ELI1V.HE")
barChart(ELI1V)

or prepare the symbol names in csv file n loop thru it.

lisym <- readLines("stocks.csv")

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.