def submitOrder(submitOrderReq, reqId=None, sync=False):
        if not reqId:
            reqId = str(uuid.uuid4())
        operatorId = RtConfig.operatorId
        sourceNodeId = RtConfig.nodeId

        commonReq = CommonReqField()
        commonReq.sourceNodeId = sourceNodeId
        commonReq.targetNodeId = 0
        commonReq.operatorId = operatorId
        commonReq.reqId = reqId

        rpcSubmitOrderReq = RpcSubmitOrderReq()

        rpcSubmitOrderReq.commonReq.CopyFrom(commonReq)
        rpcSubmitOrderReq.submitOrderReq.CopyFrom(submitOrderReq)

        if sync:
            RpcClientRspHandler.registerWaitReqId(reqId)

        sendResult = RpcClientProcessService.sendCoreRpc(
            0, rpcSubmitOrderReq.SerializeToString(), reqId,
            RpcId.SUBMIT_ORDER_REQ)

        if sync and not sendResult:
            RpcClientRspHandler.unregisterWaitReqId(reqId)
            return None

        if sync:
            startTime = time.time()
            while True:
                if time.time() - startTime < RtConfig.rpcTimeOut:
                    rpcSubmitOrderRsp = RpcClientRspHandler.getAndRemoveRpcSubmitOrderRsp(
                        reqId)
                    if not rpcSubmitOrderRsp:
                        rpcExceptionRsp = RpcClientRspHandler.getAndRemoveRpcExceptionRsp(
                            reqId)
                        if rpcExceptionRsp:
                            logger.error("提交定单错误,请求ID: %s, 远程错误回报 %s", reqId,
                                         rpcExceptionRsp.info)
                            return None
                        time.sleep(0.02)
                    else:
                        commonRsp = rpcSubmitOrderRsp.commonRsp
                        errorId = commonRsp.errorId
                        if errorId == 0:
                            return rpcSubmitOrderRsp.orderId
                        else:
                            logger.error("提交定单错误,请求ID:%s,错误ID:%s,远程错误回报:%s",
                                         reqId, errorId, commonRsp.errorMsg)
                            return None
                else:
                    RpcClientRspHandler.unregisterWaitReqId(reqId)
                    logger.error("提交定单错误,请求ID: %s,等待回报超时", reqId)
                    return None
    def submitOrder(submitOrderReq, reqId=None, sync=False):
        if not reqId:
            reqId = str(uuid.uuid4())
        operatorId = Config.operatorId
        sourceNodeId = Config.nodeId

        commonReq = CommonReqField()
        commonReq.sourceNodeId = sourceNodeId
        commonReq.targetNodeId = 0
        commonReq.operatorId = operatorId
        commonReq.reqId = reqId

        rpcSubmitOrderReq = RpcSubmitOrderReq()

        rpcSubmitOrderReq.commonReq.CopyFrom(commonReq)
        rpcSubmitOrderReq.submitOrderReq.CopyFrom(submitOrderReq)

        if sync:
            RpcClientRspHandler.registerWaitReqId(reqId)

        sendResult = RpcClientProcessService.sendRoutineCoreRpc(
            0, rpcSubmitOrderReq.SerializeToString(), reqId,
            RpcId.SUBMIT_ORDER_REQ)

        if sync and not sendResult:
            RpcClientRspHandler.unregisterWaitReqId(reqId)
            return None

        if sync:
            startTime = time.time()
            while True:
                if time.time() - startTime < Config.rpcTimeOut:
                    rpcSubmitOrderRsp = RpcClientRspHandler.getAndRemoveRpcSubmitOrderRsp(
                        reqId)
                    if not rpcSubmitOrderRsp:
                        rpcExceptionRsp = RpcClientRspHandler.getAndRemoveRpcExceptionRsp(
                            reqId)
                        if rpcExceptionRsp:
                            logger.error("提交定单错误,请求ID: %s, 远程错误回报 %s", reqId,
                                         rpcExceptionRsp.info)
                            return None
                        time.sleep(0.02)
                    else:
                        commonRsp = rpcSubmitOrderRsp.commonRsp
                        requestStatus = commonRsp.requestStatus
                        if requestStatus == CommonStatusEnum.SUCCESS:
                            return rpcSubmitOrderRsp.orderId
                        elif requestStatus == CommonStatusEnum.INFO:
                            logger.info("提交定单错误,请求ID:%s,远程信息回报:%s", reqId,
                                        commonRsp.info)
                            return rpcSubmitOrderRsp.orderId
                        elif requestStatus == CommonStatusEnum.WARN:
                            logger.warning("提交定单错误,请求ID:%s,远程警告回报:%s", reqId,
                                           commonRsp.info)
                            return rpcSubmitOrderRsp.orderId
                        elif requestStatus == CommonStatusEnum.ERROR:
                            logger.error("提交定单错误,请求ID:%s,远程错误回报:%s", reqId,
                                         commonRsp.info)
                            return None
                        else:
                            logger.error("提交定单错误,请求ID:%s,未知的请求状态", reqId)
                            return None
                else:
                    RpcClientRspHandler.unregisterWaitReqId(reqId)
                    logger.error("提交定单错误,请求ID: %s,等待回报超时", reqId)
                    return None