public CurrencyAmount gammaSpot(final ForexOptionSingleBarrier optionForex, final YieldCurveBundle curves, final boolean directQuote) {
ArgumentChecker.notNull(curves, "Curves");
ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
final ForexOptionVanilla underlyingOption = optionForex.getUnderlyingOption();
final PaymentFixed paymentCurrency2 = underlyingOption.getUnderlyingForex().getPaymentCurrency2();
final double sign = (optionForex.getUnderlyingOption().isLong() ? 1.0 : -1.0);
final double gammaDirect = gammaFd(optionForex, smile).getAmount() * sign;
final double spot = smile.getFxRates().getFxRate(optionForex.getCurrency1(), optionForex.getCurrency2());
if (directQuote) {
return CurrencyAmount.of(paymentCurrency2.getCurrency(), gammaDirect);
}
final double deltaDirect = spotDeltaTheoretical(optionForex, curves) * sign;
final double gamma = (gammaDirect * spot + 2 * deltaDirect) * spot * spot * spot;
return CurrencyAmount.of(paymentCurrency2.getCurrency(), gamma);
}