Bugs item #3404882, was opened at 2011-09-06 14:03
Message generated for change (Comment added) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3404882&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: Invalid Priority: 5 Private: No Submitted By: Lorenzo Pitotti (lpitotti) Assigned to: Nobody/Anonymous (nobody) Summary: Problem with Act/Act (ISDA) convention Initial Comment: The implementation Act/Act (ISDA) day count convention seems to be wrong as it calculates the number of days w.r.t 1st January rather than 31st December. (cf. http://www.isda.org/c_and_a/pdf/ACT-ACT-ISDA-1999.pdf) Specifically we should replace (actualactual.cpp, Ln 156): sum += dayCount(d1, Date(1,January,y1+1))/dib1; sum += dayCount(Date(1,January,y2),d2)/dib2; with sum += dayCount(d1, Date(31,December,y1))/dib1; sum += dayCount(Date(31,December,y2-1),d2)/dib2; ---------------------------------------------------------------------- >Comment By: Luigi Ballabio (lballabio) Date: 2011-09-08 15:35 Message: dayCount(d1,d2) returns d2-d1, so if you want the number of days left in the year you'll have to use d2=1st January as in the code you quote. The current implementation reproduces correctly all examples in the ISDA document you link; here is the output of a Python session on my box: >>> from QuantLib import * >>> isda = ActualActual(ActualActual.ISDA) example (a) >>> 10000 * 0.1 * isda.yearFraction(Date(1,11,2003),Date(1,5,2004)) 497.72438056740776 example (b) >>> 10000 * 0.1 * isda.yearFraction(Date(1,2,1999),Date(1,7,1999)) 410.958904109589 >>> 10000 * 0.1 * isda.yearFraction(Date(1,7,1999),Date(1,7,2000)) 1001.3773486039374 example (c) >>> 10000 * 0.1 * isda.yearFraction(Date(15,8,2002),Date(15,7,2003)) 915.068493150685 >>> 10000 * 0.1 * isda.yearFraction(Date(15,7,2003),Date(15,1,2004)) 504.0047907777528 example (d) >>> 10000 * 0.1 * isda.yearFraction(Date(30,7,1999),Date(30,1,2000)) 503.89250692417096 >>> 10000 * 0.1 * isda.yearFraction(Date(30,1,2000),Date(30,6,2000)) 415.30054644808746 example (e) >>> 10000 * 0.1 * isda.yearFraction(Date(30,11,1999),Date(30,4,2000)) 415.54008533572875 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3404882&group_id=12740 ------------------------------------------------------------------------------ Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |