Beispiel #1
0
        public List <TickerEntity> GetWeeklyTickerListFromDayList(List <TickerEntity> dayTickerList)
        {
            List <TickerEntity> weeklyTickerList = new List <TickerEntity>();
            Dictionary <int, List <TickerEntity> > tickerDict = new Dictionary <int, List <TickerEntity> >();

            foreach (TickerEntity ticker in dayTickerList)
            {
                int beginOfWeek = DateHelper.BeginOfWeek(ticker.P);
                if (!tickerDict.ContainsKey(beginOfWeek))
                {
                    tickerDict.Add(beginOfWeek, new List <TickerEntity>());
                }

                tickerDict[beginOfWeek].Add(ticker);
            }

            foreach (var item in tickerDict)
            {
                TickerEntity weeklyTicker = this.GetWeeklyTickerFromDayList(item.Key, item.Value);

                if (weeklyTicker != null)
                {
                    weeklyTickerList.Add(weeklyTicker);
                }
            }

            return(weeklyTickerList);
        }
Beispiel #2
0
        public void TestEndOfWeek()
        {
            int period = 19980401;

            Console.WriteLine("friday: " + DateHelper.BeginOfWeek(period) + "   " + DateHelper.ToDate(period).ToLongDateString());
        }