Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to build ActualActual with schedule #320

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions quantlib/time/daycounters/_actual_actual.pxd
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 4 additions & 2 deletions quantlib/time/daycounters/actual_actual.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):

Expand Down
Loading