SABRInterestRateParameters implements VolatilityModel<double[]> { public double getVolatility(final double expiryTime, final double maturity, final double strike, final double forward) { final DoublesPair expiryMaturity = DoublesPair.of(expiryTime, maturity); final SABRFormulaData data = new SABRFormulaData(getAlpha(expiryMaturity), getBeta(expiryMaturity), getRho(expiryMaturity), getNu(expiryMaturity)); final EuropeanVanillaOption option = new EuropeanVanillaOption(strike, expiryTime, true); final Function1D<SABRFormulaData, Double> funcSabrLongPayer = _sabrFunction.getVolatilityFunction(option, forward); return funcSabrLongPayer.evaluate(data); } SABRInterestRateParameters(final InterpolatedDoublesSurface alpha, final InterpolatedDoublesSurface beta, final InterpolatedDoublesSurface rho, final InterpolatedDoublesSurface nu);  SABRInterestRateParameters(final InterpolatedDoublesSurface alpha, final InterpolatedDoublesSurface beta, final InterpolatedDoublesSurface rho, final InterpolatedDoublesSurface nu,
      final VolatilityFunctionProvider<SABRFormulaData> sabrFormula); @Deprecated  SABRInterestRateParameters(final InterpolatedDoublesSurface alpha, final InterpolatedDoublesSurface beta, final InterpolatedDoublesSurface rho, final InterpolatedDoublesSurface nu,
      final DayCount dayCount); @Deprecated  SABRInterestRateParameters(final InterpolatedDoublesSurface alpha, final InterpolatedDoublesSurface beta, final InterpolatedDoublesSurface rho, final InterpolatedDoublesSurface nu,
      final DayCount dayCount, final VolatilityFunctionProvider<SABRFormulaData> sabrFormula); double getAlpha(final DoublesPair expiryMaturity); double getBeta(final DoublesPair expiryMaturity); double getRho(final DoublesPair expiryMaturity); double getNu(final DoublesPair expiryMaturity); @Deprecated DayCount getDayCount(); VolatilityFunctionProvider<SABRFormulaData> getSabrFunction(); InterpolatedDoublesSurface getAlphaSurface(); InterpolatedDoublesSurface getBetaSurface(); InterpolatedDoublesSurface getRhoSurface(); InterpolatedDoublesSurface getNuSurface(); double getVolatility(final double expiryTime, final double maturity, final double strike, final double forward); @Override /** * Return the volatility for a expiry/maturity/strike/forward array. * @param data An array of four doubles with [0] the expiry, [1] the maturity, [2] the strike, [3] the forward. * @return The volatility. */ Double getVolatility(final double[] data); double[] getVolatilityAdjoint(final double expiryTime, final double maturity, final double strike, final double forward); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { PARAMETERS.getVolatility(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testWrongData() { PARAMETERS.getVolatility(new double[] {1, 2, 3 }); }