Skip to content
All library documents

Actual/Actual ISMA Year Fractions and Reference Dates in QuantLib

Article Quant Q&A · Author: Barahir

Summary

The document describes a QuantLib issue involving Actual/Actual ISMA day counts for bond periods. The questioner calculates year fractions from a valuation date to an intermediate coupon date and to maturity, then reports that moving the valuation date by one day does not change the results. The code also adds two separately calculated fractions and compares that total with a direct calculation.

The answer says that the ISMA variant requires reference start and end dates to be supplied to the year-fraction method, and reports that doing so produced different results. This highlights that Actual/Actual ISMA calculations depend on the coupon reference period, not only on the two dates being measured. The brief exchange offers no detailed explanation of the convention or a complete corrected example, so it serves as a focused implementation pointer rather than a full guide to bond day-count calculations.

Key ideas

  • Actual/Actual ISMA year fractions depend on the coupon reference period.
  • The valuation and maturity dates alone may not provide enough context for the calculation.
  • The answer recommends supplying reference start and end dates to the year-fraction method.
  • Adding separate period fractions and calculating one interval directly are distinct operations to compare carefully.
  • The discussion does not give a full explanation of the convention or a complete example.

Tags

Full text
# Python Quanlib : yearFraction returns same number when I change the valuation date


# Python Quanlib : yearFraction returns same number when I change the valuation date












I am completely new to python/coding so apologies in advance if the question is too basic but I could not find the answer elsewhere.

I am trying to calculate the daycount fraction from the settlement date to the end of the ith period using a bond’s daycount convention

Please see the code below. When changing the valuation_date 1 day forward for example, then the results stay the same.

Someone suggested that "bond day counts consider fractions of a year as opposed to multi-year stretches" hence thats why I have t=t1+t2

Many thanks!!

```
from QuantLib import *
issue_date = Date(3, 7, 2019)
valuation_date = Date(8, 12, 2022)
Settings.instance().evaluationDate = valuation_date
maturity_date = Date(3, 7, 2024)

t1 = ActualActual(ActualActual.ISMA).yearFraction(valuation_date, Date(3, 7, 2023))
t2 = ActualActual(ActualActual.ISMA).yearFraction(Date(3, 7, 2023), maturity_date)
t3 = ActualActual(ActualActual.ISMA).yearFraction(valuation_date, maturity_date)

t = t1 + t2
print(t)
print(t1)
print(t3)
```
```

## Answer by Barahir (score 1)

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

After looking a bit further at the DayCounter class at http://quantlib.org/reference and to further websites I found that for the ISMA variant of the Actual/Actual day counter I have to specify the "Date &refDateStart and Date &refDateEnd" in the yearFraction method in my code. I think that does the trick as the I arrive to different results

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.