#include "cx.h"
Functions | |
TContingentLeg * | JpmcdsCdsContingentLegMake (TDate startDate, TDate endDate, double notional, TBoolean protectStart) |
Makes a contingent leg for a vanilla CDS. | |
int | JpmcdsCdsContingentLegPV (TDate today, TDate valueDate, TDate startDate, TDate endDate, double notional, TCurve *discCurve, TCurve *spreadCurve, double recoveryRate, TBoolean protectStart, double *pv) |
Computes the PV for a contingent leg for a vanilla CDS. | |
TFeeLeg * | JpmcdsCdsFeeLegMake (TDate startDate, TDate endDate, TBoolean payAccOnDefault, TDateInterval *couponInterval, TStubMethod *stubType, double notional, double couponRate, long paymentDcc, long badDayConv, char *calendar, TBoolean protectStart) |
Makes a fixed fee leg for a vanilla CDS. | |
int | JpmcdsCdsFeeLegPV (TDate today, TDate valueDate, TDate stepinDate, TDate startDate, TDate endDate, TBoolean payAccOnDefault, TDateInterval *couponInterval, TStubMethod *stubType, double notional, double couponRate, long paymentDcc, long badDayConv, char *calendar, TCurve *discCurve, TCurve *spreadCurve, TBoolean protectStart, TBoolean isPriceClean, double *pv) |
Computes the PV for a fixed fee leg for a vanilla CDS. | |
EXPORT int | JpmcdsCdsPrice (TDate today, TDate valueDate, TDate stepinDate, TDate startDate, TDate endDate, double couponRate, TBoolean payAccOnDefault, TDateInterval *couponInterval, TStubMethod *stubType, long paymentDcc, long badDayConv, char *calendar, TCurve *discCurve, TCurve *spreadCurve, double recoveryRate, TBoolean isPriceClean, double *price) |
Computes the price (a.k.a. upfront charge) for a vanilla CDS. | |
EXPORT int | JpmcdsCdsParSpreads (TDate today, TDate stepinDate, TDate startDate, long nbEndDates, TDate *endDates, TBoolean payAccOnDefault, TDateInterval *couponInterval, TStubMethod *stubType, long paymentDcc, long badDayConv, char *calendar, TCurve *discCurve, TCurve *spreadCurve, double recoveryRate, double *parSpread) |
Computes the benchmark par spreads. | |
EXPORT TCashFlowList * | JpmcdsCdsFeeLegFlows (TDate startDate, TDate endDate, TDateInterval *dateInterval, TStubMethod *stubType, double notional, double couponRate, long paymentDcc, long badDayConv, char *calendar) |
Computes the non-contingent cash flows for a fee leg. | |
EXPORT TCurve * | JpmcdsCleanSpreadCurve (TDate today, TCurve *discCurve, TDate startDate, TDate stepinDate, TDate cashSettleDate, long nbDate, TDate *endDates, double *couponRates, TBoolean *includes, double recoveryRate, TBoolean payAccOnDefault, TDateInterval *couponInterval, long paymentDcc, TStubMethod *stubType, long badDayConv, char *calendar) |
Bootstraps a clean spread curve from par spread inputs. |
TContingentLeg* JpmcdsCdsContingentLegMake | ( | TDate | startDate, | |
TDate | endDate, | |||
double | notional, | |||
TBoolean | protectStart | |||
) |
Makes a contingent leg for a vanilla CDS.
The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is only protected if protectStart=True.
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends (end of day) | |
notional | Notional value protected | |
protectStart | Should protection include the start date |
int JpmcdsCdsContingentLegPV | ( | TDate | today, | |
TDate | valueDate, | |||
TDate | startDate, | |||
TDate | endDate, | |||
double | notional, | |||
TCurve * | discCurve, | |||
TCurve * | spreadCurve, | |||
double | recoveryRate, | |||
TBoolean | protectStart, | |||
double * | pv | |||
) |
Computes the PV for a contingent leg for a vanilla CDS.
Risk starts at the end of today. The PV is computed for a given value date. The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is only protected if protectStart=True.
today | Risk starts at the end of today | |
valueDate | Date for which the PV is calculated and cash settled | |
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends (end of day) | |
notional | Notional value protected | |
discCurve | Interest rate discount curve - assumes flat forward interpolation | |
spreadCurve | Credit clean spread curve | |
recoveryRate | Assumed recovery rate in case of default | |
protectStart | True => protection includes start date | |
pv | Output - the present value is returned |
EXPORT TCashFlowList* JpmcdsCdsFeeLegFlows | ( | TDate | startDate, | |
TDate | endDate, | |||
TDateInterval * | dateInterval, | |||
TStubMethod * | stubType, | |||
double | notional, | |||
double | couponRate, | |||
long | paymentDcc, | |||
long | badDayConv, | |||
char * | calendar | |||
) |
Computes the non-contingent cash flows for a fee leg.
These are the cash flows you will receive if there is no default.
Interest accrues for the same number of days as there is protection. Since protectStart is set to True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends for each benchmark (end of day). | |
dateInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
notional | Notional of the fee leg | |
couponRate | Fixed coupon rate (a.k.a. spread) for the fee leg | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. |
TFeeLeg* JpmcdsCdsFeeLegMake | ( | TDate | startDate, | |
TDate | endDate, | |||
TBoolean | payAccOnDefault, | |||
TDateInterval * | couponInterval, | |||
TStubMethod * | stubType, | |||
double | notional, | |||
double | couponRate, | |||
long | paymentDcc, | |||
long | badDayConv, | |||
char * | calendar, | |||
TBoolean | protectStart | |||
) |
Makes a fixed fee leg for a vanilla CDS.
The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is only protected if protectStart=True.
Interest accrues for the same number of days as there is protection. Thus if protectStart=True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends (end of day) | |
payAccOnDefault | Should accrued interest be paid on default. Usually set to TRUE | |
couponInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
notional | Notional value protected | |
couponRate | Fixed coupon rate (a.k.a. spread) for the fee leg | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. | |
protectStart | Should protection include the start date |
int JpmcdsCdsFeeLegPV | ( | TDate | today, | |
TDate | valueDate, | |||
TDate | stepinDate, | |||
TDate | startDate, | |||
TDate | endDate, | |||
TBoolean | payAccOnDefault, | |||
TDateInterval * | couponInterval, | |||
TStubMethod * | stubType, | |||
double | notional, | |||
double | couponRate, | |||
long | paymentDcc, | |||
long | badDayConv, | |||
char * | calendar, | |||
TCurve * | discCurve, | |||
TCurve * | spreadCurve, | |||
TBoolean | protectStart, | |||
TBoolean | isPriceClean, | |||
double * | pv | |||
) |
Computes the PV for a fixed fee leg for a vanilla CDS.
Risk starts at the end of today. The PV is computed for a given value date. The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is only protected if protectStart=True.
Interest accrues for the same number of days as there is protection. Thus if protectStart=True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
today | Risk starts at the end of today | |
valueDate | Date for which the PV is calculated and cash settled | |
stepinDate | Date when step-in becomes effective | |
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends (end of day) | |
payAccOnDefault | Should accrued interest be paid on default. Usually set to TRUE | |
couponInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
notional | Notional value protected | |
couponRate | Fixed coupon rate (a.k.a. spread) for the fee leg | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. | |
discCurve | Interest rate discount curve - assumes flat forward interpolation | |
spreadCurve | Credit clean spread curve | |
protectStart | Should protection include the start date | |
isPriceClean | Should the present value be computed as a clean price (removing accrued interest) | |
pv | Output - the present value is returned |
EXPORT int JpmcdsCdsParSpreads | ( | TDate | today, | |
TDate | stepinDate, | |||
TDate | startDate, | |||
long | nbEndDates, | |||
TDate * | endDates, | |||
TBoolean | payAccOnDefault, | |||
TDateInterval * | couponInterval, | |||
TStubMethod * | stubType, | |||
long | paymentDcc, | |||
long | badDayConv, | |||
char * | calendar, | |||
TCurve * | discCurve, | |||
TCurve * | spreadCurve, | |||
double | recoveryRate, | |||
double * | parSpread | |||
) |
Computes the benchmark par spreads.
Risk starts at the end of today. The PV is computed for a given value date. The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is also protected because internally protectStart is set to True.
Interest accrues for the same number of days as there is protection. Since protectStart is set to True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
today | Risk starts at the end of today | |
stepinDate | Date when step-in becomes effective | |
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
nbEndDates | Number of benchmark dates | |
endDates | Date when protection ends (end of day), no bad day adjustment | |
payAccOnDefault | Should accrued interest be paid on default. Usually set to TRUE | |
couponInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. | |
discCurve | Interest rate discount curve - assumes flat forward interpolation | |
spreadCurve | Credit clean spread curve | |
recoveryRate | Assumed recovery rate in case of default | |
parSpread | Output - par spreads for the CDS are returned (see also isPriceClean) |
EXPORT int JpmcdsCdsPrice | ( | TDate | today, | |
TDate | valueDate, | |||
TDate | stepinDate, | |||
TDate | startDate, | |||
TDate | endDate, | |||
double | couponRate, | |||
TBoolean | payAccOnDefault, | |||
TDateInterval * | couponInterval, | |||
TStubMethod * | stubType, | |||
long | paymentDcc, | |||
long | badDayConv, | |||
char * | calendar, | |||
TCurve * | discCurve, | |||
TCurve * | spreadCurve, | |||
double | recoveryRate, | |||
TBoolean | isPriceClean, | |||
double * | price | |||
) |
Computes the price (a.k.a. upfront charge) for a vanilla CDS.
Risk starts at the end of today. The PV is computed for a given value date. The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is also protected because internally protectStart is set to True.
Interest accrues for the same number of days as there is protection. Since protectStart is set to True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
today | Risk starts at the end of today | |
valueDate | Date for which the PV is calculated and cash settled | |
stepinDate | Date when step-in becomes effective | |
startDate | Date when protection begins. Either at start or end of day (depends on protectStart) | |
endDate | Date when protection ends (end of day) | |
couponRate | Fixed coupon rate (a.k.a. spread) for the fee leg | |
payAccOnDefault | Should accrued interest be paid on default. Usually set to TRUE | |
couponInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. | |
discCurve | Interest rate discount curve - assumes flat forward interpolation | |
spreadCurve | Credit clean spread curve | |
recoveryRate | Assumed recovery rate in case of default | |
isPriceClean | Is the price expressed as a clean price (removing accrued interest) | |
price | Output - price (a.k.a. upfront charge) for the CDS is returned (see also isPriceClean) |
EXPORT TCurve* JpmcdsCleanSpreadCurve | ( | TDate | today, | |
TCurve * | discCurve, | |||
TDate | startDate, | |||
TDate | stepinDate, | |||
TDate | cashSettleDate, | |||
long | nbDate, | |||
TDate * | endDates, | |||
double * | couponRates, | |||
TBoolean * | includes, | |||
double | recoveryRate, | |||
TBoolean | payAccOnDefault, | |||
TDateInterval * | couponInterval, | |||
long | paymentDcc, | |||
TStubMethod * | stubType, | |||
long | badDayConv, | |||
char * | calendar | |||
) |
Bootstraps a clean spread curve from par spread inputs.
Risk starts at the end of today. The PV is computed for a given value date. The CDS starts at startDate and ends at endDate. The last date is always protected - the start date is also protected because internally protectStart is set to True.
Interest accrues for the same number of days as there is protection. Since protectStart is set to True you get one extra day of accrued interest in comparison with an interest rate swap. This extra day is assumed to be the last day of the CDS and means that the last period is one day longer than for an interest rate swap.
today | Risk starts at the end of today | |
discCurve | Interest rate discount curve - assumes flat forward interpolation | |
startDate | Effective date of the benchmark CDS | |
stepinDate | Step in date of the benchmark CDS | |
cashSettleDate | Date when payment should be make | |
nbDate | Number of benchmark dates | |
endDates | Dates when protection ends for each benchmark (end of day). Array of size nbDate | |
couponRates | Coupon rates for each benchmark instrument. Array of size nbDate | |
includes | 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. | |
recoveryRate | Recovery rate in case of default | |
payAccOnDefault | Should accrued interest be paid on default. Usually set to TRUE | |
couponInterval | Interval between coupon payments. Can be NULL when 3M is assumed | |
paymentDcc | Day count convention for coupon payment. Normal is ACT_360 | |
stubType | If the startDate and endDate are not on cycle, then this parameter determines location of coupon dates. | |
badDayConv | Bad day convention for adjusting coupon payment dates. | |
calendar | Calendar used when adjusting coupon dates. Can be NULL which equals a calendar with no holidays and including weekends. |