/** * Calculates the gamma of the bond future option product. * <p> * The gamma of the product is the sensitivity of the option delta to the future price. * The volatility is unchanged for a fixed strike in the sensitivity computation, hence the "StickyStrike" name. * <p> * This calculates the underlying future price using the future pricer. * * @param futureOption the option product * @param discountingProvider the discounting provider * @param volatilities the volatilities * @return the price curve sensitivity of the product */ public double gammaStickyStrike( ResolvedBondFutureOption futureOption, LegalEntityDiscountingProvider discountingProvider, BlackBondFutureVolatilities volatilities) { double futurePrice = futurePrice(futureOption, discountingProvider); return gammaStickyStrike(futureOption, discountingProvider, volatilities, futurePrice); }
public void test_gamma_from_future_price() { double futurePrice = 1.1d; double computed = OPTION_PRICER.gammaStickyStrike( FUTURE_OPTION_PRODUCT, RATE_PROVIDER, VOLS, futurePrice); double strike = FUTURE_OPTION_PRODUCT.getStrikePrice(); double expiryTime = ACT_365F.relativeYearFraction(VAL_DATE, FUTURE_OPTION_PRODUCT.getExpiryDate()); double logMoneyness = Math.log(strike / futurePrice); double vol = SURFACE.zValue(expiryTime, logMoneyness); double expected = BlackFormulaRepository.gamma(futurePrice, strike, expiryTime, vol); assertEquals(computed, expected, TOL); }
public void test_gamma() { double computed = OPTION_PRICER.gammaStickyStrike(FUTURE_OPTION_PRODUCT, RATE_PROVIDER, VOLS); double futurePrice = FUTURE_PRICER.price(FUTURE_OPTION_PRODUCT.getUnderlyingFuture(), RATE_PROVIDER); double strike = FUTURE_OPTION_PRODUCT.getStrikePrice(); double expiryTime = ACT_365F.relativeYearFraction(VAL_DATE, FUTURE_OPTION_PRODUCT.getExpiryDate()); double logMoneyness = Math.log(strike / futurePrice); double vol = SURFACE.zValue(expiryTime, logMoneyness); double expected = BlackFormulaRepository.gamma(futurePrice, strike, expiryTime, vol); assertEquals(computed, expected, TOL); }