BondFutureConversionFactorMethod { public double conversionFactorLiffe(final BondFixedSecurityDefinition bondDefinition, final ZonedDateTime deliveryDate, final double notionalCoupon) { Validate.notNull(bondDefinition, "Bond definition"); Validate.notNull(deliveryDate, "Delivery date"); final BondFixedSecurity bond = bondDefinition.toDerivative(deliveryDate, deliveryDate); final double cleanPrice = METHOD_BOND_SECURITY.cleanPriceFromYield(bond, notionalCoupon); return cleanPrice; }  double conversionFactorLiffe(final BondFixedSecurityDefinition bondDefinition, final ZonedDateTime deliveryDate, final double notionalCoupon); double conversionFactorEuronext(final BondFixedSecurityDefinition bondDefinition, final ZonedDateTime deliveryDate, final double notionalCoupon);  }
@Test public void conversionFactorLiffe() { double notionalCoupon = 0.03; double[][] conversionFactorExternal = new double[][] { {0.9836635, 1.0526713, 0.9925377}, {0.9854333, 1.0481364, 0.9931048}}; double[][] conversionFactorComputed = new double[G_FIRST_DELIVERY_DATE.length][G_NB_BOND]; double[][] diff = new double[G_FIRST_DELIVERY_DATE.length][G_NB_BOND]; for (int loopexp = 0; loopexp < G_FIRST_DELIVERY_DATE.length; loopexp++) { for (int loopbnd = 0; loopbnd < G_NB_BOND; loopbnd++) { conversionFactorComputed[loopexp][loopbnd] = METHOD_CONVERSION.conversionFactorLiffe(G_BASKET_DEFINITION[loopbnd], G_FIRST_DELIVERY_DATE[loopexp], notionalCoupon); diff[loopexp][loopbnd] = conversionFactorComputed[loopexp][loopbnd] - conversionFactorExternal[loopexp][loopbnd]; } assertArrayEquals("Bond futures conversion factor: LIFFE", conversionFactorExternal[loopexp], conversionFactorComputed[loopexp], TOLERANCE_FACTOR_LIFFE); } }