I have a manual order placed in TWS.
I can see this order in the API (my API client is set to clientID=0).
It shows as:
order=Order(permId=390120308, action='BUY', totalQuantity=10.0, orderType='STP LMT', lmtPrice=25.0, auxPrice=24.5, tif='GTC', ocaType=3, displaySize=2147483647, rule80A='0', trailStopPrice=24.5, openClose='', volatilityType=0, deltaNeutralOrderType='None', deltaNeutralOpenClose='?', referencePriceType=0, account='XXXX', clearingIntent='IB', adjustedOrderType='None', cashQty=0.0, dontUseAutoPriceForHedge=True)
Now I want to cancel this order from the API.
When I pass this order to cancelOrder(order), the following error shows:
Error 10147, reqId 0: OrderId 0 that needs to be cancelled is not found.
Indeed, while there is a permId, order.clientId and order.reqId are 0.
How can I cancel this order?
Note: this order has status pre-submitted on TWS because it is a stop limit order for a CBOE combo order position, and thus it is held by IB until the stop triggers as stop limit is not natively supported by CBOE.