Return the number of days from the start of the coupon period to the settlement date. <span align="right" style="background-color:99FF99"><strong>Excel: COUPDAYBS</strong></span>

View versions (1)

Interface

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

using namespace Finance::Banking;

This function computes the number of days from the beginning of the current coupon period to the settlement. The year basis is taken into account. This function is equivalent to the Microsoft Excel function COUPDAYBS.

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

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

  int days=Finance::Banking::couponDaysToSet(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 to settlement=%i\n", days);

  return 0;
}

Output:

settlement=1998/1/25
maturity=1999/11/15
days to settlement=71

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.