IBrokers - reqMktData is very slow when adding more tickers

I am trying to bind prices in R using the online brokers API for the latest price for a stock list (about 150). When I grab 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, as I start adding more entries to the ticker 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")

      

It gets excruciatingly slow.

I can't figure out why this is so slow based on exchange or company size as they are all large, highly liquid, blue chips.

Does anyone know why this is so slow?

Many thanks.

+3


source to share





All Articles