Diagnosing Duplicate Curve Times with Actual/Actual Day Counts
Summary
The document explains why a zero curve built from continuous-rate data can fail when its dates are mapped to times using an Actual/Actual day-count convention. Curve interpolation requires distinct times, but the convention may assign the same year fraction to two different input dates, triggering an error. Changing compounding or frequency does not address this date-to-time collision.
To diagnose it, calculate the year fraction from the first curve date to each supplied date and check for repeated values. The response also cautions that Actual/Actual may be unsuitable as a curve time scale. If market rates are quoted using that convention, one alternative is to convert them to discount factors and construct a discount curve with a more regular day count. The note gives a troubleshooting method, but does not provide example dates or establish which convention is appropriate for every curve.
Key ideas
- Curve interpolation needs a distinct time value for each input date.
- Actual/Actual can map different dates to the same year fraction from the curve's initial date.
- Inspect calculated year fractions to identify the dates causing a duplicate time.
- Changing compounding or payment frequency does not resolve a collision caused by date conversion.
- Converting rates to discount factors can allow use of a discount curve with a regular day count.
Tags
Full text
# Help plz - Quantlib daycount ql.ActualActual() error
# Help plz - Quantlib daycount ql.ActualActual() error
Hi I am trying to create a zero curve from continuous rates data. I keep getting an error "RuntimeError: two dates correspond to the same time under this curve's day count convention". What am I doing wrong? Identical function but replacing the daycount with ql.Thirty360 works fine. I also tried replacing compounding and frequency input with ql.Continuous and ql.NoFrequency but it didn't make any difference. Thanks in advance for any help!
## Answer by Luigi Ballabio (score 4)
https://quant.stackexchange.com/a/73913
In short: the passed dates are converted into times, and the times are used to interpolate the passed rates. The conversion is done by taking the first passed date as `t=0`, and by assigning to each further date `d` the time `t = dayCounter.yearFraction(dates[0], d)`.
What is happening is that the act/act day counter calculates the same time for two different dates, and the code doesn't know how to build the interpolation in this case. As Dimitri said, the error message is not helpful; but you can find the relevant dates by running something like:
```
day_count = ql.ActualActual(ActualActual.ISMA)
for d in spotDates:
print(d, day_count.yearFraction(spotDates[0], d))
```
and looking for identical times.
However, note that using a day counter like Act/Act for a curve is not great; see the video at https://www.youtube.com/watch?v=dQjd3hAshj4 for more info. If the rates you have available are indeed using the act/act convention, you might be better off converting them into discount factors and using the `DiscountCurve` class instead with a more regular day count.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.