@Test /** Test the price as "MarketQuote" */ public void marketQuote() { final double priceMethod = METHOD_IRFUT_HW.price(ERU2, HW_MULTICURVES); final double marketQuote = ERU2.accept(MQHWC, HW_MULTICURVES); assertEquals( "InterestRateFutureSecurityHullWhiteProviderMethod: price", priceMethod, marketQuote, TOLERANCE_PRICE); }
@Test /** Compare the price with a price without convexity adjustment. */ public void comparisonDiscounting() { final YieldCurveBundle curves = TestsDataSets.createCurves1(); final InterestRateFutureSecurityDiscountingMethod methodDiscounting = InterestRateFutureSecurityDiscountingMethod.getInstance(); final double priceDiscounting = methodDiscounting.priceFromCurves(ERU2, curves); final double priceHullWhite = METHOD.price(ERU2, curves); assertTrue( "Future price comparison with no convexity adjustment", priceDiscounting > priceHullWhite); }
@Test /** Test the par rate computed from the curves and HW parameters. Par rate = 1-price. */ public void parRate() { final double price = METHOD_IRFUT_HW.price(ERU2, HW_MULTICURVES); final double parRateExpected = 1.0d - price; final double parRateComputed = METHOD_IRFUT_HW.parRate(ERU2, HW_MULTICURVES); assertEquals( "InterestRateFutureSecurityHullWhiteProviderMethod: parRate", parRateExpected, parRateComputed, TOLERANCE_PRICE); }
@Test /** Test the price computed from the curves */ public void price() { final YieldCurveBundle curves = TestsDataSets.createCurves1(); final double price = METHOD.price(ERU2, curves); final YieldAndDiscountCurve forwardCurve = curves.getCurve(FORWARD_CURVE_NAME); final double forward = (forwardCurve.getDiscountFactor(FIXING_START_TIME) / forwardCurve.getDiscountFactor(FIXING_END_TIME) - 1) / FIXING_ACCRUAL; final double factor = MODEL.futureConvexityFactor(ERU2, MODEL_PARAMETERS); final double expectedPrice = 1.0 - factor * forward + (1 - factor) / FIXING_ACCRUAL; assertEquals("Future price from curves in Hull-White one factor model", expectedPrice, price); }
@Test /** Test the convexity adjustment */ public void convexityAdjustment() { final double price = METHOD_IRFUT_HW.price(ERU2, HW_MULTICURVES); final double forward = MULTICURVES.getSimplyCompoundForwardRate( EURIBOR3M, ERU2.getFixingPeriodStartTime(), ERU2.getFixingPeriodEndTime(), ERU2.getFixingPeriodAccrualFactor()); final double convexityAdjustment = METHOD_IRFUT_HW.convexityAdjustment(ERU2, HW_MULTICURVES); assertEquals( "InterestRateFutureSecurityHullWhiteProviderMethod: convexity adjustment", price - (1.0d - forward), convexityAdjustment, TOLERANCE_PRICE); final double caCalculator = ERU2.accept(CAHWC, HW_MULTICURVES); assertEquals( "DeliverableSwapFuturesSecurityDefinition: convexity adjustment", caCalculator, convexityAdjustment, TOLERANCE_PRICE); }
@Test /** Test the price computed from the curves and HW parameters. */ public void price() { final double price = METHOD_IRFUT_HW.price(ERU2, HW_MULTICURVES); final double forward = MULTICURVES.getSimplyCompoundForwardRate( EURIBOR3M, ERU2.getFixingPeriodStartTime(), ERU2.getFixingPeriodEndTime(), ERU2.getFixingPeriodAccrualFactor()); final double factor = MODEL.futuresConvexityFactor( MODEL_PARAMETERS, ERU2.getTradingLastTime(), ERU2.getFixingPeriodStartTime(), ERU2.getFixingPeriodEndTime()); final double expectedPrice = 1.0 - factor * forward + (1 - factor) / ERU2.getFixingPeriodAccrualFactor(); assertEquals( "InterestRateFutureSecurityHullWhiteProviderMethod: price", expectedPrice, price, TOLERANCE_PRICE); }