Example: Bond-Equivalent Yield
The bond-equivalent yield for a 1 year Treasury bill is returned in this example.
using System;
using Imsl.Finance;
public class tbilleqEx1
{
public static void Main(String[] args)
{
DateTime settlement = DateTime.Parse("7/1/85");
DateTime maturity = DateTime.Parse("7/1/86");
double discount = .05;
double tbilleq = Bond.Tbilleq(settlement, maturity, discount);
Console.Out.WriteLine("The bond-equivalent yield for the " +
"T-bill is " + tbilleq.ToString("P"));
}
}
Output
The bond-equivalent yield for the T-bill is 5.27 %
Link to C# source.