This message was originally posted on IB's API forum. I Thought it
worthy of our archives and discussion.
Posted on Wednesday, June 19, 2002 - 06:26 am:
----------------------------------------------------------------------
----------
Dear IB,
There is a problem with the ActiveX API/TWS interface after a
disruption of the internet connection to IB. To demonstrate this
problem using the Excel sheet do this:
1 - Place a stop or limit oder (order status will change
to 'Submitted' or 'Presubmitted' depending on ordertype and
exchange). Write down the assigned order id. In this example I assume
it is 123.
2 - Fake a disruption of your internet connection by unplugging the
network cable from your PC till TWS show the grid.
3 - Plug in the cable again, the grid disappears and TWS shows quote
updates again. So far so good.
4 - Now try to cancel the order - You get an error "Can't find order
with id 123"
5 - If you request open orders you see the order Id has changed (in
our case from 123 to 124).
Questions:
What is the correct procedure to cancel the order?
Why does IB renumber order id's after a disruption of the internet
connection?
Note:
- This behaviour doesn't match the API documentation for cancelOrder
() which tells you to use the ID that was specified previously in the
call to placeOrder().
- This also explains the 'Duplicate order id' messages people have
been seeing lately.
- In the example above we used cancelOrder() but placeOrder() (when
changing orders) has the same problem.
- We used the most current Release of TWS and the API
Regards,
Pieter