Skip to content
All library documents

Matching Bond Pricing Conventions in QuantLib

Article Quant Q&A · Author: Robert Taylor

Summary

The document presents a fixed-rate bond pricing discrepancy: QuantLib returns a price just below par when the stated coupon and yield are equal, while spreadsheet and market tools reportedly return par. The accepted response supplies a matching setup using a semiannual schedule, an Actual/Actual ISMA day-count convention, and specified date-generation and business-day rules. With those inputs, the response reports a clean price of par in QuantLib.

The exchange points to convention mismatches as a likely source of small pricing differences. It does not identify which setting caused the original discrepancy, since the asker’s full code and exact conventions are not shown. It also leaves the choice between simple and compounded yield conventions uncertain, noting that it appears immaterial in this case. The example is therefore a practical diagnostic for aligning schedules and day-count conventions, not a general explanation of all fixed-rate bond valuation differences.

Key ideas

  • Small bond price discrepancies can arise from mismatched schedules and day-count conventions.
  • The example uses a semiannual schedule and Actual/Actual ISMA day count.
  • Matching the response's inputs produces a clean price at par in the reported case.
  • The original cause remains uncertain because the asker's complete implementation is absent.
  • The exchange does not establish which yield compounding convention is generally appropriate.

Tags

Full text
# Basic fixed rate bond pricing issue in Quantlib


# Basic fixed rate bond pricing issue in Quantlib












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!

## Answer by Luigi Ballabio (score 5, accepted)

https://quant.stackexchange.com/a/44319

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?

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.