summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2017-02-08 11:01:55 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2017-02-08 11:01:55 -0500
commitf95331004542b4ca2673cdf02cf32beb1c73063c (patch)
tree3855072520f9b45d07c80ff2612d92ee4bb7c3aa
parent6e275360fd0e59880b69d72f4b9b5fef8893230e (diff)
downloadpyisda-f95331004542b4ca2673cdf02cf32beb1c73063c.tar.gz
small speedup
-rw-r--r--pyisda/curve.pyx11
1 files changed, 6 insertions, 5 deletions
diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx
index de64437..57f7ecd 100644
--- a/pyisda/curve.pyx
+++ b/pyisda/curve.pyx
@@ -47,7 +47,7 @@ cdef class Curve(object):
contains `base_date`, `basis`, `day_count_counvention` and `data`
"""
- return {'base_date': TDate_to_pydate(self._thisptr.fBaseDate),
+ return {'base_date': self.base_date,
'basis': self._thisptr.fBasis,
'day_count_convention': dcc_tostring(self._thisptr.fDayCountConv),
'data': fArray_to_list(self._thisptr.fArray, self._thisptr.fNumItems)}
@@ -252,7 +252,8 @@ cdef class SpreadCurve(Curve):
Default to True
"""
-
+ @cython.boundscheck(False)
+ @cython.wraparound(False)
def __init__(self, today, YieldCurve yc, start_date, step_in_date,
cash_settle_date, list end_dates,
double[:] coupon_rates, double[:] upfront_rates,
@@ -266,9 +267,9 @@ cdef class SpreadCurve(Curve):
cdef TDate* end_dates_c = <TDate*>malloc(n_dates * sizeof(TDate))
self._thisptr = NULL
cdef size_t i
- if cash_settle_date < yc.inspect()['base_date']:
+ if cash_settle_date_c < yc._thisptr.fBaseDate:
raise ValueError("cash_settle_date: {0} is anterior to yc's base_date: {1}".
- format(cash_settle_date, yc.inspect()['base_date']))
+ format(cash_settle_date, yc.base_date))
for i, d in enumerate(end_dates):
end_dates_c[i] = pydate_to_TDate(d)
@@ -277,7 +278,7 @@ cdef class SpreadCurve(Curve):
raise ValueError("can't convert stub")
cdef long dc
JpmcdsStringToDayCountConv('ACT/360', &dc)
- with nogil, cython.boundscheck(False):
+ with nogil:
self._thisptr = JpmcdsCleanSpreadCurve(today_c,
yc._thisptr,
start_date_c,