diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2018-04-18 11:22:36 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2018-04-18 12:29:39 -0400 |
| commit | a99410b0ffcd2d3921afa01f5535d6eea3c434a2 (patch) | |
| tree | 8a4b6c7044dab5d1c55015da2e34176d25a8ed49 | |
| parent | 826c3a1fb61125a07afd73f90aa7c33e59a3ba65 (diff) | |
| download | pyisda-a99410b0ffcd2d3921afa01f5535d6eea3c434a2.tar.gz | |
add cds_accrued
| -rw-r--r-- | pyisda/date.pyx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pyisda/date.pyx b/pyisda/date.pyx index f858d1a..034a3e3 100644 --- a/pyisda/date.pyx +++ b/pyisda/date.pyx @@ -68,6 +68,11 @@ def previous_twentieth(d, bint roll=True): cdef TDate date = pydate_to_TDate(d) return TDate_to_pydate(_previous_twentieth(date, roll)) +@cython.cdivision(True) +def cds_accrued(d, double coupon): + cdef TDate date = pydate_to_TDate(d) + 1 + return (date - _previous_twentieth(date, True))/360. * coupon + cdef TMonthDayYear next_twentieth(TDate d) nogil: cdef TMonthDayYear mdy JpmcdsDateToMDY(d, &mdy) |
