我使用QuantLib 1.7.1並嘗試運行這些代碼:QuantLib返回付款時間表與日期之外的日期?
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;
我希望得到一個進度表,其下限和上限是30/9/2009和15/6/2012分別是這樣的:
September 30th, 2009
March 31st, 2010
September 30th, 2010
March 31st, 2011
September 30th, 2011
March 30th, 2012
June 15th, 2012
但我得到的結果,其中最後付款日期是29/6/2012,這是後結合我設置:
September 30th, 2009
March 31st, 2010
September 30th, 2010
March 31st, 2011
September 30th, 2011
March 30th, 2012
June 29th, 2012
如果我設置DateGeneration規則落後,它將如預期(下界時間表30/9/2009):
September 30th, 2009
December 15th, 2009
June 15th, 2010
December 15th, 2010
June 15th, 2011
December 15th, 2011
June 15th, 2012
難道QuantLib給外面的結果在第一種情況下必然會有意或這是一個錯誤?
Schedule類的文檔在哪裏?我做了一個快速的谷歌搜索,我發現的只是實現代碼。 –
我從quantlib網站[link](http://quantlib.org/slides/dima-ql-intro-1.pdf)的這張幻燈片(第36頁)中看到它。有趣的是,在幻燈片中,它給出了正確的結果 –
如果使用Backward而下限是9月20日而不是9月30日會怎樣? –