nextValidId()

This function is called after a successful connection to TWS.

virtual void nextValidId(OrderID orderId)

Parameter

Description

orderId

The next available order ID received from TWS upon connection. Increment all successive  orders by one based on this ID.