Exemple #1
0
        public static int getTradeDays(MongoDataReader w, DateTime begt, DateTime endt)
        {
            TDaysGuidClas          tgc = new TDaysGuidClas();
            TDayGuildBuilder_ForMG tgb = new TDayGuildBuilder_ForMG(w, tgc);
            MTable ret = tgb.getRecordsCount(begt, endt);

            return((int)ret.GetTable().Rows[0][0]);
        }
Exemple #2
0
        public static DateTime[] getTradeDates(MongoDataReader w, DateTime begt, DateTime endt, Cycle cyc)
        {
            TDaysGuidClas tgc = new TDaysGuidClas();

            tgc.cycle = cyc;
            TDayGuildBuilder_ForMG tgb = new TDayGuildBuilder_ForMG(w, tgc);
            MTable ret = tgb.getRecords(begt, endt);

            return(ret.ToList <DateTime>().ToArray());
        }
Exemple #3
0
        public static DateTime Offset(MongoDataReader w, DateTime endt, int N, Cycle cyc)
        {
            TDaysGuidClas tgc = new TDaysGuidClas();

            tgc.cycle = cyc;
            TDayGuildBuilder_ForMG tgb = new TDayGuildBuilder_ForMG(w, tgc);
            MTable   ret      = tgb.getRecords(endt, N);
            DateTime lastdate = Convert.ToDateTime(ret.GetTable().Rows[0][0]);

            if (cyc == Cycle.Day)
            {
                return(lastdate);
            }
            DateTime[] dates = getTradeDates(w, lastdate, endt);
            for (int i = 0; i < dates.Length - 1; i++)
            {
                if (dates[i].AddDays(1).CompareTo(dates[i + 1]) < 0)
                {
                    return(dates[i]);
                }
            }
            return(lastdate);
        }