Example #1
0
        //-------------------------------------------------------------------------
        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)));
        }
Example #2
0
 // present value for one scenario
 internal MultiCurrencyAmount presentValue(ResolvedCmsTrade trade, RatesProvider ratesProvider, SwaptionVolatilities volatilities)
 {
     return(tradePricer.presentValue(trade, ratesProvider, checkSabr(volatilities)));
 }