FUNCTION
couponDaysToSet
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>
You're viewing an older version of this page (#321). View the current version.
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=71Parameters
\copydoc YearlyFreq
Parameters
\copydoc YearBasis