This question is rather more about IBroker R package and not so about programming.
I have found couple of entries around 'open orders' non of them is sufficient however.
The problem lies in reliability and its output structure. First I would like to have a reqOpenOrders
function that allows me to assign the output so I remove the while()
part.
reqOpenOrders <- function(twsconn) {
.reqAllOpenOrders(twsconn)
con <- twsconn[[1]]
eW <- eWrapper()
socketSelect(list(con), FALSE, NULL)
curMsg <- readBin(con, character(), 1L)
processMsg(curMsg, con, eW) }
Everytime I run the function I get different data structure(results)!
conn <- ibgConnect(); reqOpenOrders(conn)
So in order to catch the many outputs (every time you run the reqOpenOrders
) I wrote small loop.
x <- list()
for(i in 1:5){
x[[i]] <- reqOpenOrders(conn)
}
There are various variations of output here they are: (I cannot really associate the output and the meaning of all of them)
[[1]]
[1] "5" "22" "4" "46189223" "NZD" "CASH"
[7] "" "0" "?" "IDEALPRO" "CAD" "NZD.CAD"
[13] "SELL" "5000" "LMT"
or
[[2]]
[1] "3" "6" "4" "Submitted" "0" "5000" "0" "9257XXXXX" "0" "0" "3" ""
or
[[3]]
[1] "53" "1"
Any help is greatly appreciated.