Example: Price of a Security that Pays at Maturity
The price per $100 face value of 1 year bond that pays interest at maturity is returned in this example.
using System;
using Imsl.Finance;
public class pricematEx1
{
public static void Main(String[] args)
{
DateTime settlement = DateTime.Parse("8/1/85");
DateTime maturity = DateTime.Parse("7/1/86");
DateTime issue = DateTime.Parse("7/1/85");
double rate = .05;
double yield = .05;
DayCountBasis dcb = DayCountBasis.BasisNASD;
double pricemat = Bond.Pricemat(settlement, maturity, issue,
rate, yield, dcb);
Console.Out.WriteLine("The price of the bond is " + pricemat);
}
}
Output
The price of the bond is 99.9817397078353
Link to C# source.