Пример #1
0
        /// <summary>
        /// Creates an instance.
        /// </summary>
        /// <param name="cmsParams">  the CMS parameters </param>
        internal CmsMeasureCalculations(CmsSabrExtrapolationParams cmsParams)
        {
            SabrExtrapolationReplicationCmsPeriodPricer  periodPricer  = SabrExtrapolationReplicationCmsPeriodPricer.of(cmsParams.CutOffStrike, cmsParams.Mu);
            SabrExtrapolationReplicationCmsLegPricer     legPricer     = new SabrExtrapolationReplicationCmsLegPricer(periodPricer);
            SabrExtrapolationReplicationCmsProductPricer productPricer = new SabrExtrapolationReplicationCmsProductPricer(legPricer);
            SabrExtrapolationReplicationCmsTradePricer   tradePricer   = new SabrExtrapolationReplicationCmsTradePricer(productPricer);

            this.tradePricer = ArgChecker.notNull(tradePricer, "tradePricer");
        }
Пример #2
0
        public virtual void test_pv01()
        {
            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))));
            PointSensitivities             pvPointSens             = pricer.presentValueSensitivityRates(RTRADE, provider, VOLS);
            CurrencyParameterSensitivities pvParamSens             = provider.parameterSensitivity(pvPointSens);
            MultiCurrencyAmount            expectedPv01Cal         = pvParamSens.total().multipliedBy(1e-4);
            CurrencyParameterSensitivities expectedPv01CalBucketed = pvParamSens.multipliedBy(1e-4);

            CmsTradeCalculations calcs = CmsTradeCalculations.of(CMS_MODEL);

            assertEquals(calcs.pv01RatesCalibratedSum(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(calcs.pv01RatesCalibratedBucketed(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
Пример #3
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)));
        }