|
From: Simon C. <cou...@gm...> - 2017-10-29 09:47:38
|
Hi all, I was reading Dimitri Reiswich's slides on Quantlib (found at http://quantlib.org/slides/dima-ql-intro-1.pdf), and in particular, the slides about the Schedule class. On slide 36, there is some example code to show how to construct a Schedule. This code is below: Date begin(30,September ,2009) , end(15,Jun ,2012); Calendar myCal=Japan (); BusinessDayConvention bdC=BusinessDayConvention(Following ); Period myTenor(6,Months ); DateGeneration ::Rule myRule=DateGeneration :: Forward; Schedule mySched(begin ,end ,myTenor ,myCal ,bdC ,bdC ,myRule ,true); std::vector <Date > finalSched=mySched.dates (); BOOST_FOREACH(Date d,finalSched) std::cout << d << std::endl; On slide 37 is its example output, which is: September 30th, 2009 March 31st, 2010 September 30th, 2010 March 31st, 2011 September 30th, 2011 March 30th, 2012 June 15th, 2012 When I compiled and ran this code myself, I got June 15th, 2012 September 30th, 2009 March 31st, 2010 September 30th, 2010 March 31st, 2011 September 30th, 2011 March 30th, 2012 June 29th, 2012 The difference being the last date - Jun 29th instead of Jun 15th. The last date is later than the termination date provided in the constructor call. My question is which behaviour is expected and correct? June 15th (as in Dimitri's slides) or June 29th, the actual result? If Dimitri's version is correct, then I suspect that this code after the case statements for date calculation in the Schedule constructor (dealing with effective dates) will need to change, since its the code responsible for changing June 15th t June 29th in the example above. if (terminationDateConvention != Unadjusted) { dates_.front() = calendar_.endOfMonth(dates_.front()); dates_.back() = calendar_.endOfMonth(dates_.back()); } I'm compiling against the latest QL code cloned from github yesterday. Thanks Simon |