I am trying to use R package IBrokers
to get data on different symbols. When I initially did my tests the following line worked as expected
reqHistoricalData(tws, Contract=contract, barSize='1 min', duration='60 S')
But I found out it only works when the market is closed. I need realtime data.
On the other hand the following line
reqRealTimeBars(tws, contract, barSize='5')
Provides 5 second bar values, but it streams continually and I need to query multiple instruments. I could run multiple instances of the R script but it doesn't sound right.
Does anyone have any tip on how to access the values of the last realtime 1 minute bar?
Thanks