tcurve.h File Reference

#include "bastypes.h"
#include "interp.h"

Functions

TCurveJpmcdsNewTCurve (TDate baseDate, int numPts, double basis, long dayCountConv)
 Allocates and sets a TCurve.
EXPORT TCurveJpmcdsMakeTCurve (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.
TCurveJpmcdsMakeTCurveNoRateCheck (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.
TDateJpmcdsDatesFromCurve (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.
TCurveJpmcdsCopyCurve (TCurve *aCurve)
 Creates a copy of the curve.
int JpmcdsCurveFirstDate (TCurve *curve, TDate *firstDate)
 Computes the first valid date for a zero curve.

Detailed Description


Function Documentation

int JpmcdsCashFlowPV ( TCashFlowList cashFlows,
TCurve zeroCurve,
long  interpType,
double *  thePV 
)

Calculate present value of a cash flow list.

Parameters:
cashFlows (I) Arbitrary cashflows
zeroCurve (I) Zero-coupon curve
interpType (I) For zcurve
thePV (O) Present value of cashflows

int JpmcdsCurveFirstDate ( TCurve curve,
TDate firstDate 
)

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.

TDate* JpmcdsDatesFromCurve ( TCurve curve  ) 

Creates an array of dates from the input curve and returns a pointer to the array on success and NULL on failure.

int JpmcdsDiscountDate ( TDate  date,
TCurve zeroCurve,
long  interpType,
double *  discount 
)

Calculate discount factor for specified date and zero curve.

Parameters:
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.

Parameters:
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.

Parameters:
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)

TCurve* JpmcdsNewTCurve ( TDate  baseDate,
int  numPts,
double  basis,
long  dayCountConv 
)

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.

Parameters:
baseDate (I) Value date
numPts (I) Length of dates & rates
basis (I) Basis. See JpmcdsRateToDiscount
dayCountConv (I) See JpmcdsDayCountFraction


Distributed by BN Algorithms Ltd -- consulting in quantitative finance, mathematical algorithms and software implementations. CDS Home Page. For enquires contact webs@bnikolic.co.uk.
This documentation is derived from ISDA CDS Standard Model version 1.7. You can get a copy of the original ISDA code at www.bnikolic.co.uk. 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.