diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2019-02-24 17:08:08 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2019-02-24 17:08:08 -0500 |
| commit | b82e9ec45398d680baef09cd6694e9749308dba4 (patch) | |
| tree | 5c648e73ff839387064e06bd967c6b498458b670 | |
| parent | 1ba4c793531c551d5e3c5744c6307422c93162ce (diff) | |
| download | pyisda-b82e9ec45398d680baef09cd6694e9749308dba4.tar.gz | |
first try
| -rw-r--r-- | pyisda/curve.pxd | 15 | ||||
| -rw-r--r-- | pyisda/curve.pyx | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/pyisda/curve.pxd b/pyisda/curve.pxd index d996a68..05a5995 100644 --- a/pyisda/curve.pxd +++ b/pyisda/curve.pxd @@ -189,6 +189,14 @@ cdef extern from "isda/cxzerocurve.h" nogil: cdef double survival_prob(TCurve* curve, TDate start_date, TDate maturity_date, double eps) nogil cdef extern from "isda/cfinanci.h": + cdef enum Compounding: + CONTINUOUS "JPMCDS_CONTINUOUS_BASIS" + DISCOUNT_RATE "JPMCDS_DISCOUNT_RATE" + SIMPLE_RATE "JPMCDS_SIMPLE_RATE" + ANNUAL_BASIS "JPMCDS_ANNUAL_BASIS" + DISCOUNT_FACTOR "JPMCDS_DISCOUNT_FACTOR" + + int JpmcdsDiscountToRateYearFrac(double discount, # (I) Discount factor double yearFraction, # (I) See JpmcdsDayCountFraction double basis, # (I) Basis for the rate @@ -196,13 +204,6 @@ cdef extern from "isda/cfinanci.h": cdef extern from "isda/macros.h": cdef double JPMCDS_MAX_RATE -cdef enum Basis: - CONTINUOUS = 5000 - DISCOUNT_RATE = 512 - SIMPLE_BASIS = 0 - ANNUAL_BASIS = 1 - DISCOUNT_FACTOR = -2 - cdef extern from "<memory>" namespace "std" nogil: cdef cppclass shared_ptr[T]: ctypedef void (*D)(T*) diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 7c9a8f3..ade1de1 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -731,7 +731,7 @@ cdef class SpreadCurve(Curve): return r @classmethod - def from_flat_hazard(cls, base_date, double rate, Basis basis=CONTINUOUS, + def from_flat_hazard(cls, base_date, double rate, Compounding basis=CONTINUOUS, str day_count_conv='Actual/365F'): """ Alternative constructor for flat hazard rate Curve. |
