Roll Convention does not support Daily and Weekly periods
- pragyaOP
We are trying to use daml finance for creating payment schedule. while creating schedule , when roll convention value is ‘No Roll convention’ then period value supported should be “daily(D) and weekly(W)” according to documentation . But when we are choose D and W as period , error is thrown as “daily periodic dates not supported” .And roll convention is mandatory value. Then how to create a schedule for D and W periods?
- a_putkov
I’m not sure why, but looking at the source code, daily and weekly periods are explicitly not supported with roll conventions.
However, it’s easy enough to construct a dailySchedulewithout utilizingcreateSchedulefunction orPeriodicScheduletype. E.g.createDailySchedule: Date -> Int -> HolidayCalendarData -> BusinessDayConventionEnum -> Schedule createDailySchedule startDate numDays cal bdConv = let sp d = SchedulePeriod with unadjustedStartDate = d unadjustedEndDate = addDays d 1 adjustedStartDate = adjustDate cal bdConv d adjustedEndDate = adjustDate cal bdConv $ addDays d 1 stubType = None in foldl (\acc i -> sp (head acc).adjustedEndDate :: acc ) [sp startDate] [1..numDays-1]The above function takes business day convention enum as an argument, although I suppose only the Following convention makes sense with a daily schedule.
Here’s the quick test script I used to test this function.calendar = HolidayCalendarData with id = "USNY" weekend = [Saturday, Sunday] holidays = [D.date 2025 Nov 27,D.date 2025 Dec 25] testSchedule = script do let expectedResult = [ SchedulePeriod with unadjustedStartDate = D.date 2025 Nov 25 unadjustedEndDate = D.date 2025 Nov 26 adjustedStartDate = D.date 2025 Nov 25 adjustedEndDate = D.date 2025 Nov 26 stubType = None , SchedulePeriod with unadjustedStartDate = D.date 2025 Nov 26 unadjustedEndDate = D.date 2025 Nov 27 adjustedStartDate = D.date 2025 Nov 26 adjustedEndDate = D.date 2025 Nov 28 stubType = None , SchedulePeriod with unadjustedStartDate = D.date 2025 Nov 28 unadjustedEndDate = D.date 2025 Nov 29 adjustedStartDate = D.date 2025 Nov 28 adjustedEndDate = D.date 2025 Dec 1 stubType = None ] expectedResult === reverse (createDailySchedule (D.date 2025 Nov 25) 3 calendar Following)