From f0f20dc815510bf95f850b9a8733d2e09049f748 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Wed, 27 Feb 2019 10:35:17 -0500 Subject: use enum values --- pyisda/credit_index.pyx | 12 ++++++------ pyisda/curve.pyx | 6 +++--- pyisda/legs.pyx | 4 ++-- pyisda/optim.pyx | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 8d2bf34..a7ddd79 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -14,10 +14,10 @@ from .legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, from .curve cimport (SpreadCurve, JpmcdsCopyCurve, tweak_curve, YieldCurve, JpmcdsFreeTCurve, survival_prob, Hash64WithSeed, Hash64, uint64_t, TCurve_size, serialize) -from .date cimport (pydate_to_TDate, TDate_to_pydate, ACT_365F, JpmcdsDtFwdAny, +from .date cimport (pydate_to_TDate, TDate_to_pydate, JpmcdsDtFwdAny, TDateInterval, JpmcdsMakeDateInterval) from .cdsone cimport JpmcdsStringToStubMethod, TStubMethod -from .date cimport ACT_365F +from .date cimport ACT_365F, ACT_360, MODIFIED cimport numpy as np np.import_array() import pandas as pd @@ -503,8 +503,8 @@ cdef class CreditIndex(CurveList): &stub_type, 1., 1.0, - 3, # ACT_360 - b'M', # MODIFIED + ACT_360, # ACT_360 + MODIFIED, # MODIFIED b'NONE', True) else: @@ -632,8 +632,8 @@ cdef pair[TContingentLeg_ptr, TFeeLeg_ptr] get_legs(TDate maturity, &stub_type, 1., 1.0, - 3, # ACT_360 - b'M', # MODIFIED + ACT_360, # ACT_360 + MODIFIED, # MODIFIED b'NONE', True) return r diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 7c9a8f3..08d0c77 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -588,7 +588,7 @@ cdef class SpreadCurve(Curve): NULL, ACT_360, &stub_type, - b'M', + MODIFIED, b'NONE') else: rates = vector[double](n_dates, JPMCDS_MAX_RATE) @@ -596,7 +596,7 @@ cdef class SpreadCurve(Curve): end_dates_c, rates.data(), n_dates, - 5000., + CONTINUOUS, ACT_360) if curve is not NULL: if fill_curve and curve.fNumItems != n_dates: @@ -832,7 +832,7 @@ cdef class SpreadCurve(Curve): NULL, &stub_type, ACT_360, - b'M', + MODIFIED, b'NONE', yc._thisptr.get(), self._thisptr.get(), diff --git a/pyisda/legs.pyx b/pyisda/legs.pyx index 8a6d1e7..1b5a7f1 100644 --- a/pyisda/legs.pyx +++ b/pyisda/legs.pyx @@ -1,6 +1,6 @@ from libc.stdlib cimport free from .date cimport pydate_to_TDate, TDate_to_pydate, dcc -from .date import dcc_tostring +from .date import dcc_tostring, MODIFIED from .cdsone cimport JpmcdsStringToStubMethod, TStubMethod from .curve cimport YieldCurve, SpreadCurve @@ -113,7 +113,7 @@ cdef class FeeLeg: notional, coupon_rate, dcc(payment_dcc), - b'M', + MODIFIED, b'NONE', protect_start) if self._thisptr is NULL: diff --git a/pyisda/optim.pyx b/pyisda/optim.pyx index b82a0d9..0004996 100644 --- a/pyisda/optim.pyx +++ b/pyisda/optim.pyx @@ -5,7 +5,7 @@ from libc.math cimport exp, sqrt from .cdsone cimport JpmcdsStringToStubMethod, TStubMethod from .curve cimport (TCurve, YieldCurve, JpmcdsFreeTCurve, JpmcdsNewTCurve, CONTINUOUS) -from .date cimport TDate, pydate_to_TDate, ACT_360, ACT_365F +from .date cimport TDate, pydate_to_TDate, ACT_360, ACT_365F, MODIFIED from .legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, TContingentLeg, JpmcdsFeeLegPV, JpmcdsFeeLegFree, TFeeLeg) @@ -88,7 +88,7 @@ def init_context(YieldCurve yc not None, trade_date, value_date, start_date, 1., # notional 1., # coupon_rate ACT_360, # JPMCDS_ACT_360 - b'M', + MODIFIED, b'NONE', 1) # protect_start = True params.stepinDate = step_in_date_c -- cgit v1.2.3-70-g09d2