/** * Calculates the price sensitivity of the Ibor future option product based on curves. * <p> * The price sensitivity of the product is the sensitivity of the price to the underlying curves. * 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 ratesProvider the rates provider * @param volatilities the volatilities * @return the price curve sensitivity of the product */ public PointSensitivities priceSensitivityRatesStickyStrike( ResolvedIborFutureOption futureOption, RatesProvider ratesProvider, NormalIborFutureOptionVolatilities volatilities) { ArgChecker.isTrue(futureOption.getPremiumStyle().equals(FutureOptionPremiumStyle.DAILY_MARGIN), "Premium style should be DAILY_MARGIN"); double futurePrice = futurePrice(futureOption, ratesProvider); return priceSensitivityRatesStickyStrike(futureOption, ratesProvider, volatilities, futurePrice); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ResolvedIborFutureOption beanToCopy) { this.securityId = beanToCopy.getSecurityId(); this.putCall = beanToCopy.getPutCall(); this.strikePrice = beanToCopy.getStrikePrice(); this.expiry = beanToCopy.getExpiry(); this.premiumStyle = beanToCopy.getPremiumStyle(); this.rounding = beanToCopy.getRounding(); this.underlyingFuture = beanToCopy.getUnderlyingFuture(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1574023291: // securityId return ((ResolvedIborFutureOption) bean).getSecurityId(); case -219971059: // putCall return ((ResolvedIborFutureOption) bean).getPutCall(); case 50946231: // strikePrice return ((ResolvedIborFutureOption) bean).getStrikePrice(); case -1289159373: // expiry return ((ResolvedIborFutureOption) bean).getExpiry(); case -1257652838: // premiumStyle return ((ResolvedIborFutureOption) bean).getPremiumStyle(); case -142444: // rounding return ((ResolvedIborFutureOption) bean).getRounding(); case -165476480: // underlyingFuture return ((ResolvedIborFutureOption) bean).getUnderlyingFuture(); } return super.propertyGet(bean, propertyName, quiet); }
public void test_builder() { ResolvedIborFutureOption test = sut(); assertEquals(test.getSecurityId(), PRODUCT.getSecurityId()); assertEquals(test.getPutCall(), PRODUCT.getPutCall()); assertEquals(test.getStrikePrice(), PRODUCT.getStrikePrice()); assertEquals(test.getPremiumStyle(), PRODUCT.getPremiumStyle()); assertEquals(test.getExpiry(), PRODUCT.getExpiry()); assertEquals(test.getExpiryDate(), PRODUCT.getExpiryDate()); assertEquals(test.getRounding(), PRODUCT.getRounding()); assertEquals(test.getUnderlyingFuture(), PRODUCT.getUnderlyingFuture().resolve(REF_DATA)); assertEquals(test.getIndex(), PRODUCT.getUnderlyingFuture().getIndex()); }
/** * Calculates the price of the Ibor future option product * based on the price of the underlying future. * <p> * The price of the option is the price on the valuation date. * * @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 of the product, in decimal form */ public double price( ResolvedIborFutureOption futureOption, RatesProvider ratesProvider, NormalIborFutureOptionVolatilities volatilities, double futurePrice) { ArgChecker.isTrue(futureOption.getPremiumStyle().equals(FutureOptionPremiumStyle.DAILY_MARGIN), "Premium style should be DAILY_MARGIN"); ArgChecker.isTrue(futureOption.getUnderlyingFuture().getIndex().equals(volatilities.getIndex()), "Future index should be the same as data index"); 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.price(futurePrice, strike, timeToExpiry, volatility, futureOption.getPutCall()); }
/** * 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()); }
/** * Calculates the price sensitivity to the normal volatility used for the pricing of the Ibor future option * based on the price of the underlying future. * <p> * This sensitivity is also called the <i>price normal vega</i>. * * @param futureOption the option product * @param ratesProvider the rates provider * @param volatilities the volatilities * @param futurePrice the underlying future price, in decimal form * @return the sensitivity */ public IborFutureOptionSensitivity priceSensitivityModelParamsVolatility( 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); double vega = NormalFormulaRepository.vega(futurePrice, strike, timeToExpiry, volatility, futureOption.getPutCall()); return IborFutureOptionSensitivity.of( volatilities.getName(), timeToExpiry, future.getLastTradeDate(), strike, futurePrice, future.getCurrency(), vega); }