Exemple #1
0
        public PriceSpreadCondition Clone()
        {
            PriceSpreadCondition entity = new PriceSpreadCondition();

            entity.PriceSpreadSide      = this.PriceSpreadSide;
            entity.PriceSpreadThreshold = this.PriceSpreadThreshold;

            return(entity);
        }
        /// <summary>
        /// 是否满足价差。
        /// </summary>
        /// <param name="spreadSide"></param>
        /// <param name="threshold"></param>
        /// <param name="priceSpread"></param>
        /// <returns></returns>
        private bool IsInPriceSpread(PriceSpreadCondition condition, decimal priceSpread)
        {
            switch (condition.PriceSpreadSide)
            {
            case PriceSpreadSide.GreaterOrEqual:
                return(priceSpread >= condition.PriceSpreadThreshold);

            case PriceSpreadSide.LessOrEqual:
                return(priceSpread <= condition.PriceSpreadThreshold);

            default:
                Debug.Assert(false);
                return(false);
            }
        }