public void test_marginIndex() { double price = 0.12d; double computed = OPTION_PRICER.marginIndex(FUTURE_OPTION_PRODUCT, price); assertEquals(computed, price * FUTURE_OPTION_PRODUCT.getUnderlyingFuture().getNotional()); }
/** * Calculates the present value of the bond future option trade from the current option price. * <p> * The present value of the product is the value on the valuation date. * The current price is specified, not calculated. * <p> * This method calculates based on the difference between the specified current price and the * last settlement price, or the trade price if traded on the valuation date. * * @param trade the trade * @param valuationDate the valuation date; required to asses if the trade or last closing price should be used * @param currentOptionPrice the option price on the valuation date * @param lastOptionSettlementPrice the last settlement price used for margining for the option, in decimal form * @return the present value */ public CurrencyAmount presentValue( ResolvedBondFutureOptionTrade trade, LocalDate valuationDate, double currentOptionPrice, double lastOptionSettlementPrice) { ResolvedBondFutureOption option = trade.getProduct(); double referencePrice = referencePrice(trade, valuationDate, lastOptionSettlementPrice); double priceIndex = productPricer.marginIndex(option, currentOptionPrice); double referenceIndex = productPricer.marginIndex(option, referencePrice); double pv = (priceIndex - referenceIndex) * trade.getQuantity(); return CurrencyAmount.of(option.getUnderlyingFuture().getCurrency(), pv); }
/** * Computes the present value sensitivity to the Black volatility used in the pricing * based on the price of the underlying future. * <p> * The result is a single sensitivity to the volatility used. * The volatility is associated with the expiry/delay/strike/future price key combination. * * @param futureOptionTrade the trade * @param discountingProvider the discounting provider * @param volatilities the volatilities * @param futurePrice the price of the underlying future * @return the price sensitivity */ public BondFutureOptionSensitivity presentValueSensitivityModelParamsVolatility( ResolvedBondFutureOptionTrade futureOptionTrade, LegalEntityDiscountingProvider discountingProvider, BlackBondFutureVolatilities volatilities, double futurePrice) { ResolvedBondFutureOption product = futureOptionTrade.getProduct(); BondFutureOptionSensitivity priceSensitivity = productPricer.priceSensitivityModelParamsVolatility(product, discountingProvider, volatilities, futurePrice); double factor = productPricer.marginIndex(product, 1) * futureOptionTrade.getQuantity(); return priceSensitivity.multipliedBy(factor); }