[ quantlib-Bugs-2902185 ] date schedule is incorrect with EndOfMonth=true

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-2902185 ] date schedule is incorrect with EndOfMonth=true

SourceForge.net
Bugs item #2902185, was opened at 2009-11-22 23:06
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=2902185&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: boris l (blitvin)
>Assigned to: Luigi Ballabio (lballabio)
Summary: date schedule is incorrect with EndOfMonth=true

Initial Comment:
When date schedule is generated with Convention=Unadjusted and EndOfMonth=TRUE it incorrectly handles end of months. Please see attached spreadsheet as example. It also inocrrectly handles EOM with other conventions (MP,MF). I can be reached at [hidden email]. Thanks a lot - Boris.

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2009-12-21 13:15

Message:
The bug is now fixed in the Subversion repository.
Thank you for the report.


----------------------------------------------------------------------

Comment By: Kristofer Spinka (kspinka)
Date: 2009-12-19 04:41

Message:
I'm not sure how nobody else noticed this, this bug makes it impossible to
build simple pricing models that use US Treasuries.  Please apply this
patch and let me know how you make out:

--- ../../../Qorig/QuantLib-0.9.9/ql/time/schedule.cpp  2009-10-22
04:03:40.000000000 -0400
+++ schedule.cpp        2009-12-18 22:25:00.000000000 -0500
@@ -197,9 +197,6 @@
                 }
             }
 
-            if (endOfMonth && calendar.isEndOfMonth(seed))
-                convention=Preceding;
-
             if (calendar.adjust(dates_.front(),convention)!=
                 calendar.adjust(effectiveDate,convention)) {
                 dates_.insert(dates_.begin(), effectiveDate);
@@ -271,9 +268,6 @@
                 }
             }
 
-            if (endOfMonth && calendar.isEndOfMonth(seed))
-                convention=Preceding;
-
             if
(calendar.adjust(dates_.back(),terminationDateConvention)!=
               
calendar.adjust(terminationDate,terminationDateConvention)) {
                 if (rule_ == DateGeneration::Twentieth ||

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2009-12-07 17:43

Message:
Also, for additional safety: may you add to the spreadsheet the expected
correct dates for Unadjusted + EOM? (And possibly also for MP and MF, since
you're reporting that they're wrong too.)

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2009-12-07 17:33

Message:
Two suggestions: a quick fix might be to check for Unadjusted convention at
the end of the Schedule constructor (where it says "// adjustments") and
prevent adjustments from happening.
Another would be to check for EOM = true and adjust the behavior
explicitly.

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2009-12-07 17:07

Message:
Sorry, but since QuantLib is based on volunteer work these issues are
addressed when time allows.
Your best option is to examine the C++ source code (in
<ql/time/schedule.cpp>, see what's happening, and try to fix the logic.

----------------------------------------------------------------------

Comment By: boris l (blitvin)
Date: 2009-12-07 15:31

Message:
we are stuck with this problem in real deadline sensitive project. please
advise what my options are. thanks a lot in advance for expedient response.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=2902185&group_id=12740

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev