/* @Volatility */final double vols[] = { 0.11, 0.50, 1.20 };
final DayCounter dc = new Actual360();
final Date today = Date.todaysDate();
final SimpleQuote spot = new SimpleQuote(0.0);
final SimpleQuote vol = new SimpleQuote(0.0);
final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);
final SimpleQuote qRate = new SimpleQuote(0.0);
final YieldTermStructure qTS = Utilities.flatRate(today, qRate, dc);
final SimpleQuote rRate = new SimpleQuote(0.0);
final YieldTermStructure rTS = Utilities.flatRate(today, rRate, dc);
for (final Type type : types)
for (final double strike : strikes)
for (final int length : lengths) {
final Date exDate = today.add(length * 360);
final Exercise exercise = new EuropeanExercise(exDate);
final StrikedTypePayoff payoff = new PlainVanillaPayoff(type, strike);
// reference option
final VanillaOption refOption = makeOption(payoff, exercise, spot, qTS, rTS, volTS, EngineType.Analytic,
Constants.NULL_INTEGER, Constants.NULL_INTEGER);
// option to check
final VanillaOption option = makeOption(payoff, exercise, spot, qTS, rTS, volTS, engine, binomialSteps, samples);
for (final double u : underlyings)
for (final double q : qRates)
for (final double r : rRates)
for (final double v : vols) {
spot.setValue(u);
qRate.setValue(q);
rRate.setValue(r);
vol.setValue(v);
expected.clear();
calculated.clear();