BondFutureDiscountingMethod extends BondFutureMethod { public MulticurveSensitivity priceCurveSensitivity(final BondFuture future, final IssuerProviderInterface issuerMulticurves) { ArgumentChecker.notNull(future, "Future"); ArgumentChecker.notNull(issuerMulticurves, "Issuer and multi-curves provider"); final double[] priceFromBond = new double[future.getDeliveryBasket().length]; int indexCTD = 0; double priceMin = 2.0; for (int loopbasket = 0; loopbasket < future.getDeliveryBasket().length; loopbasket++) { priceFromBond[loopbasket] = (BOND_METHOD.cleanPriceFromCurves(future.getDeliveryBasket()[loopbasket], issuerMulticurves)) / future.getConversionFactor()[loopbasket]; if (priceFromBond[loopbasket] < priceMin) { priceMin = priceFromBond[loopbasket]; indexCTD = loopbasket; } } MulticurveSensitivity result = BOND_METHOD.dirtyPriceCurveSensitivity(future.getDeliveryBasket()[indexCTD], issuerMulticurves); return result.multipliedBy(1.0 / future.getConversionFactor()[indexCTD]); } private  BondFutureDiscountingMethod(); static BondFutureDiscountingMethod getInstance(); double price(final BondFuture future, final IssuerProviderInterface issuerMulticurves); double priceFromNetBasis(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double netBasis); MultipleCurrencyAmount presentValue(final BondFuture future, final IssuerProviderInterface issuerMulticurves); MultipleCurrencyAmount presentValueFromNetBasis(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double netBasis); MulticurveSensitivity priceCurveSensitivity(final BondFuture future, final IssuerProviderInterface issuerMulticurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BondFuture future, final IssuerProviderInterface issuerMulticurves); double[] grossBasisFromPrices(final BondFuture future, final double[] cleanPrices, final double futurePrice); double[] grossBasisFromCurves(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double futurePrice); double[] netBasisAllBonds(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double futurePrice); double netBasisCheapest(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double futurePrice);  }
@Test public void priceCurveSensitivity() { MulticurveSensitivity sensiFuture = METHOD_FUT_DSC.priceCurveSensitivity(BOND_FUTURE, ISSUER_MULTICURVES); final double[] bondForwardPrice = new double[NB_BOND]; final double[] bondFuturePrice = new double[NB_BOND]; double minPrice = 100.0; int minIndex = 0; for (int loopbasket = 0; loopbasket < NB_BOND; loopbasket++) { bondForwardPrice[loopbasket] = METHOD_BOND.dirtyPriceFromCurves(BASKET[loopbasket], ISSUER_MULTICURVES); bondFuturePrice[loopbasket] = (bondForwardPrice[loopbasket] - BASKET[loopbasket].getAccruedInterest()) / CONVERSION_FACTOR[loopbasket]; if (bondFuturePrice[loopbasket] < minPrice) { minPrice = (bondForwardPrice[loopbasket] - BASKET[loopbasket].getAccruedInterest()) / CONVERSION_FACTOR[loopbasket]; minIndex = loopbasket; } } MulticurveSensitivity sensiBond = METHOD_BOND.dirtyPriceCurveSensitivity(BASKET[minIndex], ISSUER_MULTICURVES); sensiBond = sensiBond.multipliedBy(1.0 / CONVERSION_FACTOR[minIndex]); sensiFuture = sensiFuture.cleaned(); sensiBond = sensiBond.cleaned(); AssertSensitivityObjects.assertEquals("BondFutureSecurityDiscountingMethod: priceCurveSensitivity", sensiBond, sensiFuture, TOLERANCE_PRICE_DELTA); }