Пример #1
0
        public QuoteCollection(QuoteCollection original, RecordType longer)
        {
            if (QuoteType > longer)
            {
                throw new Exception();
            }

            Name      = original.Name;
            QuoteType = longer;
            //DateTimeFormat = DefaultDateTimeFormats[QuoteType];

            DataCollection = FromShortTerms(original, longer);

            getCeilingFloor();

            //YData = original.YData;
            //Threshold = original.Threshold;
            LastModify       = DateTime.Now;
            ShortTermOutline = TrendMarker.OutlineFromQuotes(this, 1);
            CurrentOutline   = TrendMarker.OutlineFromQuotes(this, TrendMarker.DefaultThreshold);

            if (CurrentOutline == null)
            {
                CurrentOutline = ShortTermOutline;
            }

            OutlineValues = getDefaultValues();
            Dates         = getDates();
        }
Пример #2
0
        public MajorCollection(List <Quote> dataCollection, int threshold)
        {
            Source    = dataCollection;
            LastMark  = DateTime.Now;
            Threshold = threshold;

            Prominents = TrendMarker.MajorsOf(dataCollection, threshold);
        }
Пример #3
0
        //private List<MajorCollection> majorsCollection = new List<MajorCollection>();
        //public MajorCollection MajorsOf(int threshold)
        //{
        //    MajorCollection result = null;

        //    foreach (MajorCollection items in majorsCollection)
        //    {
        //        if (items.Threshold == threshold)
        //        {
        //            result = items;
        //        }
        //    }

        //    if (result == null)
        //    {
        //        result = new MajorCollection(DataCollection, threshold);
        //        majorsCollection.Add(result);
        //    }
        //    else if (result.LastMark < LastModify)
        //    {
        //        majorsCollection.Clear();
        //        result = new MajorCollection(DataCollection, threshold);
        //        majorsCollection.Add(result);
        //    }

        //    return result;
        //}

        //public List<OutlineItem> OutlineDictionary
        //{
        //    get { return MajorsOf(Threshold).OutlineDictionary; }
        //}

        #endregion

        #endregion

        #region Constructors

        public QuoteCollection(string name, List <Quote> quotes) //, ValueType yType)
        {
            Name = name;
            //YData = yType;
            //Threshold = TrendMarker.DefaultThreshold;

            DataCollection = quotes;
            DataCollection.Sort();
            LastModify = DateTime.Now;

            QuoteType = GuessQuoteType(DataCollection);

            ShortTermOutline = TrendMarker.OutlineFromQuotes(this, 1);
            CurrentOutline   = TrendMarker.OutlineFromQuotes(this, TrendMarker.DefaultThreshold);
            OutlineValues    = getDefaultValues();
            Dates            = getDates();
        }
Пример #4
0
 public Outline OutlineOf(int threshold)
 {
     if (threshold < 1)
     {
         return(null);
     }
     else if (threshold == 1)
     {
         return(ShortTermOutline);
     }
     else if (threshold == TrendMarker.DefaultThreshold)
     {
         return(CurrentOutline);
     }
     else
     {
         return(TrendMarker.OutlineFromQuotes(this, threshold));
     }
 }
Пример #5
0
        public static SortedDictionary <DateTimeOffset, Double> OutlineOf(Outline baseOutline, int threshold)
        {
            TrendMarker marker = new TrendMarker(baseOutline, threshold);

            return(marker.OutlineDictionary);
        }
Пример #6
0
        public static SortedDictionary <DateTimeOffset, Double> OutlineOf(QuoteCollection quotes, int threshold)
        {
            TrendMarker marker = new TrendMarker(quotes.DataCollection, threshold);

            return(marker.OutlineDictionary);
        }
Пример #7
0
        //public static Dictionary<DateTimeOffset, Major> MajorsOf(List<Quote> dataCollection, int threshold)
        //{
        //    TrendMarker marker = new TrendMarker(dataCollection, threshold);

        //    return marker.MajorQuotes;
        //}

        public static Outline OutlineFromQuotes(QuoteCollection quotes, int threshold)
        {
            TrendMarker marker = new TrendMarker(quotes.DataCollection, threshold);

            return(marker.TheOutline);
        }