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

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

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 !

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)
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.

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.