Hi Luigi and all,
I have a problem when trying to initialise a constructor in quantlib java using SWIG. Does anyone know if there is anything wrong with the Bond Settlement Date? P.S I have tried it using zerocouponbond, fixedratebond also, but it only works correctly if I set the issuedate to today's Date. long settlementdays = 2; Date issueDate = new Date(16,Month.May,2014); Date mat = issueDate.add(new Period(5,TimeUnit.Years)); Calendar cal = new Singapore(); double faceAmount = 100; Bond ql_bond = new Bond(settlementdays,cal,faceAmount,mat,issueDate); Bond ql_bond2 = new Bond(settlementdays,cal,faceAmount,mat,issueDate,myleg); System.out.println("Printing Bond information"); System.out.println("calendar: " + ql_bond.calendar()); System.out.println("issuedate: " + ql_bond.issueDate()); System.out.println("settlementdate: " + ql_bond.settlementDate()); System.out.println("maturity date: " + ql_bond.maturityDate()); Result: Printing Bond information calendar: Singapore exchange calendar issuedate: May 16th, 2014 settlementdate: July 8th, 2014 maturity date: May 16th, 2019 Thanks very much for replying, Cheers Benedict ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users bond error.PNG (54K) Download Attachment |
Hi Benedict,
by default the settlement date is not relative to the issue date, but to the evaluation date (which in turn defaults to today's date). If you want to evaluate the bond as if you were on the issue date, add the Java translation of the C++ statement Settings::instance().evaluationDate() = issueDate; before doing the calculation. Looking at the Java examples, it should be Settings.instance().setEvaluationDate(todaysDate); Luigi On Thu, Jul 3, 2014 at 7:12 PM, benedict 1 <[hidden email]> wrote: > Hi Luigi and all, > > I have a problem when trying to initialise a constructor in quantlib java > using SWIG. Does anyone know if there is anything wrong with the Bond > Settlement Date? > P.S I have tried it using zerocouponbond, fixedratebond also, but it only > works correctly if I set the issuedate to today's Date. > > > long settlementdays = 2; > Date issueDate = new Date(16,Month.May,2014); > Date mat = issueDate.add(new Period(5,TimeUnit.Years)); > Calendar cal = new Singapore(); > double faceAmount = 100; > > Bond ql_bond = new Bond(settlementdays,cal,faceAmount,mat,issueDate); > Bond ql_bond2 = new > Bond(settlementdays,cal,faceAmount,mat,issueDate,myleg); > > System.out.println("Printing Bond information"); > System.out.println("calendar: " + ql_bond.calendar()); > System.out.println("issuedate: " + ql_bond.issueDate()); > System.out.println("settlementdate: " + ql_bond.settlementDate()); > System.out.println("maturity date: " + ql_bond.maturityDate()); > > Result: > > Printing Bond information > calendar: Singapore exchange calendar > issuedate: May 16th, 2014 > settlementdate: July 8th, 2014 > maturity date: May 16th, 2019 > > Thanks very much for replying, > Cheers > Benedict > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |