BondFuturesSecurityDiscountingMethod extends FuturesSecurityIssuerMethod { public double netBasisCheapest(final BondFuturesSecurity futures, final IssuerProviderInterface issuerMulticurves, final double futurePrice) { ArgumentChecker.notNull(futures, "Future"); ArgumentChecker.notNull(issuerMulticurves, "Issuer and multi-curves provider"); final int nbBasket = futures.getDeliveryBasketAtDeliveryDate().length; final double[] netBasis = new double[nbBasket]; for (int loopbasket = 0; loopbasket < futures.getDeliveryBasketAtDeliveryDate().length; loopbasket++) { netBasis[loopbasket] = BOND_METHOD.cleanPriceFromCurves(futures.getDeliveryBasketAtDeliveryDate()[loopbasket], issuerMulticurves) - futurePrice * futures.getConversionFactor()[loopbasket]; } return MIN_FUNCTION.evaluate(netBasis); } private  BondFuturesSecurityDiscountingMethod(); static BondFuturesSecurityDiscountingMethod getInstance(); double priceFromNetBasis(final BondFuturesSecurity futures, final IssuerProviderInterface issuerMulticurves, final double netBasis); double[] grossBasisFromPrices(final BondFuturesSecurity futures, final double[] cleanPrices, final double futurePrice); double[] grossBasisFromCurves(final BondFuturesSecurity futures, final IssuerProviderInterface issuerMulticurves, final double futurePrice); double[] netBasisAllBonds(final BondFuturesSecurity futures, final IssuerProviderInterface issuerMulticurves, final double futurePrice); double netBasisCheapest(final BondFuturesSecurity futures, final IssuerProviderInterface issuerMulticurves, final double futurePrice);  }
@Test public void netBasisCheapest() { final double netBasisInput = 0.0001; final double priceFuture = METHOD_FUT_SEC_DSC.price(BOND_FUTURE, ISSUER_MULTICURVES) + netBasisInput; final double netBasisCheapest = METHOD_FUT_SEC_DSC.netBasisCheapest(BOND_FUTURE, ISSUER_MULTICURVES, priceFuture); final double[] netBasisAll = METHOD_FUT_SEC_DSC.netBasisAllBonds(BOND_FUTURE, ISSUER_MULTICURVES, priceFuture); assertEquals("Bond future security Discounting Method: netBasis", MIN_FUNCTION.evaluate(netBasisAll), netBasisCheapest, TOLERANCE_PRICE); }