hgodinez / ibrokers

Automatically exported from code.google.com/p/ibrokers
0 stars 0 forks source link

duplicate order IDs #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have some problems with order IDs.

placeOrder sometimes works, sometimes does not and I cannot find out why.

I think it has to do with the duplicate order IDs, which is the message I get 
when running portfolio <- 
twsPortfolioValue(reqAccountUpdates(tws),zero.pos=FALSE).

However I do not understand how those duplicate IDs can exist, if I am always 
using this sequence for the order creation:
"
  id <- reqIds(tws)
  placeOrder(tws, future.NameTrade, twsOrder(id, action = "SELL", totalQuantity = noFut, orderType = "MKT", goodAfterTime = "22:14:00 CET")) 
"

Thus, I always create new id. 

Once the duplicate order message appears, there is no way to execute orders 
programmatically from R, and I have to go manually to either Gateway or TWS and 
"reset API order id sequence".

Is there a programmatic way from R to reset API order id sequence? Or how to 
get from this situation? I would like everything to run automatically and not 
have to manually reset orders ever.

Thank you for a reply,

Jozef

Original issue reported on code.google.com by jozef.r...@gmail.com on 5 Oct 2012 at 9:09