From f82a99023034d828b1c0f8c1c57a7c9fa6d2f8e9 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 13 Dec 2018 17:10:03 -0500 Subject: fix absolute imports --- pyisda/credit_index.pxd | 6 +++--- pyisda/credit_index.pyx | 16 ++++++++-------- pyisda/optim.pyx | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pyisda/credit_index.pxd b/pyisda/credit_index.pxd index eb855a3..43c1eb5 100644 --- a/pyisda/credit_index.pxd +++ b/pyisda/credit_index.pxd @@ -1,6 +1,6 @@ -from legs cimport TContingentLeg, TFeeLeg -from date cimport TDate -from curve cimport TCurve, TRatePt, shared_ptr +from .legs cimport TContingentLeg, TFeeLeg +from .date cimport TDate +from .curve cimport TCurve, TRatePt, shared_ptr from libcpp.vector cimport vector from libcpp.map cimport map from libcpp.string cimport string diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 856e452..d87a198 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -9,15 +9,15 @@ from cpython cimport PyObject, Py_INCREF from cython.parallel cimport prange, parallel cimport cython -from legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, +from .legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, JpmcdsContingentLegPV, JpmcdsFeeLegPV, FeeLegAI, JpmcdsFeeLegFree) -from curve cimport (SpreadCurve, JpmcdsCopyCurve, tweak_curve, YieldCurve, +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, ACT_365F, JpmcdsDtFwdAny, TDateInterval, JpmcdsMakeDateInterval) -from cdsone cimport JpmcdsStringToStubMethod, TStubMethod -from date cimport ACT_365F +from .cdsone cimport JpmcdsStringToStubMethod, TStubMethod +from .date cimport ACT_365F cimport numpy as np np.import_array() import pandas as pd @@ -410,7 +410,7 @@ cdef class CreditIndex(CurveList): int i double carry if theta_date is None: - JpmcdsMakeDateInterval(-1, "Y", &ivl) + JpmcdsMakeDateInterval(-1, b"Y", &ivl) JpmcdsDtFwdAny(maturity_c, &ivl, &temp) carry = fixed_rate * 365 / 360 else: @@ -475,7 +475,7 @@ cdef class CreditIndex(CurveList): 1., 1.0, 3, # ACT_360 - 'M', # MODIFIED + b'M', # MODIFIED b'NONE', True) else: @@ -604,7 +604,7 @@ cdef pair[TContingentLeg_ptr, TFeeLeg_ptr] get_legs(TDate maturity, 1., 1.0, 3, # ACT_360 - 'M', # MODIFIED + b'M', # MODIFIED b'NONE', True) return r diff --git a/pyisda/optim.pyx b/pyisda/optim.pyx index 540a10b..a3a4143 100644 --- a/pyisda/optim.pyx +++ b/pyisda/optim.pyx @@ -2,11 +2,11 @@ from libc.stdlib cimport abort from libc.stdlib cimport free, malloc from libc.stdio cimport printf from libc.math cimport exp, sqrt -from cdsone cimport JpmcdsStringToStubMethod, TStubMethod -from curve cimport (TCurve, YieldCurve, JpmcdsFreeTCurve, JpmcdsNewTCurve, +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 legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, +from .date cimport TDate, pydate_to_TDate, ACT_360, ACT_365F +from .legs cimport (JpmcdsCdsContingentLegMake, JpmcdsCdsFeeLegMake, TContingentLeg, JpmcdsFeeLegPV, JpmcdsFeeLegFree, TFeeLeg) cimport cython @@ -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 - 'M', + b'M', b'NONE', 1) # protect_start = True params.stepinDate = step_in_date_c -- cgit v1.2.3-70-g09d2