Example #1
0
        private IList <DateTimeUTC> CreateMonthRange(DateTimeUTC open, DateTimeUTC final_data_time)
        {
            open = new DateTimeUTC(open.Year, open.Month, 1);
            List <DateTimeUTC> months = new List <DateTimeUTC>();

            while (open < final_data_time)
            {
                months.Add(open);
                open = open.AddMonths(1);
            }
            return(months);
        }
Example #2
0
        public static DateTimeUTC GetCloseTime(DateTimeUTC time, TimeScale time_scale)
        {
            DateTimeUTC open_time = GetOpenTime(time, time_scale);

            switch (time_scale)
            {
            case TimeScale.Second1:
                return(open_time.AddSeconds(1));

            case TimeScale.Minute1:
                return(open_time.AddMinutes(1));

            case TimeScale.Minute15:
                return(open_time.AddMinutes(15));

            case TimeScale.Minute30:
                return(open_time.AddMinutes(30));

            case TimeScale.Hour1:
                return(open_time.AddHours(1));

            case TimeScale.Hour4:
                return(open_time.AddHours(4));

            case TimeScale.Day1:
                return(open_time.AddDays(1));

            case TimeScale.Week1:
                return(open_time.AddDays(7));

            case TimeScale.Month1:
                return(open_time.AddMonths(1));

            default:
                throw new Exception("Unknown Timescale");
            }
        }