def submitOrder(self,
                    unifiedSymbol,
                    orderPriceType,
                    direction,
                    offsetFlag,
                    accountId,
                    price,
                    volume,
                    originOrderId=None,
                    sync=True):
        if self.initSwitch and self.tradingSwitch:
            submitOrderReq = SubmitOrderReqField()

            submitOrderReq.contract.CopyFrom(
                ClientTradeCacheService.getContractByUnifiedSymbol(
                    unifiedSymbol))
            submitOrderReq.direction = direction
            submitOrderReq.offsetFlag = offsetFlag
            submitOrderReq.orderPriceType = orderPriceType
            submitOrderReq.timeCondition = TimeConditionEnum.TC_GFD
            submitOrderReq.price = price
            submitOrderReq.minVolume = 1
            submitOrderReq.stopPrice = 0.0
            submitOrderReq.volumeCondition = VolumeConditionEnum.VC_AV
            submitOrderReq.contingentCondition = ContingentConditionEnum.CC_Immediately
            submitOrderReq.hedgeFlag = HedgeFlagEnum.HF_Speculation
            submitOrderReq.forceCloseReason = ForceCloseReasonEnum.FCR_NotForceClose
            submitOrderReq.volume = volume

            account = ClientTradeCacheService.getAccountByAccountId(accountId)

            submitOrderReq.gatewayId = account.gatewayId
            submitOrderReq.accountCode = account.code
            submitOrderReq.currency = account.currency

            if originOrderId is None:
                submitOrderReq.originOrderId = str(uuid.uuid4())
            else:
                submitOrderReq.originOrderId = originOrderId

            self.originOrderIdSet.add(submitOrderReq.originOrderId)

            logger.info("策略%s提交定单 %s", MessageToJson(submitOrderReq),
                        self.strategyId)
            if sync:
                orderId = RpcClientApiService.submitOrder(submitOrderReq,
                                                          sync=True)
                return orderId
            else:
                RpcClientApiService.submitOrder(submitOrderReq, sync=False)
                return None
        else:
            logger.error("策略尚未初始化或未处于交易状态")
            return None
    def submitOrder(self,
                    unifiedSymbol,
                    priceType,
                    direction,
                    offset,
                    accountId,
                    price,
                    volume,
                    originOrderId=None):
        if self.initSwitch and self.tradingSwitch:
            submitOrderReq = SubmitOrderReqField()
            submitOrderReq.contract.CopyFrom(
                ClientTradeCacheService.mixContractDict[unifiedSymbol])
            submitOrderReq.price = price
            submitOrderReq.priceType = priceType
            submitOrderReq.volume = volume
            submitOrderReq.direction = direction
            submitOrderReq.offset = offset
            account = ClientTradeCacheService.accountDict[accountId]

            submitOrderReq.gatewayId = account.gateway.gatewayId
            submitOrderReq.accountCode = account.code
            submitOrderReq.currency = account.currency

            if originOrderId is None:
                submitOrderReq.originOrderId = str(uuid.uuid4())
            else:
                submitOrderReq.originOrderId = originOrderId

            self.originOrderIdSet.add(submitOrderReq.originOrderId)

            logger.warning("策略%s提交定单 \n %s", submitOrderReq, self.strategyId)
            orderId = RpcClientApiService.submitOrder(submitOrderReq,
                                                      sync=True)
            return orderId
        else:
            logger.error("策略尚未初始化或未处于交易状态")
            return None