public virtual void convexityFromYieldUS() { double computed = PRICER.convexityFromYield(PRODUCT_US, SETTLEMENT_US, YIELD_US); double duration = PRICER.modifiedDurationFromYield(PRODUCT_US, SETTLEMENT_US, YIELD_US); double durationUp = PRICER.modifiedDurationFromYield(PRODUCT_US, SETTLEMENT_US, YIELD_US + EPS); double durationDw = PRICER.modifiedDurationFromYield(PRODUCT_US, SETTLEMENT_US, YIELD_US - EPS); double expected = 0.5 * (durationDw - durationUp) / EPS + duration * duration; assertEquals(computed, expected, EPS); }