2

I am trying to snap prices in R for the latest price for a list of stocks (around 150). When I snap them for 2 stocks, it's almost instantaneous:

  tickers<- c("YHOO","AAPL")
  library("IBrokers")
      t_start<-Sys.time()
  tws <- twsConnect()
  test<-reqMktData(tws, lapply(tickers, twsSTK), tickGenerics="", snapshot=T)
  twsDisconnect(tws)
      t_end<-Sys.time()
      t_end-t_start

However, when I start adding more records into the tickers vector, it starts getting incredibly slow. For example:

tickers<-c("YHOO","AAPL","COP","PEP","XOM","ORCL","SPG","EQR","CVX","JPM","AFL","GIS","VZ","KMB","WFC","ROST","MMC")

This becomes excruciatingly slow.

I cannot figure out why it's so slow based on exchange, or size of company, as these are all large cap, highly liquid, blue chip stocks.

Is anyone familiar with why this is so slow?

Thank you very much.

  • Hi, I'm experiencing the same problem. Try [here] (http://stackoverflow.com/questions/15096987/ibrokers-reqmktdata-how-to-add-timeout-to-the-callback-function/), it seems it's slighly faster but still not enough. I'm learning how to use it properly. – nopeva Dec 19 '14 at 08:14
  • Thanks AP13. That seems like it's just not going to work since the coding becomes more troublesome than the marginal benefit. I will liklely go with another product and read in from R. Thank you very much. – Trexion Kameha Dec 20 '14 at 00:50

0 Answers0