コード例 #1
0
        /// <summary>
        /// ContingentCondition枚举型转为TThostFtdcContingentConditionType枚举型
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public static TThostFtdcContingentConditionType ContingentCondition_To_TThostFtdcContingentConditionType(ContingentCondition cc)
        {
            TThostFtdcContingentConditionType tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_Immediately;

            switch (cc)
            {
            case ContingentCondition.Immediately:
                break;

            case ContingentCondition.Touch:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_Touch;
                break;

            case ContingentCondition.TouchProfit:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_TouchProfit;
                break;

            case ContingentCondition.ParkedOrder:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_ParkedOrder;
                break;

            case ContingentCondition.LastPriceGreaterThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceGreaterThanStopPrice;
                break;

            case ContingentCondition.LastPriceGreaterEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceGreaterEqualStopPrice;
                break;

            case ContingentCondition.LastPriceLesserThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceLesserThanStopPrice;
                break;

            case ContingentCondition.LastPriceLesserEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceLesserEqualStopPrice;
                break;

            case ContingentCondition.AskPriceGreaterThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceGreaterThanStopPrice;
                break;

            case ContingentCondition.AskPriceGreaterEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceGreaterEqualStopPrice;
                break;

            case ContingentCondition.AskPriceLesserThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceLesserThanStopPrice;
                break;

            case ContingentCondition.AskPriceLesserEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceLesserEqualStopPrice;
                break;

            case ContingentCondition.BidPriceGreaterThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceGreaterThanStopPrice;
                break;

            case ContingentCondition.BidPriceGreaterEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceGreaterEqualStopPrice;
                break;

            case ContingentCondition.BidPriceLesserThanStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceLesserThanStopPrice;
                break;

            case ContingentCondition.BidPriceLesserEqualStopPrice:
                tfcct = TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceLesserEqualStopPrice;
                break;

            default:
                break;
            }
            return(tfcct);
        }
コード例 #2
0
        /// <summary>
        /// 将TThostFtdcContingentConditionType转换为ContingentCondition
        /// </summary>
        /// <param name="tfct">TThostFtdcContingentConditionType枚举型</param>
        /// <returns></returns>
        public static ContingentCondition TThostFtdcContingentConditionType_To_ContingentCondition(TThostFtdcContingentConditionType tfct)
        {
            ContingentCondition cct = ContingentCondition.Immediately;

            switch (tfct)
            {
            case TThostFtdcContingentConditionType.THOST_FTDC_CC_Immediately:
                //cct = ContingentConditionType.Immediately;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_Touch:
                cct = ContingentCondition.Touch;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_TouchProfit:
                cct = ContingentCondition.TouchProfit;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_ParkedOrder:
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceGreaterThanStopPrice:
                cct = ContingentCondition.LastPriceGreaterThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceGreaterEqualStopPrice:
                cct = ContingentCondition.LastPriceGreaterEqualStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceLesserThanStopPrice:
                cct = ContingentCondition.LastPriceLesserThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_LastPriceLesserEqualStopPrice:
                cct = ContingentCondition.LastPriceLesserEqualStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceGreaterThanStopPrice:
                cct = ContingentCondition.AskPriceGreaterThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceGreaterEqualStopPrice:
                cct = ContingentCondition.AskPriceGreaterEqualStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceLesserThanStopPrice:
                cct = ContingentCondition.AskPriceLesserThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_AskPriceLesserEqualStopPrice:
                cct = ContingentCondition.AskPriceLesserEqualStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceGreaterThanStopPrice:
                cct = ContingentCondition.BidPriceGreaterThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceGreaterEqualStopPrice:
                cct = ContingentCondition.BidPriceGreaterEqualStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceLesserThanStopPrice:
                cct = ContingentCondition.BidPriceLesserThanStopPrice;
                break;

            case TThostFtdcContingentConditionType.THOST_FTDC_CC_BidPriceLesserEqualStopPrice:
                cct = ContingentCondition.BidPriceLesserEqualStopPrice;
                break;

            default:
                break;
            }
            return(cct);
        }