[QL 0.9.7] DateGeneration ThirdWednesday rule issues

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[QL 0.9.7] DateGeneration ThirdWednesday rule issues

radupaul
QL: 0.9.6/0.9.7

Hi:

Apparently there are some problems (?) when using a Schedule with the DateGeneration::ThirdWednesday rule (e.g. for an IMM swap, use Unadjusted for all conventions, some arbitrary effective start date, End-of-Month=False) -  we would appreciate developer/user comments if this is the desired behavior and/or other Quantlib sections are impacted (doesn't seem so though...):

- when the termination date is an IMM date it is inserted twice in the schedule.
- when a NextToLastDate that is an IMM date is used, it is possible to be skipped if the first date occurs on date with its day part > the next to last day part (e.g. firstDate=20090916 and nextToLastDate=20110615, with termination=20110921), then the generated schedule is:
{start date, 20090916, ..., March 2011 IMM date, Sep 2011 IMM Date} (no June 2011 IMM)

In the Schedule.cpp code, the calendar advances with the required number of months and the adjustment to IMM dates is done after all dates are filled - this explains the skipping of NextToLastDate - I could not track why the duplicated TerminationDate.

Anyway, we've attached the proposed solution (only the relevant sections in Schedule.cpp), essentially adding a "break" in a SWITCH statement (case DateGeneration::ThirdWednesday) and adjusting to IMM dates after each calendar advance -

Thanks, Adel/Radu


corrected_schedule.cpp
Reply | Threaded
Open this post in threaded view
|

Re: [QL 0.9.7] DateGeneration ThirdWednesday rule issues

Luigi Ballabio
On Wed, 2009-07-08 at 14:19 -0700, radupaul wrote:
> Apparently there are some problems (?) when using a Schedule with the
> DateGeneration::ThirdWednesday rule
>
> Anyway, we've attached the proposed solution (only the relevant sections in
> Schedule.cpp), essentially adding a "break" in a SWITCH statement (case
> DateGeneration::ThirdWednesday) and adjusting to IMM dates after each
> calendar advance

Radu,
        apologies for the delay--I was on vacation.
Thanks for the patch.  Would it be possible for you to write a couple of
test cases as well to show the correct behavior?

Later,
        Luigi

--

To err is human -- to blame it on a computer is even more so.
-- unknown



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users