code: def placeOrder(self, contract: Contract, order: Order) -> Trade:
          
          orderId = order.orderId or self.client.getReqId()
          self.client.placeOrder(orderId, contract, order)
          now = datetime.datetime.now(datetime.timezone.utc)
          key = self.wrapper.orderKey(
              self.wrapper.clientId, orderId, order.permId)
          trade = self.wrapper.trades.get(key)
          if trade:
              # this is a modification of an existing order
              assert trade.orderStatus.status not in OrderStatus.DoneStates
              logEntry = TradeLogEntry(now, trade.orderStatus.status, 'Modify')
              trade.log.append(logEntry)
              self._logger.info(f'placeOrder: Modify order {trade}')
              trade.modifyEvent.emit(trade)
              self.orderModifyEvent.emit(trade)
          else:
              # this is a new order
              order.clientId = self.wrapper.clientId
              order.orderId = orderId
              orderStatus = OrderStatus(status=OrderStatus.PendingSubmit)
              logEntry = TradeLogEntry(now, orderStatus.status, '')
              trade = Trade(
                  contract, order, orderStatus, [], [logEntry])
              self.wrapper.trades[key] = trade
              self._logger.info(f'placeOrder: New order {trade}')
              self.newOrderEvent.emit(trade)
          return trade
docs: Place a new order or modify an existing order.
          Returns a Trade that is kept live updated with
          status changes, fills, etc.
  
          Args:
              contract: Contract to use for order.
              order: The order to be placed.