CNLMath : Special Functions : previous_coupon_date
previous_coupon_date
Evaluates the coupon date which immediately precedes the settlement date.
Synopsis
#include <imsl.h>
struct tm imsl_previous_coupon_date (struct tm settlement, struct tm maturity, int frequency, int basis)
Required Arguments
struct tm settlement (Input)
The date on which payment is made to settle a trade. For a more detailed discussion on dates see the Usage Notes section of this chapter.
struct tm maturity (Input)
The date on which the bond comes due, and principal and accrued interest are paid. For a more detailed discussion on dates see the Usage Notes section of this chapter.
int frequency (Input)
Frequency of the interest payments. It should be one of IMSL_ANNUAL, IMSL_SEMIANNUAL or IMSL_QUARTERLY. For a more detailed discussion on frequency see the Usage Notes section of this chapter.
int basis (Input)
The method for computing the number of days between two dates. It should be one of IMSL_DAY_CNT_BASIS_ACTUALACTUAL, IMSL_DAY_CNT_BASIS_NASD, IMSL_DAY_CNT_BASIS_ACTUAL360, IMSL_DAY_CNT_BASIS_ACTUAL365, or IMSL_DAY_CNT_BASIS_30E360. For a more detailed discussion on basis see the Usage Notes section of this chapter.
Return Value
The coupon date which immediately precedes the settlement date.
Description
Function imsl_previous_coupon_date computes the coupon date which immediately precedes the settlement date. For a good discussion on day count basis, see SIA Standard Securities Calculation Methods 1993, vol 1, pages 17-35.
Example
In this example, imsl_previous_coupon_date computes the previous coupon date of a bond with the settlement date of November 11, 1986, and the maturity date of March 1, 1999, using the Actual/365 day count method.
 
#include <stdio.h>
#include <imsl.h>
 
int main()
{
struct tm settlement, maturity, date;
char* month[] = { "January", "February", "March", "April", "May",
"June", "July", "August", "September",
"October", "November", "December" };
int frequency = IMSL_SEMIANNUAL;
int basis = IMSL_DAY_CNT_BASIS_ACTUAL365;
 
settlement.tm_year = 96;
settlement.tm_mon = 10;
settlement.tm_mday = 11;
 
maturity.tm_year = 109;
maturity.tm_mon = 2;
maturity.tm_mday = 1;
 
date = imsl_previous_coupon_date (settlement, maturity, frequency, basis);
printf ("The previous coupon date before the settlement ");
printf ("date is %s %d, %d.\n", month[date.tm_mon], date.tm_mday,
date.tm_year+1900);
}
Output
 
The previous coupon date before the settlement date is September 1, 1996.