summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2016-07-06 12:21:53 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2016-07-06 12:21:53 -0400
commit1990c15ff0bfeffd442d9be3c3d38df0dbb0b15d (patch)
tree1822ce8100b270da7b64df85d20489e61c66cdd3
parente61c2ea1409c9579f6a2020f382db480f58be538 (diff)
downloadpyisda-1990c15ff0bfeffd442d9be3c3d38df0dbb0b15d.tar.gz
fix indentation
-rw-r--r--curve.pyx31
1 files changed, 14 insertions, 17 deletions
diff --git a/curve.pyx b/curve.pyx
index b4b61ad..824c8ce 100644
--- a/curve.pyx
+++ b/curve.pyx
@@ -1,6 +1,6 @@
from libc.stdlib cimport malloc, free
from curve cimport (JpmcdsBuildIRZeroCurve, JpmcdsZeroPrice, JpmcdsMakeTCurve,
- Basis, CONTINUOUS)
+ Basis, CONTINUOUS, JpmcdsCleanSpreadCurve)
from date cimport (JpmcdsStringToDateInterval, pydate_to_TDate, dcc,
JpmcdsDateIntervalToFreq, JpmcdsDateFwdThenAdjust, TDate_to_pydate,
JpmcdsDateFromBusDaysOffset)
@@ -9,9 +9,6 @@ from cdsone cimport JpmcdsStringToStubMethod, TStubMethod
cdef int SUCCESS = 0
-cdef extern from "limits.h":
- long LONG_MAX
-
cpdef public enum BadDay:
FOLLOW = <long>'F'
PREVIOUS = <long>'P'
@@ -141,18 +138,18 @@ cdef class SpreadCurve(Curve):
<long>'M',
b'NONE')
- @classmethod
- def from_flat_hazard(cls, base_date, double rate, Basis basis = CONTINUOUS,
- str day_count_conv = 'Actual/365F'):
- cdef TDate base_date_c = pydate_to_TDate(base_date)
- cdef SpreadCurve sc = cls.__new__(cls)
- cdef TDate max_date = LONG_MAX
- cdef TDate* dates = <TDate*>malloc(sizeof(TDate))
+ @classmethod
+ def from_flat_hazard(cls, base_date, double rate, Basis basis = CONTINUOUS,
+ str day_count_conv = 'Actual/365F'):
+ cdef TDate base_date_c = pydate_to_TDate(base_date)
+ cdef SpreadCurve sc = cls.__new__(cls)
+ cdef TDate max_date = 200000 # can go higher but this should be more than enough
+ cdef TDate* dates = <TDate*>malloc(sizeof(TDate))
- cdef double* rates = <double*>malloc(sizeof(double))
- dates[0] = max_date
- rates[0] = rate
+ cdef double* rates = <double*>malloc(sizeof(double))
+ dates[0] = max_date
+ rates[0] = rate
- sc._thisptr = JpmcdsMakeTCurve(base_date_c, dates, rates, 1,
- <double>basis, dcc(day_count_conv))
- return sc
+ sc._thisptr = JpmcdsMakeTCurve(base_date_c, dates, rates, 1,
+ <double>basis, dcc(day_count_conv))
+ return sc