Exemplo n.º 1
0
        public static DateTime PreviousBusinessDay(DateTime date, Holiday.Calendar cal)
        {
            // if date is NOT a trade day, then adding 0 trade days will return the previous trade day, otherwise we add -1 trade days
            int daysBack = Holiday.IsTradeDate(date, cal) ? -1 : 0;

            return Holiday.AddTradeDays(date, daysBack, cal);
        }
Exemplo n.º 2
0
 public static DateTime LastBusinessDayOfMonth(int month, int year, Holiday.Calendar cal)
 {
     var firstDayOfNextMonth = new DateTime(year, month, 1).AddMonths(1);
     var lastDay = firstDayOfNextMonth.AddDays(-1);
     return Holiday.DateAdd(Holiday.StepInterval.Day, 0, lastDay, Holiday.Direction.backward, cal);
 }