financebanking

coupon Days In Period

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 1.80
sub units 12.35
add a commercial licence to your cart
0
viewed 1710 times and licensed 12 times
www.codecogs.com/d-ox/finance/banking/coupondaysinperiod.php
Other modules that are used by this module. We add these to the cart for you whenever you add this module, unless you already own enough licences for them. Click for details
Controller: CodeCogs    Contact Controller

Interface

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

using namespace Finance::Banking;

int couponDaysInPeriod (int sett,                    int mat,                    Finance::Banking::YearlyFreq freq,                    Finance::Banking::YearBasis basis=yb_USA)
Return number of days in coupon period containing the settlement date. Excel: COUPDAYS

Function Documentation

 
intcouponDaysInPeriodintsett
intmat
Finance::Banking::YearlyFreqfreq
Finance::Banking::YearBasisbasis = yb_USA )
Calculate the number of days in the coupon period that contains the settlement date. The number of days returned depends on the year basis specified:

For yb_USA, yb_EU and yb_Act360 the returned value is:
(1)
\displaystyle days\ =\ \frac{360}{freq}

Where freq is the number of times per year the payment is made (1 for yf_Annual, 2 for yf_SemiAnnual or 4 for yf_Quarterly).

For yb_Act365 the returned value is:
(2)
\displaystyle days\ =\ \frac{365}{freq}
(Using integer division)

Finally, for yb_Act, the exact number of days between the two dates (taking into account leap years) is returned.
Example:
#include <stdio.h>
 
#include <codecogs/units/date/date.h>
#include <codecogs/units/date/dateymd.h>
#include <codecogs/finance/banking/coupondaysinperiod.h>
 
int main(void)
{
  int settDate=Units::Date::date(1998, 1, 25);
  int maturityDate=Units::Date::date(1999, 11, 15);
  int days=Finance::Banking::couponDaysInPeriod(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 in period=%i\n", days);
 
  return 0;
}
Output:
settlement=1998/1/25
maturity=1999/11/15
days in period=181
Parameters:
settThe settlement date, expressed as a serial Julian date.
matThe maturity date of the settlement, expressed as a serial Julian date.
freqThe frequency with which payments are made: The yearly frequency to be used in financial calculations
TypeDescription
yf_Annual Payments are made annually.
yf_SemiAnnual Payments are semi-annual (2 per year).
yf_Quarterly Payments are quarterly (4 per year).
basisThe year basis to use for the calculation:
The module YearBasis. does not yet exist on the system. Should this persist please contact the website administrator.
Returns:
The number of days in the coupon period.
Authors:
James Warren (August 2005)
Source Code:
Register

- To get code register with CodeCogs. Already a Member, then Login.


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2008-05-08 14:49:08

Page Comments

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional