// present value for one scenario internal MultiCurrencyAmount presentValue(ResolvedFxVanillaOptionTrade trade, RatesProvider ratesProvider, FxOptionVolatilities volatilities, FxVanillaOptionMethod method) { if (method == FxVanillaOptionMethod.VANNA_VOLGA) { return(vannaVolgaPricer.presentValue(trade, ratesProvider, checkVannaVolgaVolatilities(volatilities))); } else { return(blackPricer.presentValue(trade, ratesProvider, checkBlackVolatilities(volatilities))); } }
//------------------------------------------------------------------------- public virtual void test_presentValue() { ScenarioMarketData md = FxVanillaOptionTradeCalculationFunctionTest.marketData(); RatesProvider provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); BlackFxVanillaOptionTradePricer pricer = BlackFxVanillaOptionTradePricer.DEFAULT; MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS); CurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider.ValuationDate); assertEquals(FxVanillaOptionTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, FX_OPTION_LOOKUP, md, BLACK), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv))); assertEquals(FxVanillaOptionTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, FX_OPTION_LOOKUP, md, BLACK), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure))); assertEquals(FxVanillaOptionTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, FX_OPTION_LOOKUP, md, BLACK), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash))); }