Finance namespace

You're viewing an older version of this page (#323). View the current version.

View versions (1)

Interface

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

using namespace Finance::Banking;

This function computes the number of days from the settlement date to the next coupon date. The year basis is taken into account.

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/coupondaysafterset.h>

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

  int days=Finance::Banking::couponDaysAfterSet(settDate,
                                                maturityDate,
                                                Finance::Banking::yf_SemiAnnual,
                                                Finance::Banking::yb_Act);
  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);
  
  printf("days after settlement=%i\n", days);

  return 0;
}

Output:

settlement=1998/1/25
maturity=1999/11/15
days after settlement=110

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 number of days to the next coupon date.
GPL Licence — free for non commercial use. See Licence details.