#include "bastypes.h"
#include "stub.h"
#include "busday.h"
#include "ldate.h"
Defines | |
#define | JPMCDS_ADD_FINAL 1 |
#define | JPMCDS_SUBTRACT_INITIAL 2 |
#define | JPMCDS_PRESTART_ZERO_PAYMENT 4 |
#define | JPMCDS_POST_MATURITY_ZERO_PAYMENT 8 |
#define | JPMCDS_KEEP_START_DATE 16 |
Functions | |
TCashFlowList * | JpmcdsNewEmptyCFL (int numItems) |
Makes a new empty TCashFlowList. | |
TCashFlowList * | JpmcdsNewCFLFromDL3 (TDateList *dates, TDate startDate, TDate maturityDate, double rate, long couponDayCountConv, TBoolean longStub, long accrualBadDayConv, long payBadDayConv, char *accrualHolidayFile, char *payHolidayFile, TBoolean usePreStartDate) |
Makes a cashflow list from a DateList. | |
TCashFlowList * | JpmcdsNewCFL (TDate *dates, double *amounts, int numItems) |
Makes a new TCashFlowList. | |
TCashFlowList * | JpmcdsMakeCFL (double couponRate, TDate startDate, TDateInterval *interval, TDate maturityDate, long dayCountConv, long stubPlacement, long flags, long accBadDayConv, long payBadDayConv, char *holidayFile) |
Makes a new cash flow list. | |
TCashFlowList * | JpmcdsMergeCFL (TCashFlowList *a, TCashFlowList *b) |
Merges two cash flow lists. | |
void | JpmcdsFreeCFL (TCashFlowList *) |
Free cash flow list. |
#define JPMCDS_ADD_FINAL 1 |
Add 1. on maturityDate
#define JPMCDS_KEEP_START_DATE 16 |
Keep start date, even if JPMCDS_SUBTRACT_INITIAL not set
#define JPMCDS_POST_MATURITY_ZERO_PAYMENT 8 |
Add final zero payment Used for libor-in arrears
#define JPMCDS_PRESTART_ZERO_PAYMENT 4 |
If stub, leave prestart zero payment.
#define JPMCDS_SUBTRACT_INITIAL 2 |
Subtract 1. at startDate
TCashFlowList* JpmcdsMakeCFL | ( | double | couponRate, | |
TDate | startDate, | |||
TDateInterval * | interval, | |||
TDate | maturityDate, | |||
long | dayCountConv, | |||
long | stubPlacement, | |||
long | flags, | |||
long | accBadDayConv, | |||
long | payBadDayConv, | |||
char * | holidayFile | |||
) |
Makes a new cash flow list.
Depending on the value of flags, an initial paymemt of value 1 is subtracted and/or a final payment of 1 is added. If JPMCDS_PRESTART_ZERO_PAYMENT is set, and there is a front stub, the first date will be the payment date that would have occured before the start date. In this case, JPMCDS_SUBTRACT_INITIAL cannot be set.
couponRate | (I) Annual coupon Rate | |
startDate | (I) Date instrument begins at | |
interval | (I) Time between payments | |
maturityDate | (I) Date instrument matures at | |
dayCountConv | (I) See JpmcdsDayCountFraction | |
stubPlacement | (I) [Front / Back] + [Short (default) / Long] | |
flags | (I) JPMCDS_ADD_FINAL/JPMCDS_SUBTRACT_INITIAL | |
accBadDayConv | (I) Accrual conv (See JpmcdsBusinessDay) | |
payBadDayConv | (I) Payment conv (See JpmcdsBusinessDay) | |
holidayFile | (I) See JpmcdsBusinessDay |
TCashFlowList* JpmcdsMergeCFL | ( | TCashFlowList * | a, | |
TCashFlowList * | b | |||
) |
Merges two cash flow lists.
The input cash flow lists cannot be NULL.
a | (I) first cash flow list | |
b | (I) second cash flow list |
TCashFlowList* JpmcdsNewCFL | ( | TDate * | dates, | |
double * | amounts, | |||
int | numItems | |||
) |
Makes a new TCashFlowList.
dates | (I) Dates | |
amounts | (I) Amounts | |
numItems | (I) Length of both arrays |
TCashFlowList* JpmcdsNewCFLFromDL3 | ( | TDateList * | dates, | |
TDate | startDate, | |||
TDate | maturityDate, | |||
double | rate, | |||
long | couponDayCountConv, | |||
TBoolean | longStub, | |||
long | accrualBadDayConv, | |||
long | payBadDayConv, | |||
char * | accrualHolidayFile, | |||
char * | payHolidayFile, | |||
TBoolean | usePreStartDate | |||
) |
Makes a cashflow list from a DateList.
Cashflows (for non stub payments) are equal to the rate times the fraction of the year between each date and the previous date. The year fraction is calculated by the year fraction function passed in. For stub payments, Actual/Actual is used.
If there is a stub at the BEGINNING, then the first element of the dateList is assumed to PRECEED startDate.
If there is a stub at the END, then the last element of the dateList is assumed to COME AFTER maturityDate.
dates | (I) Dates | |
startDate | (I) startDate | |
maturityDate | (I) MaturityDate | |
rate | (I) Multiplied by yearFrac | |
couponDayCountConv | (I) Coupon calc | |
longStub | (I) Long stub | |
accrualBadDayConv | (I) Accrual bad day convention | |
payBadDayConv | (I) Pay bad day convention | |
accrualHolidayFile | (I) Accrual Holiday file. | |
payHolidayFile | (I) Payment Holiday file. | |
usePreStartDate | (I) Use prestart date if stub |