ForexOptionVanillaBlackFlatMethod { public double impliedVolatility(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black) { Validate.notNull(optionForex, "Forex option"); Validate.notNull(black, "Smile"); final double volatility = black.getVolatility(optionForex.getCurrency1(), optionForex.getCurrency2(), optionForex.getTimeToExpiry()); return volatility; } private  ForexOptionVanillaBlackFlatMethod(); static ForexOptionVanillaBlackFlatMethod getInstance(); MultipleCurrencyAmount presentValue(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); double impliedVolatility(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); MultipleCurrencyAmount currencyExposure(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); double deltaRelative(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); double deltaRelativeSpot(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); double gammaRelative(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); double gammaRelativeSpot(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); CurrencyAmount gamma(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); CurrencyAmount gammaSpot(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black, final boolean directQuote); CurrencyAmount thetaTheoretical(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); double forwardForexRate(final ForexOptionVanilla optionForex, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); PresentValueForexBlackVolatilitySensitivity presentValueBlackVolatilitySensitivity(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black); double[] presentValueBlackVolatilityNodeSensitivity(final ForexOptionVanilla optionForex, final BlackForexFlatProviderInterface black);  }
@Test public void impliedVolatility() { final double ivCall = METHOD_BLACK_FLAT.impliedVolatility(CALL_LONG, BLACK_MULTICURVES); final double ivPut = METHOD_BLACK_FLAT.impliedVolatility(PUT_SHORT, BLACK_MULTICURVES); final double volExpected = BLACK_TS_VOL.getVolatility(CALL_LONG.getTimeToExpiry()); assertEquals("Forex vanilla option: implied volatility", ivCall, volExpected, TOLERANCE_VOL); assertEquals("Forex vanilla option: implied volatility", ivPut, volExpected, TOLERANCE_VOL); }