/// <summary>
        /// 获取股指期货交易费用
        /// </summary>
        /// <param name="request">股指期货委托</param>
        /// <returns>股指期货交易费用结果</returns>
        public static QHCostResult ComputeGZQHCost(StockIndexFuturesOrderRequest request)
        {
            int?bc = MCService.CommonPara.GetBreedClassIdByCommodityCode(request.Code);

            QHCostResult result = null;

            if (!bc.HasValue)
            {
                return(result);
            }

            int            breedClassID = bc.Value;
            QH_FutureCosts cost         = MCService.FuturesTradeRules.GetFutureCostsByBreedClassID(breedClassID);

            if (cost == null)
            {
                return(null);
            }


            try
            {
                result = InternalComputeGZQHCost(request, cost);
            }
            catch (Exception ex)
            {
                string      errCode   = "GT-1703";
                string      errMsg    = "无法获取股指期货货交易费用。";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception);
                throw exception;
            }

            return(result);
        }
        /// <summary>
        /// 获取股指期货交易费用的实际方法,目前使用商品期货的计算方法
        /// </summary>
        /// <param name="request">股指期货委托</param>
        /// <param name="cost">费用实体</param>
        /// <returns>股指期货交易费用结果</returns>
        private static QHCostResult InternalComputeGZQHCost(StockIndexFuturesOrderRequest request, QH_FutureCosts cost)
        {
            QHCostResult result = new QHCostResult();

            //result.Code = result.Code;
            result.Code = request.Code;
            decimal orderPrice = (decimal)request.OrderPrice;
            //期货合约乘数300
            decimal scale = MCService.GetTradeUnitScale(request.Code, request.OrderUnitType);
            //以计价单位计算的委托量
            var orderAmount = (decimal)request.OrderAmount * scale;

            //成交额
            var dealAmount = orderPrice * orderAmount;

            decimal cosing = 0;

            //按类型计算比例
            switch ((Types.FutrueCostType)Enum.Parse(typeof(Types.FutrueCostType), cost.CostType.ToString()))
            {
            case Types.FutrueCostType.TradeUnitCharge:
                //与量有关的都是撮合单位,所以这里不用再把委托量*转换比例
                //为了不改上面的代码这里直接再把原来转了的值再除
                orderAmount = (decimal)orderAmount / scale;
                cosing      = orderAmount * cost.TurnoverRateOfServiceCharge;
                break;

            case Types.FutrueCostType.TurnoverRateOfSerCha:
                //比例
                decimal cosingScale = cost.TurnoverRateOfServiceCharge / 100;
                cosing = dealAmount * cosingScale;
                break;
            }
            cosing = Utils.Round(cosing);

            #region old code
            //decimal tradeVal = 0;
            ////成交单位比率
            //if (cost.TradeUnitCharge.HasValue)
            //{
            //    decimal trade = cost.TradeUnitCharge.Value / 100;
            //    tradeVal = orderAmount * trade;
            //    tradeVal = Utils.Round(tradeVal);
            //}

            //decimal turnVal = 0;
            ////成交金额比率
            //if (cost.TurnoverRateOfServiceCharge.HasValue)
            //{
            //    decimal turn = cost.TurnoverRateOfServiceCharge.Value / 100;
            //    turnVal = turn * dealAmount;
            //    turnVal = Utils.Round(turnVal);
            //}
            //result.Cosing = tradeVal + turnVal;
            #endregion

            result.Cosing = cosing;


            string format = "股指期货费用计算[代码={0},价格={1},数量={2},单位={3},方向={4},合约乘数={5},股指期货交易费用类型={6},费用比率={7}]";
            string desc   = string.Format(format, request.Code, request.OrderPrice, request.OrderAmount,
                                          request.OrderUnitType, request.BuySell, scale
                                          , cost.CostType + "--" + (cost.CostType == (int)Types.FutrueCostType.TradeUnitCharge ? "按成交量" : "按成交额")
                                          , cost.TurnoverRateOfServiceCharge);
            LogHelper.WriteDebug(desc + result);

            return(result);
        }