}
public MultipleCurrencyAmount getTheta(final ForexOptionVanillaDefinition definition, final ZonedDateTime date, final String[] yieldCurveNames,
final SmileDeltaTermStructureDataBundle data, final int daysForward) {
ArgumentChecker.isTrue(daysForward == 1 || daysForward == -1, "daysForward must be either 1 or -1"); // TODO: Update signature of function to take ForwardOrBack
final InstrumentDerivative instrumentToday = definition.toDerivative(date, yieldCurveNames);
final ZonedDateTime horizonDate = date.plusDays(daysForward);
final double shiftTime = TimeCalculator.getTimeBetween(date, horizonDate);
final TodayPaymentCalculator paymentCalculator = TodayPaymentCalculator.getInstance(shiftTime);
final InstrumentDerivative instrumentTomorrow = definition.toDerivative(horizonDate, yieldCurveNames);
final MultipleCurrencyAmount paymentToday = instrumentToday.accept(paymentCalculator);
final SmileDeltaTermStructureParametersStrikeInterpolation volatilityData = data.getVolatilityModel();
final SmileDeltaTermStructureParametersStrikeInterpolation smile = new SmileDeltaTermStructureParametersStrikeInterpolation(volatilityData.getVolatilityTerm(),
volatilityData.getStrikeInterpolator()) {
@Override
public double getVolatility(final double time, final double strike, final double forward) {
return volatilityData.getVolatility(time + shiftTime, strike, forward);
}
};
final SmileDeltaTermStructureDataBundle tomorrowData = data.with(smile);
final PresentValueBlackSmileForexCalculator pvCalculator = PresentValueBlackSmileForexCalculator.getInstance();
return subtract(instrumentTomorrow.accept(pvCalculator, tomorrowData), instrumentToday.accept(pvCalculator, data)).plus(paymentToday);
}