#include "cgeneral.h"
#include "cdate.h"
Defines | |
#define | JPMCDS_CONTINUOUS_BASIS 5000 |
Means continuous compounding. | |
#define | JPMCDS_DISCOUNT_RATE 512 |
Discount RATE (not factor) K's b-Day. | |
#define | JPMCDS_SIMPLE_BASIS 0 |
Means simple interest. | |
#define | JPMCDS_ANNUAL_BASIS 1 |
Annual compounding. | |
#define | JPMCDS_DISCOUNT_FACTOR -2 |
Rate is stored as a discount factor. | |
Functions | |
int | JpmcdsRateToDiscount (double rate, TDate startDate, TDate endDate, long rateDayCountConv, long rateType, double *discount) |
Convert from a given rate to a discount factor. | |
int | JpmcdsDiscountToRate (double discount, TDate startDate, TDate endDate, long rateDayCountConv, long rateType, double *rate) |
Convert from a given discount factor to a rate. | |
int | JpmcdsDiscountToRateYearFrac (double discount, double yearFraction, double basis, double *rate) |
Convert from a discount factor to a rate using a year fraction. | |
int | JpmcdsRateToDiscountYearFrac (double rate, double yearFraction, double basis, double *discount) |
Convert from a rate to a discount factor using a year fraction. | |
int | JpmcdsRateValid (char *routine, double rate, TDate startDate, TDate endDate, long rateDayCountConv, double rateBasis) |
Checks whether a rate is valid between two dates. | |
int | JpmcdsRateValidYearFrac (char *routine, double rate, double yearFraction, double basis) |
Checks whether a rate is valid between two dates. |
int JpmcdsDiscountToRate | ( | double | discount, | |
TDate | startDate, | |||
TDate | endDate, | |||
long | rateDayCountConv, | |||
long | rateType, | |||
double * | rate | |||
) |
Convert from a given discount factor to a rate.
discount | (I) Discount factor | |
startDate | (I) Start date | |
endDate | (I) End date | |
rateDayCountConv | (I) See JpmcdsDayCountFraction | |
rateType | (I) Type of rate | |
rate | (O) Output rate |
int JpmcdsDiscountToRateYearFrac | ( | double | discount, | |
double | yearFraction, | |||
double | basis, | |||
double * | rate | |||
) |
Convert from a discount factor to a rate using a year fraction.
Calculate an interest rate from a discount factor, given the daycount and basis.
discount | (I) Discount factor | |
yearFraction | (I) See JpmcdsDayCountFraction | |
basis | (I) Basis for the rate | |
rate | (O) Output rate |
int JpmcdsRateToDiscount | ( | double | rate, | |
TDate | startDate, | |||
TDate | endDate, | |||
long | rateDayCountConv, | |||
long | rateType, | |||
double * | discount | |||
) |
Convert from a given rate to a discount factor.
rate | (I) Rate | |
startDate | (I) Start date | |
endDate | (I) End date | |
rateDayCountConv | (I) See JpmcdsDayCountFraction | |
rateType | (I) Type of rate | |
discount | (O) Output discount factor |
int JpmcdsRateToDiscountYearFrac | ( | double | rate, | |
double | yearFraction, | |||
double | basis, | |||
double * | discount | |||
) |
Convert from a rate to a discount factor using a year fraction.
Calculate discount factor from an interest rate, given the daycount and basis.
rate | (I) Rate | |
yearFraction | (I) See JpmcdsDayCountFraction | |
basis | (I) Basis for the rate | |
discount | (O) Output discount rate |
int JpmcdsRateValid | ( | char * | routine, | |
double | rate, | |||
TDate | startDate, | |||
TDate | endDate, | |||
long | rateDayCountConv, | |||
double | rateBasis | |||
) |
Checks whether a rate is valid between two dates.
routine | (I) Routine name to print | |
rate | (I) Rate to validate | |
startDate | (I) Starting date | |
endDate | (I) Ending date | |
rateDayCountConv | (I) Day count convention | |
rateBasis | (I) Compounding basis |
int JpmcdsRateValidYearFrac | ( | char * | routine, | |
double | rate, | |||
double | yearFraction, | |||
double | basis | |||
) |
Checks whether a rate is valid between two dates.
routine | (I) Routine name to print | |
rate | (I) Rate to validate | |
yearFraction | (I) Fraction of year | |
basis | (I) Compounding basis |