//use this to set up time buckets for trade
        private static int[] GetDayIntervalOffsets(DateTime referenceDate, DateTime maturityDate, string intervalString, out DateTime[] dates)
        {
            List <int>      result    = new List <int>();
            List <DateTime> datesList = new List <DateTime>();

            DateTime  baseDate        = new DateTime(referenceDate.Year, referenceDate.Month, referenceDate.Day);
            const int cZeroDaysOffset = 0;
            DateTime  offSetDate      = baseDate;

            if (offSetDate.CompareTo(maturityDate) <= 0)
            {
                result.Add(cZeroDaysOffset);
                datesList.Add(offSetDate);
            }

            Interval interval = IntervalHelper.Parse(intervalString);

            DateTime newDate = DateHelper.AddPeriod(offSetDate, interval, 1);

            while (newDate.CompareTo(maturityDate) <= 0)
            {
                int noOfDaysOffset = (newDate - offSetDate).Days;
                result.Add(result[result.Count - 1] + noOfDaysOffset);
                offSetDate = newDate;
                datesList.Add(offSetDate);
                newDate = DateHelper.AddPeriod(offSetDate, interval, 1);
            }
            dates = datesList.ToArray();
            return(result.ToArray());
        }