I'm working with the TWS API and it's not working for me. I got it close to doing what I want to do, but I am stuck trying to figure out how to use the lapply function correctly.
Here's what I got to work currently:
library("IBrokers")
tws <- twsConnect()
tickers <- c("AAPL","YHOO")
reqMktData(tws, lapply(tickers, twsSTK), tickGenerics="", snapshot=T)
twsDisconnect(tws)
I would like to make specifications to the twsSTK in the above. Without using lapply, a single
library("IBrokers")
tws <- twsConnect()
reqMktData(tws, twsSTK("AAPL", exch = "ISLAND", currency = "USD"), tickGenerics="", snapshot=T)
twsDisconnect(tws)
However, I am having trouble trying to adequately use lapply in this case.
Does anyone know how to deal with lapply here?
I read the documentation on lapply incorrectly. See attached for my solution.