BondFutureDiscountingMethod extends BondFutureMethod { public double[] netBasisAllBonds(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 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 netBasisAllBonds() { final double priceFuture = METHOD_FUT_DSC.price(BOND_FUTURE, ISSUER_MULTICURVES); final double[] netBasisComputed = METHOD_FUT_DSC.netBasisAllBonds(BOND_FUTURE, ISSUER_MULTICURVES, priceFuture); final double[] netBasisExpected = new double[NB_BOND]; for (int loopbasket = 0; loopbasket < NB_BOND; loopbasket++) { final double bondPriceForward = METHOD_BOND.dirtyPriceFromCurves(BOND_FUTURE.getDeliveryBasket()[loopbasket], ISSUER_MULTICURVES); netBasisExpected[loopbasket] = bondPriceForward - (priceFuture * CONVERSION_FACTOR[loopbasket] + BOND_FUTURE.getDeliveryBasket()[loopbasket].getAccruedInterest()); assertEquals("Bond future security Discounting Method: netBasis", netBasisExpected[loopbasket], netBasisComputed[loopbasket], 1.0E-10); } final Min minFunction = new Min(); final double netBasisMin = minFunction.evaluate(netBasisComputed); final double priceFutureFromNetBasis = METHOD_FUT_DSC.priceFromNetBasis(BOND_FUTURE, ISSUER_MULTICURVES, netBasisMin); assertEquals("Bond future security Discounting Method: netBasis", priceFuture, priceFutureFromNetBasis, 1.0E-10); }