BondFutureDiscountingMethod extends BondFutureMethod { public double netBasisCheapest(final BondFuture future, final IssuerProviderInterface issuerMulticurves, final double futurePrice) { ArgumentChecker.notNull(future, "Future"); ArgumentChecker.notNull(issuerMulticurves, "Issuer and multi-curves provider"); final int nbBasket = future.getDeliveryBasket().length; final double[] netBasis = new double[nbBasket]; for (int loopbasket = 0; loopbasket < future.getDeliveryBasket().length; loopbasket++) { netBasis[loopbasket] = BOND_METHOD.cleanPriceFromCurves(future.getDeliveryBasket()[loopbasket], issuerMulticurves) - futurePrice * future.getConversionFactor()[loopbasket]; } return MIN_FUNCTION.evaluate(netBasis); } 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 netBasisCheapest() { final double netBasisInput = 0.0001; final double priceFuture = METHOD_FUT_DSC.price(BOND_FUTURE, ISSUER_MULTICURVES) + netBasisInput; final double netBasisCheapest = METHOD_FUT_DSC.netBasisCheapest(BOND_FUTURE, ISSUER_MULTICURVES, priceFuture); final double[] netBasisAll = METHOD_FUT_DSC.netBasisAllBonds(BOND_FUTURE, ISSUER_MULTICURVES, priceFuture); assertEquals("Bond future security Discounting Method: netBasis", MIN_FUNCTION.evaluate(netBasisAll), netBasisCheapest, TOLERANCE_PRICE); }