Example: Price of a Discounted Security
The price per $100 face value of a discounted 1 year bond is returned in this example.
using System;
using Imsl.Finance;
public class pricediscEx1
{
public static void Main(String[] args)
{
DateTime settlement = DateTime.Parse("7/1/85");
DateTime maturity = DateTime.Parse("7/1/86");
double rate = .05;
double redemption = 100.0;
DayCountBasis dcb = DayCountBasis.BasisNASD;
double pricedisc = Bond.Pricedisc(settlement, maturity, rate,
redemption, dcb);
Console.Out.WriteLine("The price of the discounted bond is " +
pricedisc.ToString("C"));
}
}
Output
The price of the discounted bond is $95.00
Link to C# source.