//------------------------------------------------------------------------- public virtual void test_presentValue() { ScenarioMarketData md = CmsTradeCalculationFunctionTest.marketData(); RatesProvider provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); SabrExtrapolationReplicationCmsTradePricer pricer = new SabrExtrapolationReplicationCmsTradePricer(new SabrExtrapolationReplicationCmsProductPricer(new SabrExtrapolationReplicationCmsLegPricer(SabrExtrapolationReplicationCmsPeriodPricer.of(CMS_MODEL.CutOffStrike, CMS_MODEL.Mu)))); MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider, VOLS); CmsTradeCalculations calcs = CmsTradeCalculations.of(CMS_MODEL); assertEquals(calcs.presentValue(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv))); assertEquals(calcs.currencyExposure(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure))); assertEquals(calcs.currentCash(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash))); }
// currency exposure for one scenario internal MultiCurrencyAmount currencyExposure(ResolvedCmsTrade trade, RatesProvider ratesProvider, SwaptionVolatilities volatilities) { return(tradePricer.currencyExposure(trade, ratesProvider, checkSabr(volatilities))); }