Пример #1
0
        public static int getTradeDays(WindAPI w, DateTime begt, DateTime endt)
        {
            TDaysGuidClas          tgc = new TDaysGuidClas();
            TDayGuildBuilder_ForWD tgb = new TDayGuildBuilder_ForWD(w, tgc);
            MTable ret = tgb.getRecordsCount(begt, endt);

            return((int)ret.GetTable().Rows[0][0]);
        }
Пример #2
0
        public static DateTime[] getTradeDates(WindAPI w, DateTime begt, DateTime endt, Cycle cyc)
        {
            TDaysGuidClas tgc = new TDaysGuidClas();

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

            return(ret.ToList <DateTime>().ToArray());
        }
Пример #3
0
        public static DateTime Offset(WindAPI w, DateTime endt, int N, Cycle cyc)
        {
            TDaysGuidClas tgc = new TDaysGuidClas();

            tgc.cycle = cyc;
            TDayGuildBuilder_ForWD tgb = new TDayGuildBuilder_ForWD(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);
        }