Example: Days in the Settlement Date Period
In this example, the settlement date is 11/11/86. The number of days in the coupon period containing this date is returned.
using System;
using Imsl.Finance;
public class coupdaysEx1
{
public static void Main(String[] args)
{
DateTime settlement = DateTime.Parse("11/11/86");
DateTime maturity = DateTime.Parse("3/1/99");
Bond.Frequency freq = Bond.Frequency.SemiAnnual;
DayCountBasis dcb = DayCountBasis.BasisActual365;
double coupdays = Bond.Coupdays(settlement, maturity, freq, dcb);
Console.Out.WriteLine("The number of days in the coupon period that "
+ "contains the settlement date is "
+ coupdays);
}
}
Output
The number of days in the coupon period that contains the settlement date is 182.5
Link to C# source.