I am trying to retrieve the volume from yahoo by creating a function (that I can later apply to a list of stocks).
RetrieveVolume <- function(x){
volume_Ind2 <- getQuote(x, src = "yahoo", "v")
volume_Ind2 <- as.data.frame(volume_Ind2)
volume_Ind2$Qposix <- NULL
volume_Ind2 <- volume$sq...3.NCOL.sq..
}
When I try using the formula for 0001.HK for example,
RetrieveVolume("0001.HK")
I get the following:
Error in RetrieveVolume("0001.HK") : object 'volume' not found
Do you have any idea what I am doing wrong please?
There are 2 problems here:
volume
which is not defined yet.a quick solution to the problem will be
or a simpler solution would be