from date cimport TDate, TDateInterval from cdsone cimport TStubMethod from curve cimport TCurve ctypedef int TBoolean cdef extern from "isda/cx.h": ctypedef struct TContingentLeg: pass ctypedef struct TFeeLeg: pass cdef extern from "isda/bastypes.h": ctypedef struct TCashFlow: TDate fDate double fAmount ctypedef struct TCashFlowList: int fNumItems TCashFlow *fArray cdef extern from "isda/cds.h": cdef TContingentLeg* JpmcdsCdsContingentLegMake( # Date when protection begins. Either at start or end of day (depends # on protectStart) TDate startDate, # Date when protection ends (end of day) TDate endDate, # Notional value protected double notional, # Should protection include the start date TBoolean protectStart) cdef TFeeLeg* JpmcdsCdsFeeLegMake( # Date when protection begins. Either at start or end of day (depends # on protectStart) TDate startDate, # Date when protection ends (end of day) TDate endDate, # 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, # If the startDate and endDate are not on cycle, then this parameter # determines location of coupon dates. TStubMethod *stubType, # Notional value protected double notional, # Fixed coupon rate (a.k.a. spread) for the fee leg double couponRate, # Day count convention for coupon payment. Normal is ACT_360 long paymentDcc, # 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, # Should protection include the start date */ TBoolean protectStart) cdef extern from "isda/contingentleg.h": cdef int JpmcdsContingentLegPV(TContingentLeg *cl, # Contingent leg TDate today, # No observations before today TDate valueDate, # Value date for discounting TDate stepinDate, # Step-in date TCurve *discountCurve, # Risk-free curve TCurve *spreadCurve, # Spread curve double recoveryRate, # Recovery rate double *pv) cdef extern from "isda/feeleg.h": cdef int JpmcdsFeeLegPV(TFeeLeg *fl, TDate today, TDate stepinDate, TDate valueDate, TCurve *discCurve, TCurve *spreadCurve, TBoolean payAccruedAtStart, double *pv) cdef TCashFlowList* JpmcdsFeeLegFlows(TFeeLeg *fl) cdef void JpmcdsFeeLegFree(TFeeLeg *p) cdef class ContingentLeg: cdef TContingentLeg* _thisptr cdef class FeeLeg: cdef TFeeLeg* _thisptr