final PlainVanillaPayoff payoff = (PlainVanillaPayoff)arguments.payoff;
/*@Volatility*/ final double volatility = process.blackVolatility().currentLink().blackVol(exercise, payoff.strike());
/*@Real*/ final double variance = process.blackVolatility().currentLink().blackVariance(exercise, payoff.strike());
/*@DiscountFactor*/ final double riskFreeDiscount = process.riskFreeRate().currentLink().discount(exercise);
final DayCounter rfdc = process.riskFreeRate().currentLink().dayCounter();
final DayCounter divdc = process.dividendYield().currentLink().dayCounter();
final DayCounter voldc = process.blackVolatility().currentLink().dayCounter();
/*@Spread*/ final double dividendYield = 0.5 * (
process.riskFreeRate().currentLink().zeroRate(
exercise,
rfdc,
Compounding.Continuous,
Frequency.NoFrequency).rate() + process.dividendYield().currentLink().zeroRate(
exercise,
divdc,
Compounding.Continuous,
Frequency.NoFrequency).rate() + volatility*volatility/6.0);
/*@Time*/ final double t_q = divdc.yearFraction(
process.dividendYield().currentLink().referenceDate(), exercise);
/*@DiscountFactor*/ final double dividendDiscount = Math.exp(-dividendYield*t_q);
/*@Real*/ final double spot = process.stateVariable().currentLink().value();
QL.require(spot > 0.0, "negative or null underlying given"); // QA:[RG]::verified // TODO: message
/*@Real*/ final double forward = spot * dividendDiscount / riskFreeDiscount;
final BlackCalculator black = new BlackCalculator(payoff, forward, Math.sqrt(variance/3.0),riskFreeDiscount);
r.value = black.value();
greeks.delta = black.delta(spot);
greeks.gamma = black.gamma(spot);
greeks.dividendRho = black.dividendRho(t_q)/2.0;
/*@Time*/ final double t_r = rfdc.yearFraction(process.riskFreeRate().currentLink().referenceDate(),
a.exercise.lastDate());
greeks.rho = black.rho(t_r) + 0.5 * black.dividendRho(t_q);
/*@Time*/ final double t_v = voldc.yearFraction(
process.blackVolatility().currentLink().referenceDate(),
a.exercise.lastDate());
greeks.vega = black.vega(t_v)/Math.sqrt(3.0) +
black.dividendRho(t_q)*volatility/6.0;