diff --git a/quantlib/time/daycounters/_actual_actual.pxd b/quantlib/time/daycounters/_actual_actual.pxd index 4c398a3d3..bd8afd1d1 100644 --- a/quantlib/time/daycounters/_actual_actual.pxd +++ b/quantlib/time/daycounters/_actual_actual.pxd @@ -1,9 +1,10 @@ from quantlib.time._daycounter cimport DayCounter +from quantlib.time._schedule cimport Schedule - -cdef extern from 'ql/time/daycounters/actualactual.hpp' namespace 'QuantLib': +cdef extern from 'ql/time/daycounters/actualactual.hpp' namespace 'QuantLib' nogil: cdef cppclass ActualActual(DayCounter): enum Convention: pass - ActualActual(Convention) + ActualActual(Convention c) + ActualActual(Convention c, const Schedule& schedule) diff --git a/quantlib/time/daycounters/actual_actual.pyx b/quantlib/time/daycounters/actual_actual.pyx index 80766ca84..92e5467ab 100644 --- a/quantlib/time/daycounters/actual_actual.pyx +++ b/quantlib/time/daycounters/actual_actual.pyx @@ -13,13 +13,15 @@ For more details, refer to https://www.isda.org/a/pIJEE/The-Actual-Actual-Day-Count-Fraction-1999.pdf ''' +from cython.operator cimport dereference as deref cimport quantlib.time._daycounter as _daycounter cimport quantlib.time.daycounters._actual_actual as _aa +from quantlib.time.schedule cimport Schedule from quantlib.time.daycounter cimport DayCounter cdef class ActualActual(DayCounter): - def __init__(self, Convention convention=Convention.ISDA): + def __init__(self, Convention convention=Convention.ISDA, Schedule schedule=Schedule.from_dates([])): """ Actual/Actual day count The day count can be calculated according to: @@ -35,7 +37,7 @@ cdef class ActualActual(DayCounter): https://www.isda.org/a/pIJEE/The-Actual-Actual-Day-Count-Fraction-1999.pdf """ self._thisptr = <_daycounter.DayCounter*> new \ - _aa.ActualActual(convention) + _aa.ActualActual(convention, deref(schedule._thisptr)) cdef _daycounter.DayCounter* from_name(str convention):