我会使用一个表(securityid、startdate、paymentevery、period),它还可以包括 enddate、paymentpershare
period 为 1 天,2 周,3 月,4 年。
因此,对于从 2009 年 3 月 1 日开始每周付款的安全 1,日期在 4 月 2 日改为每 20 天一次,然后在 2009 年 5 月 1 日之后每周一次,然后在 2009 年 7 月 1 日改为每月一次,它将包含:
1,'3/1/2009',1,2
1,'4/2/2009',20,1
1,'5/1/2009',1,2
1,'7/1/2009',1,3
要获得实际日期,我会使用这样的算法:
要了解从 2009 年 3 月 5 日到 2008 年 5 月 17 日的证券 1 的付款日期:
Find first entry before 3/5 = 3/1
Loop:
Get next date that's after 3/5 and before the next entry (4/2 - weekly) = 3/8
Get next date that's before next the entry (4/2) = 3/15
Get next date that's before next the entry (4/2) = 3/22
Get next date that's before next the entry (4/2) = 3/29
Next date >4/2 switch to next entry:
Loop:
Get next date that's after 4/2 and before the next entry (5/1 - every 20 days) = 4/22
Next date 5/12 is AFTER next entry 5/1, switch to next entry
Loop:
Get next date that's after 5/1 and before the lastdate (5/17 - weekly) = 5/8
Get next date that's before the lastdate = 5/15
Next date > 5/17
2009 年 3 月 5 日和 2008 年 5 月 17 日之间的日期为 3/8,3/15,3/22,3/29,4/22,5/8,5/15