from cdsone cimport TStubMethod cdef extern from "isda/zerocurve.h": ctypedef int TBoolean ctypedef long int TDate ctypedef struct TDateInterval: pass TCurve* JpmcdsBuildIRZeroCurve(TDate valueDate, char* instrNames, TDate* dates, double* rates, long nInstr, long mmDCC, long fixedSwapFreq, long floatSwapFreq, long fixedSwapDCC, long floatSwapDCC, long badDayConv, char* holidayFile) cdef extern from "isda/bastypes.h": ctypedef struct TCurve: int fNumItems TRatePt* fArray TDate fBaseDate double fBasis long fDayCountConv ctypedef struct TRatePt: TDate fDate double fRate cdef extern from "isda/cds.h": TCurve* JpmcdsCleanSpreadCurve( # Risk starts at the end of today TDate today, # Interest rate discount curve - assumes flat forward interpolation TCurve *discCurve, # Effective date of the benchmark CDS TDate startDate, # Step in date of the benchmark CDS TDate stepinDate, # Date when payment should be make TDate cashSettleDate, # Number of benchmark dates long nbDate, # Dates when protection ends for each benchmark (end of day). # Array of size nbDate TDate *endDates, # Coupon rates for each benchmark instrument. Array of size nbDate double *couponRates, # Flags to denote that we include particular benchmarks. This makes it # easy for the user to include or exclude benchmarks on a one-by-one # basis. Can be NULL if all are included. Otherwise an array of size # nbDate. TBoolean *includes, # Recovery rate in case of default double recoveryRate, # Should accrued interest be paid on default. Usually set to TRUE TBoolean payAccOnDefault, # Interval between coupon payments. Can be NULL when 3M is assumed TDateInterval *couponInterval, # Day count convention for coupon payment. Normal is ACT_360 long paymentDcc, # If the startDate and endDate are not on cycle, then this parameter # determines location of coupon dates. */ TStubMethod *stubType, # Bad day convention for adjusting coupon payment dates. */ long badDayConv, # Calendar used when adjusting coupon dates. Can be NULL which equals # a calendar with no holidays and including weekends. */ char *calendar ) cdef extern from "isda/tcurve.h": void JpmcdsFreeTCurve(TCurve* curve) TCurve* JpmcdsMakeTCurve(TDate baseDate, TDate *dates, double *rates, int numPts, double basis, long dayCountConv); cdef extern from "isda/cxzerocurve.h": double JpmcdsZeroPrice(TCurve* curve, TDate date) cdef enum Basis: CONTINUOUS = 5000 DISCOUNT_RATE = 512 SIMPLE_BASIS = 0 ANNUAL_BASIS = 1 DISCOUNT_FACTOR = -2 cdef class Curve: cdef TCurve* _thisptr cdef class ZeroCurve(Curve): cdef TDate* _dates cdef size_t _ninstr cdef class SpreadCurve(Curve): pass cdef fArray_to_list(TRatePt* fArray, int fNumItems)