Question

I have about 2000 or so stock tickers that I loaded into R using:

companyList <- read.csv("~/Downloads/companylist.csv")
#saved all 2000 symbols inside the variable "ticker"
ticker <- as.vector(as.character(companyList[1:2000, 'Symbol']))
StockData <- new.env()
data <- getSymbols(ticker, env = stockData)

I can't seem to figure out how to run calculations on each stocks data without doing manually.

Was it helpful?

Solution

You can use eapply:

 eapply(stockData, FUN=calcul)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top