Exemplo n.º 1
0
        private double _RiseDownPercent; // 比最高点下降的比例,比最低点上升的比例

        #endregion Fields

        #region Constructors

        public RiseDownRule(double percent)
        {
            _CurMaxPrise = -1;
            _CurMinPrise = 10000;
            _Direction = StockDirection.Rise;
            _RiseDownPercent = percent;
        }
        // This relates to the line that goes with '#'.
        internal void AddComparisonValue(string value)
        {
            switch (currentAssignment)
            {
            case AssignTo.Undefined:
            {
                // TODO: Return bool
                break;
            }

            case AssignTo.Direction:
            {
                if (string.Compare(value, StockDirection.Long.ToString().ToLower()) == 0)
                {
                    direction = StockDirection.Long;
                }
                else
                {
                    direction = StockDirection.Short;
                }
                break;
            }

            case AssignTo.HolderCountry:
            {
                holderCountry.Add(value);
                break;
            }

            case AssignTo.StockType:
            {
                if (string.Compare(value, StockType.Common.ToString().ToLower()) == 0)
                {
                    type = StockType.Common;
                }
                else
                {
                    type = StockType.Preferred;
                }
                break;
            }

            default:
            {
                break;
            }
            }

            if (progress == PreAggProgress.HaveComparisonType)
            {
                progress = PreAggProgress.HaveComparisonValue;
                preAggSpecificationsSatisfied = true;
            }
        }
        private bool CheckDirectionType(StockDirection filterDirection, string dataDirection, Comparison compareBy)
        {
            switch (compareBy)
            {
            case Comparison.Equal:
            {
                if (filterDirection.ToString().Equals(dataDirection))
                {
                    return(true);
                }
                break;
            }

            case Comparison.NotEqual:
            {
                if (!filterDirection.ToString().Equals(dataDirection))
                {
                    return(true);
                }
                break;
            }

            case Comparison.IN:
            {
                if (filterDirection.ToString().Equals(dataDirection))
                {
                    return(true);
                }
                break;
            }

            default:
            {
                break;
            }
            }

            return(false);
        }
Exemplo n.º 4
0
        private bool JudgeSameDirection(double curPrice, double prevPrice)
        {
            if ((curPrice > prevPrice) && (_Direction == StockDirection.Down))
            {
                _Direction = StockDirection.Rise;
                return false;
            }

            if ((curPrice < prevPrice) && (_Direction == StockDirection.Rise))
            {
                _Direction = StockDirection.Down;
                return false;
            }

            return true;
        }
 public StockDirectionDetails(StockQuoteData quote, StockDirection direction)
 {
     StockQuote = quote;
     Direction  = direction;
 }