code: def createTrailingStopOrder(self, contract, quantity,
              parentId=0, trailPercent=100., group=None, triggerPrice=None,
              account=None):
  
          
          if parentId not in self.orders:
              raise ValueError("Order #" + str(parentId) + " doesn't exist or wasn't submitted")
  
          order = self.createStopOrder(quantity,
                      stop     = trailPercent,
                      transmit = True,
                      trail    = True,
                      # ocaGroup = group
                      parentId = parentId,
                      account  = account
                  )
  
          self.requestOrderIds()
          return self.placeOrder(contract, order, self.orderId + 1)
docs: convert hard stop order to trailing stop order