Skip to content

Help with iBrokers data

3 messages · G See, wlblount

#
about 30 days ago i posted here looking for historical, intraday data.  since
then i have figured out how to use the ibrokers package to download approx 4
days of 3 minute data (650 bars x 8 variables = 5200 which is the ibrokers
limit for 1 request).

library(IBrokers)

tws <- twsConnect()

symbol <- "uvxy"

contract<- twsEquity(symbol)

pricedata<-reqHistoricalData(tws,contract,barSize="3 mins", duration = "1
W")

save(pricedata,file=symbol)

twsDisconnect(tws)


my next step is to figure out how to 1- loop this request to get older  data
(i would like to get 2 years) and append the saved file.  and 2 -eventually
move up to periodically updating 50 or so symbols and saving and appending
all the symbol data to individual files.


does anyone have any code or could anyone point me in the right direction? 
my coding skills are only slightly above control c and control v .  any help
would be greatly appreciated and i will be happy to share data, code, or
whatever i end up with.  thanks.  Bill




--
View this message in context: http://r.789695.n4.nabble.com/Help-with-iBrokers-data-tp4663719.html
Sent from the Rmetrics mailing list archive at Nabble.com.
#
For the first part, see ?reqHistory.  You can't get 2 years of data
though, IB only provides 1 year.

For the second part, maybe reqTBBOhistory from my twsInstrument
package is useful (https://r-forge.r-project.org/R/?group_id=1113).
See also the unexported wrapper twsInstrument:::update.data()

Garrett
On Mon, Apr 8, 2013 at 8:12 PM, wlblount <bill at easterngrain.com> wrote:
#
control v not working for me today...

running this for the default 1 minute, 1 year works


tws <- twsConnect()
symbol<-"UVXY"
contract <- twsEquity(symbol)


Sys.sleep(10) # mandatory 10s between request to avoid IB pacing violation
pricedata<-reqHistory(tws, Contract=contract)
save(pricedata,file=symbol)


changing the reqHistory arguments to 3 min. and 1 month of data causes an
error....
gets this error...

Error in reqHistoricalData(conn, Contract, barSize = barSize, duration =
duration,  : 
  formal argument "duration" matched by multiple actual arguments



--
View this message in context: http://r.789695.n4.nabble.com/Help-with-iBrokers-data-tp4663719p4663744.html
Sent from the Rmetrics mailing list archive at Nabble.com.