It happened again today but this time, only the MIT part of the order was missing from 2 of the orders. Here is a screenshot.
IB got back to me after I sent them the logs, they told me that,
After reviewing your logs further, we saw that almost all of your orders are using the same set of order IDs, 71, 73, 74, 75. Given Interactive Brokers does not allow order IDs to repeat, it means that either all subsequent orders are having an error for duplicate order IDs, or the more likely reason is because there is some other error rejecting the order initially.
I am not sure how to fix, am I advancing through each bracket / new parent order wrongly here???
def nextValidId(self, orderId: int):
super().nextValidId(orderId)
self.nextValidOrderId = orderId
print('The next valid order id is: ', orderId)
def nextOrderId(self):
oid = self.nextValidOrderId
self.nextValidOrderId += 1
return oid
for ticker, orders in new_portfolio.items():
bracket = app.BracketOrder(.........)
for o in bracket:
app.placeOrder(o.orderId, app.EQ_order_MKT(ticker), o)
app.nextOrderId()
app.disconnect()
As such, we noticed the average API connection time was no more than about 150ms before you had disconnected. We would ask that you remain connected for at least 1 second before disconnecting. Please try your standard code, with the extended connection time, and let us know if any messages are returned. The increased connection time should allow for order status and error messages to return.
Do they mean I should put a time.sleep(1) after I finish my loops?