Example: Days - Beginning of Period to Settlement Date
In this example, the settlement date is 11/11/86. The number of days from the beginning of the coupon period to the settlement date is returned.
using System;
using Imsl.Finance;
public class coupdaybsEx1
{
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;
int coupdaybs = Bond.Coupdaybs(settlement, maturity, freq, dcb);
Console.Out.WriteLine("The number of days from the beginning of the"
+ "\ncoupon period to the settlement date is "
+ coupdaybs);
}
}
Output
The number of days from the beginning of the
coupon period to the settlement date is 71
Link to C# source.