diff options
Diffstat (limited to 'legs.pxd')
| -rw-r--r-- | legs.pxd | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/legs.pxd b/legs.pxd new file mode 100644 index 0000000..0b1ded3 --- /dev/null +++ b/legs.pxd @@ -0,0 +1,94 @@ +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 |
