Bond (Real Market)

From Open Ideas
Jump to navigation Jump to search

Codebook

Construction

If you like to create a real-market bond, then the class MarketBond is used.

double faceValue = 100.0;
IDay due = IDay.create(2008, 4, 30);
IDay maturity = IDay.create(2015, 4, 30);
double coupon = 0.05;
int couponFrequency = 2;
MarketBond bond1 = PeriodicBond.create(faceValue, due, maturity, coupon, couponFrequency);

AperiodicBond are created if the coupon payments are aperiodic.

double faceValue = 100.0;
IDay due = Day.create(2001, 2, 28);
SortedSet<IDay> dates = new TreeSet<IDay>();
dates.add(Day.create(2003, 2, 28));
dates.add(Day.create(2005, 2, 28));	
dates.add(Day.create(2007, 2, 28));
double coupon = 0.0675;
MarketBond bond2 = AperiodicBond.create(100.0, due, dates, coupon);