|
From: <s.i...@gm...> - 2009-09-25 11:46:52
|
Hi folks, I've been looking at the QuantLib constructors and have a feeling that something better could be done regarding periods. Lots of the constructors have elements that ask for "number of days" or "day offset", then date rule and holiday calendar - sometimes for several different days - that it becomes confusing. For bonds (which I've helped in developing) the rules for ex-div days are complicated. Also, for FX the rules for determining the spot date from today's date or the expiry date from the settlement date can be exceedingly complicated. Why don't we have a DateOffset class (a base class) that can act as this function? So, when we need to obtain one date from another, we simply apply the DateOffset (which can contain a holiday calendar / many holiday calendars) to the initial date and obtain the relevant date - without needing to know what those rules are. These DateOffset objects could then be obtained from a relevant market (such as the LiborIndex objects we already have) and applied to a given instrument. This would be particularly useful for interest-rate and FX markets. For equity / credit markets (where there are a huge number of underlyings) this information would have to be derived externally to QuantLib - but the interfaces would be much cleaner. In other words, we decouple the market conventions from the instruments that are traded on those markets. I know that this would be a major project to apply throughout QuantLib, but that's no reason not to create this functionality and to encourage its use in new developments / changes. Thoughts please? Cheers, Simon Sent from my BlackBerry® wireless device |