nextValidID in TWS API

Hi @Varun, your course on TWS API in EPAT is pretty good. I went through it again. Thank you.

    

in the python code on LT_Bollinger band,



can you tell me why are you incrementing order_id





            # Place market order

            self.placeOrder(orderId=self.order_id, 

                            contract=self.contract, 

                            order=self.order)

            self.order_id += 1





Isn't it already been taken care of in nextValidID call back function



    # Callback to handle order ids

    def nextValidId(self, orderId):         

        super().nextValidId(orderId)

        self.nextValidOrderId = orderId

        print('NextValidId:', orderId)





Also possible for you to explain orderId and reqId slightly more in details…


  1. Do we need to initialize both OrderID and reqID ?
  2. Can we use incremental orderID as reqID as orderID is automatically incremented by the call back function ?