// final Quote rate = new SimpleQuote(riskFreeRate);
//
// final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(
// new FlatForward(today, new Handle<Quote>(rate), dayCounter));
final ConvertibleFixedCouponBond europeanBond = new ConvertibleFixedCouponBond(
europeanExercise, conversionRatio, dividends, callability,
creditSpread, issueDate, settlementDays,
coupons, bondDayCount, schedule, redemption);
final ConvertibleFixedCouponBond americanBond = new ConvertibleFixedCouponBond(
americanExercise, conversionRatio, dividends, callability,
creditSpread, issueDate, settlementDays,
coupons, bondDayCount, schedule, redemption);
String method;
PricingEngine engine;
method = "Jarrow-Rudd";
engine = new BinomialConvertibleEngine<JarrowRudd>(JarrowRudd.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Cox-Ross-Rubinstein";
engine = new BinomialConvertibleEngine<CoxRossRubinstein>(CoxRossRubinstein.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Additive equiprobabilities";
engine = new BinomialConvertibleEngine<AdditiveEQPBinomialTree>(AdditiveEQPBinomialTree.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Trigeorgis";
engine = new BinomialConvertibleEngine<Trigeorgis>(Trigeorgis.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Tian";
engine = new BinomialConvertibleEngine<Tian>(Tian.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Leisen-Reimer";
engine = new BinomialConvertibleEngine<LeisenReimer>(LeisenReimer.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
method = "Joshi";
engine = new BinomialConvertibleEngine<Joshi4>(Joshi4.class, stochasticProcess, timeSteps);
europeanBond.setPricingEngine(engine);
americanBond.setPricingEngine(engine);
System.out.printf(fmt, method, europeanBond.NPV(), americanBond.NPV() );
clock.stopClock();
clock.log();
}