/** * Calculates the price sensitivity of the Ibor future product. * <p> * The price sensitivity of the product is the sensitivity of the price to the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @return the price curve sensitivity of the product */ public PointSensitivities priceSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider) { return productPricer.priceSensitivity(trade.getProduct(), ratesProvider); }
/** * Calculates the price of the Ibor future trade. * <p> * The price of the trade is the price on the valuation date. * The price is calculated using the discounting model. * * @param trade the trade * @param ratesProvider the rates provider * @return the price of the trade, in decimal form */ public double price(ResolvedIborFutureTrade trade, RatesProvider ratesProvider) { return productPricer.price(trade.getProduct(), ratesProvider); }
/** * Calculates the par spread sensitivity of the Ibor future trade. * <p> * The par spread sensitivity of the trade is the sensitivity of the par spread to * the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @return the par spread curve sensitivity of the trade */ public PointSensitivities parSpreadSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider) { return productPricer.priceSensitivity(trade.getProduct(), ratesProvider); }
/** * Calculates the price sensitivity of the Ibor future product. * <p> * The price sensitivity of the product is the sensitivity of the price to the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @param hwProvider the Hull-White model parameter provider * @return the price curve sensitivity of the product */ public PointSensitivities priceSensitivityRates( ResolvedIborFutureTrade trade, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) { return productPricer.priceSensitivityRates(trade.getProduct(), ratesProvider, hwProvider); }
/** * Calculates the par spread sensitivity of the Ibor future trade. * <p> * The par spread sensitivity of the trade is the sensitivity of the par spread to * the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @param hwProvider the Hull-White model parameter provider * @return the par spread curve sensitivity of the trade */ public PointSensitivities parSpreadSensitivityRates( ResolvedIborFutureTrade trade, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) { return productPricer.priceSensitivityRates(trade.getProduct(), ratesProvider, hwProvider); }
/** * Calculates the price of the Ibor future trade. * <p> * The price of the trade is the price on the valuation date. * The price is calculated using the Hull-White model. * * @param trade the trade * @param ratesProvider the rates provider * @param hwProvider the Hull-White model parameter provider * @return the price of the trade, in decimal form */ public double price( ResolvedIborFutureTrade trade, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) { return productPricer.price(trade.getProduct(), ratesProvider, hwProvider); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ResolvedIborFutureTrade beanToCopy) { this.info = beanToCopy.getInfo(); this.product = beanToCopy.getProduct(); this.quantity = beanToCopy.getQuantity(); this.tradedPrice = beanToCopy.tradedPrice; }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 3237038: // info return ((ResolvedIborFutureTrade) bean).getInfo(); case -309474065: // product return ((ResolvedIborFutureTrade) bean).getProduct(); case -1285004149: // quantity return ((ResolvedIborFutureTrade) bean).getQuantity(); case -1873824343: // tradedPrice return ((ResolvedIborFutureTrade) bean).tradedPrice; } return super.propertyGet(bean, propertyName, quiet); }
/** * Calculates the present value sensitivity of the Ibor future trade. * <p> * The present value sensitivity of the trade is the sensitivity of the present value to * the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @return the present value curve sensitivity of the trade */ public PointSensitivities presentValueSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider) { ResolvedIborFuture product = trade.getProduct(); PointSensitivities priceSensi = productPricer.priceSensitivity(product, ratesProvider); PointSensitivities marginIndexSensi = productPricer.marginIndexSensitivity(product, priceSensi); return marginIndexSensi.multipliedBy(trade.getQuantity()); }
/** * Calculates the present value sensitivity of the Ibor future trade. * <p> * The present value sensitivity of the trade is the sensitivity of the present value to * the underlying curves. * * @param trade the trade * @param ratesProvider the rates provider * @param hwProvider the Hull-White model parameter provider * @return the present value curve sensitivity of the trade */ public PointSensitivities presentValueSensitivityRates( ResolvedIborFutureTrade trade, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) { ResolvedIborFuture product = trade.getProduct(); PointSensitivities priceSensi = productPricer.priceSensitivityRates(product, ratesProvider, hwProvider); PointSensitivities marginIndexSensi = productPricer.marginIndexSensitivity(product, priceSensi); return marginIndexSensi.multipliedBy(trade.getQuantity()); }
public void test_builder() { ResolvedIborFutureTrade test = sut(); assertEquals(test.getInfo(), TRADE_INFO); assertEquals(test.getProduct(), PRODUCT); assertEquals(test.getQuantity(), QUANTITY); assertEquals(test.getTradedPrice(), Optional.of(TradedPrice.of(TRADE_DATE, PRICE))); }
public void test_presentValue() { double currentPrice = 0.995; double referencePrice = 0.9925; double currentPriceIndex = PRICER_PRODUCT.marginIndex(FUTURE_TRADE.getProduct(), currentPrice); double referencePriceIndex = PRICER_PRODUCT.marginIndex(FUTURE_TRADE.getProduct(), referencePrice); double presentValueExpected = (currentPriceIndex - referencePriceIndex) * FUTURE_TRADE.getQuantity(); CurrencyAmount presentValueComputed = PRICER_TRADE.presentValue(FUTURE_TRADE, currentPrice, referencePrice); assertEquals(presentValueComputed.getAmount(), presentValueExpected, TOLERANCE_PV); }
/** * Calculates the present value sensitivity to piecewise constant volatility parameters of the Hull-White model. * * @param trade the trade to price * @param ratesProvider the rates provider * @param hwProvider the Hull-White model parameter provider * @return the present value parameter sensitivity of the trade */ public DoubleArray presentValueSensitivityModelParamsHullWhite( ResolvedIborFutureTrade trade, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) { ResolvedIborFuture product = trade.getProduct(); DoubleArray hwSensi = productPricer.priceSensitivityModelParamsHullWhite(product, ratesProvider, hwProvider); hwSensi = hwSensi.multipliedBy(product.getNotional() * product.getAccrualFactor() * trade.getQuantity()); return hwSensi; }
public void test_resolve() { IborFutureTrade test = sut(); ResolvedIborFutureTrade resolved = test.resolve(REF_DATA); assertEquals(resolved.getInfo(), TRADE_INFO); assertEquals(resolved.getProduct(), PRODUCT.resolve(REF_DATA)); assertEquals(resolved.getQuantity(), QUANTITY); assertEquals(resolved.getTradedPrice(), Optional.of(TradedPrice.of(TRADE_DATE, PRICE))); }
/** * Calculates the present value of the Ibor future trade from the current price. * <p> * The present value of the product is the value on the valuation date. * <p> * The calculation is performed against a reference price. The reference price * must be the last settlement price used for margining, except on the trade date, * when it must be the trade price. * * @param trade the trade * @param currentPrice the current price, in decimal form * @param referencePrice the reference price to margin against, typically the last settlement price, in decimal form * @return the present value */ CurrencyAmount presentValue(ResolvedIborFutureTrade trade, double currentPrice, double referencePrice) { ResolvedIborFuture future = trade.getProduct(); double priceIndex = productPricer.marginIndex(future, currentPrice); double referenceIndex = productPricer.marginIndex(future, referencePrice); double pv = (priceIndex - referenceIndex) * trade.getQuantity(); return CurrencyAmount.of(future.getCurrency(), pv); }
/** * Calculates the present value of the Ibor future trade from the current price. * <p> * The present value of the product is the value on the valuation date. * <p> * The calculation is performed against a reference price. The reference price * must be the last settlement price used for margining, except on the trade date, * when it must be the trade price. * * @param trade the trade * @param currentPrice the current price, in decimal form * @param referencePrice the reference price to margin against, typically the last settlement price, in decimal form * @return the present value */ CurrencyAmount presentValue(ResolvedIborFutureTrade trade, double currentPrice, double referencePrice) { ResolvedIborFuture future = trade.getProduct(); double priceIndex = productPricer.marginIndex(future, currentPrice); double referenceIndex = productPricer.marginIndex(future, referencePrice); double pv = (priceIndex - referenceIndex) * trade.getQuantity(); return CurrencyAmount.of(future.getCurrency(), pv); }