//-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData            md         = SwaptionTradeCalculationFunctionTest.marketData();
            RatesProvider                 provider   = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            VolatilitySwaptionTradePricer pricer     = VolatilitySwaptionTradePricer.DEFAULT;
            CurrencyAmount                expectedPv = pricer.presentValue(RTRADE, provider, VOLS);
            MultiCurrencyAmount           expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS);
            CurrencyAmount                expectedCurrentCash      = pricer.currentCash(RTRADE, provider.ValuationDate);

            assertEquals(SwaptionTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(SwaptionTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(SwaptionTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
        }
示例#2
0
 // current cash for one scenario
 internal CurrencyAmount currentCash(ResolvedSwaptionTrade trade, LocalDate valuationDate)
 {
     return(tradePricer.currentCash(trade, valuationDate));
 }