FUNCTION
couponNumber
Compute the number of coupons payable between settlement and maturity. <span align="right" style="background-color:99FF99"><strong>Excel: COUPNUM</strong></span>
Interface
#include <codecogs/finance/banking/couponnumber.h>
using namespace Finance::Banking;
This function returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.
Example 1
#include <iostream>
#include <codecogs/units/date/date_str.h>
#include <codecogs/finance/banking/couponnumber.h>
int main(void)
{
int settlementDate=Units::Date::date(2004, 1, 25);
int maturityDate=Units::Date::date(2006, 11, 15);
int num=Finance::Banking::couponNumber(settlementDate, maturityDate, Finance::Banking::yf_SemiAnnual);
printf("\nsettlement=%s\n", Units::Date::date_str("l dS of F Y", settlementDate));
printf("maturity=%s\n", Units::Date::date_str("l dS of F Y", maturityDate));
printf("number of coupons=%i\n", num);
return 1;
}Output:
settlement=Sunday 25th of January 2004
maturity=Wednesday 15th of November 2006
number of coupons=6Parameters
settlement
The settlement date, expressed as a serial Julian date.
maturity
The maturity date of the settlement, expressed as a serial Julian date.
freq
The frequency with which payments are made. Must be yf_Annual, yf_SemiAnnual or yf_Quarterly.
basis
The year basis to use for the calculation.
Returns
The number of coupons payable between the settlement date and the maturity date.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.