|
From: Simon I. <s.i...@gm...> - 2008-09-02 10:11:49
|
Hi folks, I've been looking around in QuantLib and cannot find a generic DateOffset class. At present - when calculating the spot date, ex-div date or even just the next date in a sequence - there are many different ways of doing this. 1) Use a Calendar, a Period and a BusinessDayConvention. 2) Use a Calendar and a fixed number of business days. 3) Use a fixed number of calendar days. 4) Use a specified Date. I know that (2) and (3) can be replicated in (1), but there is a proliferation of interfaces already in QuantLib. For instance, the parameter "Natural settlementDays" is common, as is "Date settlementDate". Also, what if the rules to create a date are not predictable... I'm particularly referring to calculating the spot date (particularly for FX, where the conventions are complex) or the ex-dividend date. In addition, there are complex rules for calculating stub periods. E.g. For an annual period: "Long last stub, if it doesn't exceed 18 months else short stub". In the current setup, the instrument needs to know the rules for calculating these dates - rather than delegating them to a specific class. Why isn't there a generic (base?) class for this type of functionality? I'm guessing there is a reason, but it isn't obvious. Cheers, Simon |