0
$\begingroup$

I'm trying to price a fixed rate bond in Quantlib but the result comes out wrong.

I'm trying to price 1Y fixed rate bond:

issue_date= 06-03-2008
maturity_date = 06-03-2009
settlement_days=0
payment_frequency=semi-annual
day_count = ACT/ACT
coupon=0.02
yield=0.02
face_value=100
compounding=simple
business_day_convention=Following

I expect 100, however QL returns 99.99989509825711.

Both Bloomberg and Excel return 100, as does my manual calculation. Thanks!

$\endgroup$

1 Answer 1

5
$\begingroup$

This is how I would price the bond in Python with your inputs. You can translate it easily to C++ if that's what you're using.

from QuantLib import *

Settings.instance().evaluationDate = Date(6,3,2008)

schedule = Schedule(Date(6,3,2008), Date(6,3,2009), Period(6,Months),
                    NullCalendar(), Following, Following,
                    DateGeneration.Forward, False)

bond = FixedRateBond(0, 100.0, schedule, [0.02], ActualActual(ActualActual.ISMA))

print(bond.cleanPrice(0.02, ActualActual(ActualActual.ISMA), Simple, Semiannual))

and the result is 100 as expected (by the way, I'm not sure whether you should use Simple or Compounded as compounding, but it doesn't seem to make a difference in this case). I'm using the latest QuantLib version, 1.15.

Are you using the same code? If not, what is different?

$\endgroup$
1
  • 1
    $\begingroup$ Thank you that's super helpful, we were not using NullCalendar which seems to be causing the issue! $\endgroup$ Feb 28, 2019 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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