[R-SIG-Finance] Handling reqRealTimeBars of IBrokers api when connection is lost

maheshbp maheshbp2006 at gmail.com
Tue Sep 13 11:57:41 CEST 2011


Hello All,

I am using reqRealtimeBars with an eWrapper to create 30 min OHLC bars.
ibwrapper<-eWrapper(NULL)
ibwrapper$realtimeBars <-ibrealtimebars
reqRealTimeBars(tws, contractlist,event=ibwrapper)//contract list is a list
of contracts.
> ibrealtimebars
function(curMsg, msg, timestamp, file,...){
id <- as.numeric(msg[2])
xtstest<-.xts(matrix(rep(NA_real_,4), nc = 4),0)
attr(xtstest, "index") <- as.numeric(msg[3])
xtstest[1, 1:4] <- as.numeric(msg[4:7])
ibRdata[[id]]<<-rbind(ibRdata[[id]],xtstest)
}

ibRdata will contain collected real time data (5 sec OHLC) and then rolled
into 30 min OHLC using to.minutes30 function from xts.

My concern is how to handle a situation when connection to IB is lost and
regained after a couple of secs or mins. IB doesn't to push all messages
(back log) since the time the connection was lost. 
Attempts to start 'reqHistoricalData' & 'reqRealTimeBars' at the same time
in order to ensure that ibRdata will be filled with data lost during the 'no
connection' time, results in 'Historical data request pacing violation'  on
both the functions.

Any suggestions on how to back fill real time data in situations when
connection is lost and regained ?

Thanks,
Mahesh

--
View this message in context: http://r.789695.n4.nabble.com/Handling-reqRealTimeBars-of-IBrokers-api-when-connection-is-lost-tp3809630p3809630.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list