package com.imsl.test.example.finance;
import com.imsl.finance.*;
import java.text.*;
import java.util.*;
/**
*
Computes the price of a bond with an odd short first
* coupon.
*
*
* This example calculates the price of an odd short first coupon with the
* following settings:
*
* Settlement | 11/11/1992 |
* Maturity | 03/01/2005 |
* Issue date | 10/15/1992 |
* First Coupon | 03/01/1993 |
* Rate | 0.0785 |
* Yield | 0.0625 |
* Redemption Value | 100.0 |
* Payment Frequency | Bond.SEMIANNUAL |
* Day Count Basis | DayCountBasis.BasisActualActual |
*
*
* @see Code
* @see Output
*/
public class BondPriceEx5 {
static final DateFormat dateFormat
= DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
static private GregorianCalendar parse(String s) throws ParseException {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(dateFormat.parse(s));
return cal;
}
public static void main(String args[]) throws ParseException {
GregorianCalendar settlement = parse("11/11/1992");
GregorianCalendar maturity = parse("03/01/2005");
GregorianCalendar issueDate = parse("10/15/1992");
GregorianCalendar firstCoupon = parse("03/01/1993");
double price = Bond.price(settlement, maturity, issueDate,
firstCoupon, 0.0785, .0625, 100.0, Bond.SEMIANNUAL,
DayCountBasis.BasisActualActual);
System.out.println("The price is " + price);
}
}