// current cash for one scenario
 internal CurrencyAmount currentCash(ResolvedFxVanillaOptionTrade trade, LocalDate valuationDate, FxVanillaOptionMethod method)
 {
     if (method == FxVanillaOptionMethod.VANNA_VOLGA)
     {
         return(vannaVolgaPricer.currentCash(trade, valuationDate));
     }
     else
     {
         return(blackPricer.currentCash(trade, valuationDate));
     }
 }
Exemple #2
0
        //-------------------------------------------------------------------------
        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)));
        }