3
$\begingroup$

Need some help on following items regarding functions in Qunatlib:

  1. Is there any function available to calculate time between two dates with specific day count convention. For Example, I want to know time between D1 and D2 using 30/360, Act/360, etc day count convention.
  2. Can we know previous and next coupon dates for bonds on particular date using schedule or some other function in Quantlib. I see schedule provides all cash flow dates but need something which gives previous and next cash flow dates.
$\endgroup$
3
$\begingroup$
  1. Yes. You can write, for instance, Actual360().yearFraction(d1,d2). Look for the DayCounter class at http://quantlib.org/reference for docs and the list of the supported day-count conventions.

  2. You can use the CashFlows::previousCashFlowDate and CashFlows::nextCashFlowDate methods. Again, see the link above for details.

$\endgroup$
  • $\begingroup$ How can 2 be implemented in python? Sorry but weak with that conversion. $\endgroup$ – BHr Feb 8 '18 at 10:37
  • $\begingroup$ Sorry, those methods are not exported to Python. You can request them by opening an issue at github.com/lballabio/QuantLib-SWIG/issues. $\endgroup$ – Luigi Ballabio Feb 8 '18 at 14:11
  • $\begingroup$ Thanks for your response...created github.com/lballabio/QuantLib-SWIG/issues/100 $\endgroup$ – BHr Feb 8 '18 at 15:45
  • $\begingroup$ On closer look there is one more variant of above functions qlSchedulePreviousDate and qlScheduleNextDate. I guess these methods are also not exported to Python? $\endgroup$ – BHr Feb 8 '18 at 15:50
  • $\begingroup$ Right. You can add them to the issue. $\endgroup$ – Luigi Ballabio Feb 9 '18 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.