summaryrefslogtreecommitdiffstats
path: root/curve.pxd
blob: b365b5aaa3505480029c00b3abdff5ff7b583414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from cdsone cimport TStubMethod

cdef extern from "isda/zerocurve.h":
    ctypedef int TBoolean

    ctypedef long int TDate

    ctypedef struct TCurve:
        pass

    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/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)

cdef extern from "isda/cxzerocurve.h":
    double JpmcdsZeroPrice(TCurve* curve, TDate date)

cdef class Curve:
    cdef TCurve* _thisptr

cdef class ZeroCurve(Curve):
    cdef TDate* _dates
    cdef size_t _ninstr

cdef class SpreadCurve(Curve):
    pass