parameters: (
          self,
          strategy: StrategyBase,
          original_req: OrderRequest,
          lock: bool = False
      )
return_statement: return orderids
docstring: Send a new order to server.
docstring_summary: Send a new order to server.
docstring_tokens: Send a new order to server .
function: def send_order(
          self,
          strategy: StrategyBase,
          original_req: OrderRequest,
          lock: bool = False
      ):
          """
          Send a new order to server.
          """
          # Convert with offset converter
          req_list = self.offset_converter.convert_order_request(
              original_req, lock)
  
          # Send Orders
          orderids = []
  
          for req in req_list:
              req.clientID = self.id
              req.client_order_id = self.ordercount
              self.ordercount += 1
              m = Event(type=EventType.ORDER,
                        data=req,
                        des=req.api + '.' + req.account,
                        src=str(self.id)
                        )
              if req.api == "CTP.TD":
                  m.msg_type = MSG_TYPE.MSG_TYPE_ORDER_CTP
              elif req.api == "PAPER.TD":
                  m.msg_type = MSG_TYPE.MSG_TYPE_ORDER_PAPER
              else:
                  print("error:api not support!")
                  return []
              msg = m.serialize()
              print(f'tradeclient {self.id} send msg: {msg}')
              self._send_sock.send(msg)
              orderids.append(req.client_order_id)
              self.offset_converter.update_order_request(req)
              # Save relationship between orderid and strategy.
              self.orderid_strategy_map[req.client_order_id] = strategy
              self.strategy_orderid_map[strategy.strategy_name].add(
                  req.client_order_id)
  
          return orderids
function_tokens: def send_order ( self , strategy : StrategyBase , original_req : OrderRequest , lock : bool = False ) : # Convert with offset converter req_list = self . offset_converter . convert_order_request ( original_req , lock ) # Send Orders orderids = [ ] for req in req_list : req . clientID = self . id req . client_order_id = self . ordercount self . ordercount += 1 m = Event ( type = EventType . ORDER , data = req , des = req . api + '.' + req . account , src = str ( self . id ) ) if req . api == "CTP.TD" : m . msg_type = MSG_TYPE . MSG_TYPE_ORDER_CTP elif req . api == "PAPER.TD" : m . msg_type = MSG_TYPE . MSG_TYPE_ORDER_PAPER else : print ( "error:api not support!" ) return [ ] msg = m . serialize ( ) print ( f'tradeclient {self.id} send msg: {msg}' ) self . _send_sock . send ( msg ) orderids . append ( req . client_order_id ) self . offset_converter . update_order_request ( req ) # Save relationship between orderid and strategy. self . orderid_strategy_map [ req . client_order_id ] = strategy self . strategy_orderid_map [ strategy . strategy_name ] . add ( req . client_order_id ) return orderids