Finance namespace

View versions (1)

Interface

#include <codecogs/finance/banking/couponprevdate.h>

using namespace Finance::Banking;

Calculate the previous coupon date before the settlement date. This value may be equal to the settlement date.

For a security, the settlement date is the date after issue when the security is traded to the buyer. The maturity date is the date at which the security expires.

Example 1

#include <stdio.h>

#include <codecogs/units/date/date.h>
#include <codecogs/units/date/dateymd.h>
#include <codecogs/finance/banking/couponprevdate.h>

int main(void)
{
  int prevDate;
  int settDate=Units::Date::date(1998, 1, 25);
  int maturityDate=Units::Date::date(1999, 11, 15);

  prevDate=Finance::Banking::couponPrevDate(settDate,
                                            maturityDate,
                                            Finance::Banking::yf_SemiAnnual);
  int y, m, d;
  
  Units::Date::dateYMD(settDate, y, m, d);
  printf("settlement=%i/%i/%i\n", y, m, d);
  
  Units::Date::dateYMD(maturityDate, y, m, d);
  printf("maturity=%i/%i/%i\n", y, m, d);
  
  Units::Date::dateYMD(prevDate, y, m, d);
  printf("previous coupon date=%i/%i/%i\n", y, m, d);

  return 0;
}

Output:

settlement=1998/1/25
maturity=1999/11/15
previous coupon date=1997/11/15

Parameters

sett
The settlement date, expressed as a serial Julian date.
mat
The maturity date of the settlement, expressed as a serial Julian date.
freq
The frequency with which payments are made:
Blank

\copydoc YearlyFreq

Parameters

basis
The year basis to use for the calculation:
Blank

\copydoc YearBasis

Returns

The previous coupon date of the security.
GPL Licence — free for non commercial use. See Licence details.