@Override public double priceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility) { return NormalFormulaRepository.delta(forward, strike, expiry, volatility, putCall); }
@Override public double priceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility) { return NormalFormulaRepository.delta(forward, strike, expiry, volatility, putCall); }
@Override public double priceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility) { return NormalFormulaRepository.delta(forward, strike, expiry, volatility, putCall); }
@Override public double priceDelta(double expiry, PutCall putCall, double strike, double forward, double volatility) { return NormalFormulaRepository.delta(forward, strike, expiry, volatility, putCall); }
public void test_price_formula() { double sampleVol = 0.2; for (int i = 0; i < NB_TEST; i++) { double expiryTime = VOLS.relativeTime(TEST_OPTION_EXPIRY[i]); for (int j = 0; j < NB_TEST; j++) { for (PutCall putCall : new PutCall[] {PutCall.CALL, PutCall.PUT}) { double price = VOLS.price(expiryTime, putCall, TEST_STRIKE[j], TEST_FORWARD, sampleVol); double delta = VOLS.priceDelta(expiryTime, putCall, TEST_STRIKE[j], TEST_FORWARD, sampleVol); double gamma = VOLS.priceGamma(expiryTime, putCall, TEST_STRIKE[j], TEST_FORWARD, sampleVol); double theta = VOLS.priceTheta(expiryTime, putCall, TEST_STRIKE[j], TEST_FORWARD, sampleVol); double vega = VOLS.priceVega(expiryTime, putCall, TEST_STRIKE[j], TEST_FORWARD, sampleVol); assertEquals(price, NormalFormulaRepository.price(TEST_FORWARD, TEST_STRIKE[j], expiryTime, sampleVol, putCall)); assertEquals(delta, NormalFormulaRepository.delta(TEST_FORWARD, TEST_STRIKE[j], expiryTime, sampleVol, putCall)); assertEquals(gamma, NormalFormulaRepository.gamma(TEST_FORWARD, TEST_STRIKE[j], expiryTime, sampleVol, putCall)); assertEquals(theta, NormalFormulaRepository.theta(TEST_FORWARD, TEST_STRIKE[j], expiryTime, sampleVol, putCall)); assertEquals(vega, NormalFormulaRepository.vega(TEST_FORWARD, TEST_STRIKE[j], expiryTime, sampleVol, putCall)); } } } }
public void test_presentValueDelta_formula() { CurrencyAmount computedCaplet = PRICER.presentValueDelta(CAPLET_LONG, RATES, VOLS); CurrencyAmount computedFloorlet = PRICER.presentValueDelta(FLOORLET_SHORT, RATES, VOLS); double forward = RATES.iborIndexRates(EUR_EURIBOR_3M).rate(RATE_COMP.getObservation()); double expiry = VOLS.relativeTime(CAPLET_LONG.getFixingDateTime()); double volatility = VOLS.volatility(expiry, STRIKE, forward); double df = RATES.discountFactor(EUR, CAPLET_LONG.getPaymentDate()); double expectedCaplet = NOTIONAL * df * CAPLET_LONG.getYearFraction() * NormalFormulaRepository.delta(forward, STRIKE, expiry, volatility, CALL); double expectedFloorlet = -NOTIONAL * df * CAPLET_LONG.getYearFraction() * NormalFormulaRepository.delta(forward, STRIKE, expiry, volatility, PUT); assertEquals(computedCaplet.getCurrency(), EUR); assertEquals(computedCaplet.getAmount(), expectedCaplet, NOTIONAL * TOL); assertEquals(computedFloorlet.getCurrency(), EUR); assertEquals(computedFloorlet.getAmount(), expectedFloorlet, NOTIONAL * TOL); }
/** * Calculates the delta of the Ibor future option product * based on the price of the underlying future. * <p> * The delta of the product is the sensitivity of the option price to the future price. * The volatility is unchanged for a fixed strike in the sensitivity computation, hence the "StickyStrike" name. * * @param futureOption the option product * @param ratesProvider the rates provider * @param volatilities the volatilities * @param futurePrice the price of the underlying future, in decimal form * @return the price curve sensitivity of the product */ public double deltaStickyStrike( ResolvedIborFutureOption futureOption, RatesProvider ratesProvider, NormalIborFutureOptionVolatilities volatilities, double futurePrice) { ArgChecker.isTrue(futureOption.getPremiumStyle().equals(FutureOptionPremiumStyle.DAILY_MARGIN), "Premium style should be DAILY_MARGIN"); double timeToExpiry = volatilities.relativeTime(futureOption.getExpiry()); double strike = futureOption.getStrikePrice(); ResolvedIborFuture future = futureOption.getUnderlyingFuture(); double volatility = volatilities.volatility(timeToExpiry, future.getLastTradeDate(), strike, futurePrice); return NormalFormulaRepository.delta(futurePrice, strike, timeToExpiry, volatility, futureOption.getPutCall()); }
/** * Computes forward delta of an option in the normally distributed assets hypothesis (Bachelier model). * * @param option the option description * @param data the model data * @return delta */ public double getDelta(EuropeanVanillaOption option, NormalFunctionData data) { ArgChecker.notNull(option, "option"); ArgChecker.notNull(data, "data"); return data.getNumeraire() * NormalFormulaRepository.delta( data.getForward(), option.getStrike(), option.getTimeToExpiry(), data.getNormalVolatility(), option.getPutCall()); }