API Trading / IB Disconnect Issue.

Discussion in 'Retail Brokers' started by walterjennings, Jun 11, 2007.

  1. Hey I was wondering if anyone here who codes automated systems on IB has dealt with this problem.

    I have an automated system which places and modifies a limit order. Sometimes the connection between TWS and IB breaks and because of that I dont get the 'Filled' event or 'Cancelled' event (caused by a tight GTD). It then reconnects and either gives a 'Cannot modify filled order' or 'duplicate id' error. as my app continues to try to modify the limit order. I assumed I would only get the 'Cannot modify filled order' if the order was actually filled, but apparently they send that when orders have been cancelled also.

    So after these disconnects I dont know if my order has been filled, or cancelled by the GTD. How do you guys deal with these problems if you run into them?

  2. mg_mg


    After each reconnection, fire reqAllOpenOrders and reqExecutions, then you know the up-to-date status about your submitted orders.
  3. thanks. does reqExecutions only return trades that are gone through, and reqAllOpen only return orders that are still active? is there a way to find out which orders have been cancelled?
  4. mg_mg


    reqExecutions returns which order is filled via the execDetails() method, reqAllOpenOrders returns which order is open via the openOrder() and orderStatus methods. If one of your submitted orders is not currently open and not filled, then it is cancelled.