#include "bastypes.h"
#include "interp.h"
Functions | |
TCurve * | JpmcdsNewTCurve (TDate baseDate, int numPts, double basis, long dayCountConv) |
Allocates and sets a TCurve. | |
EXPORT TCurve * | JpmcdsMakeTCurve (TDate baseDate, TDate *dates, double *rates, int numPts, double basis, long dayCountConv) |
Creates a new TCurve, and fills it in with rates, dates, yearfraction function, and basis. | |
TCurve * | JpmcdsMakeTCurveNoRateCheck (TDate baseDate, TDate *dates, double *rates, int numPts, double basis, long dayCountConv) |
Creates a new TCurve, and fills it in with rates, dates, yearfraction function, and basis. | |
TDate * | JpmcdsDatesFromCurve (TCurve *curve) |
int | JpmcdsCashFlowPV (TCashFlowList *cashFlows, TCurve *zeroCurve, long interpType, double *thePV) |
Calculate present value of a cash flow list. | |
int | JpmcdsDiscountDate (TDate date, TCurve *zeroCurve, long interpType, double *discount) |
Calculate discount factor for specified date and zero curve. | |
void | JpmcdsFreeTCurve (TCurve *) |
Frees a TCurve. | |
TCurve * | JpmcdsCopyCurve (TCurve *aCurve) |
Creates a copy of the curve. | |
int | JpmcdsCurveFirstDate (TCurve *curve, TDate *firstDate) |
Computes the first valid date for a zero curve. |
int JpmcdsCashFlowPV | ( | TCashFlowList * | cashFlows, | |
TCurve * | zeroCurve, | |||
long | interpType, | |||
double * | thePV | |||
) |
Calculate present value of a cash flow list.
cashFlows | (I) Arbitrary cashflows | |
zeroCurve | (I) Zero-coupon curve | |
interpType | (I) For zcurve | |
thePV | (O) Present value of cashflows |
Computes the first valid date for a zero curve.
For an encapsulated curve, this is a method of the curve. Otherwise this is the minimum of the base date of the curve and the first date in the date array.
The date returned is the first date for which we have genuine information regarding rates and discount factors. It is possible that using the curve for dates before this date will give answers, but they might not be based on real information.
Creates an array of dates from the input curve and returns a pointer to the array on success and NULL on failure.
Calculate discount factor for specified date and zero curve.
date | (I) Date | |
zeroCurve | (I) Zero Curve | |
interpType | (I) For zcurve. | |
discount | (O) Present Value |
EXPORT TCurve* JpmcdsMakeTCurve | ( | TDate | baseDate, | |
TDate * | dates, | |||
double * | rates, | |||
int | numPts, | |||
double | basis, | |||
long | dayCountConv | |||
) |
Creates a new TCurve, and fills it in with rates, dates, yearfraction function, and basis.
If it encounters a TDate = 0, it assumes that this is a terminator. This allows spreadsheet users to select a big range of dates, but use less than the whole range by terminating with a 1 or 0.
baseDate | (I) Value date | |
dates | (I) Array of dates for curve | |
rates | (I) Array of rates for dates of curve | |
numPts | (I) # elements in dates & rates arrays | |
basis | (I) Basis. See JpmcdsRateToDiscount | |
dayCountConv | (I) See JpmcdsDayCountFraction |
TCurve* JpmcdsMakeTCurveNoRateCheck | ( | TDate | baseDate, | |
TDate * | dates, | |||
double * | rates, | |||
int | numPts, | |||
double | basis, | |||
long | dayCountConv | |||
) |
Creates a new TCurve, and fills it in with rates, dates, yearfraction function, and basis.
If it encounters a TDate = 0, it assumes that this is a terminator. This allows spreadsheet users to select a big range of dates, but use less than the whole range by terminating with a 1 or 0.
It is different from JpmcdsMakeTCurve in that allows any values for the rates. JpmcdsMakeTCurve checks that the rates are all greater than -1.
baseDate | (I) Discount date | |
dates | (I) Dates in curve | |
rates | (I) Associated rates | |
numPts | (I) Len of dates and rates arrays | |
basis | (I) Compounding periods/year | |
dayCountConv | (I) |
Allocates and sets a TCurve.
Checks parameters for validity. Returns pointer to allocated TCurve. Only allocates memory for the array when it is returning a valid TCurve.
baseDate | (I) Value date | |
numPts | (I) Length of dates & rates | |
basis | (I) Basis. See JpmcdsRateToDiscount | |
dayCountConv | (I) See JpmcdsDayCountFraction |