cashflow.h File Reference

#include "bastypes.h"
#include "stub.h"
#include "busday.h"
#include "ldate.h"


#define JPMCDS_ADD_FINAL   1


TCashFlowListJpmcdsNewEmptyCFL (int numItems)
 Makes a new empty TCashFlowList.
TCashFlowListJpmcdsNewCFLFromDL3 (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.
TCashFlowListJpmcdsNewCFL (TDate *dates, double *amounts, int numItems)
 Makes a new TCashFlowList.
TCashFlowListJpmcdsMakeCFL (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.
TCashFlowListJpmcdsMergeCFL (TCashFlowList *a, TCashFlowList *b)
 Merges two cash flow lists.
void JpmcdsFreeCFL (TCashFlowList *)
 Free cash flow list.

Detailed Description

Define Documentation

#define JPMCDS_ADD_FINAL   1

Add 1. on maturityDate


Keep start date, even if JPMCDS_SUBTRACT_INITIAL not set


Add final zero payment Used for libor-in arrears


If stub, leave prestart zero payment.


Subtract 1. at startDate

Function Documentation

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]
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

Distributed by BN Algorithms Ltd -- consulting in quantitative finance, mathematical algorithms and software implementations. CDS Home Page. For enquires contact
This documentation is derived from ISDA CDS Standard Model version 1.7. You can get a copy of the original ISDA code at This is a derivative work under the terms of the ISDA CDS Standard Model Public License. BN Algorithms Ltd licenses this work to you solely for on-screen viewing on your own computer. Making copies and further distribution of this work is prohibited.
This documentation is provided "as-is", without warranty of any kind, either expressed or implied, including, without limitation, warranties that the documentation is free of defects, merchantable, fit for a particular purpose or non-infringing. the entire risk as to the quality of the documentation is with you. Should this documentation prove defective in any respect, you (not the licensor) assume the cost of any necessary correction. This disclaimer of warranty constitutes an essential part of this license.