Exemplo n.º 1
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)));
        }
Exemplo n.º 2
0
 // point sensitivity
 private PointSensitivities pointSensitivity(ResolvedCmsTrade trade, RatesProvider ratesProvider, SwaptionVolatilities volatilities)
 {
     return(tradePricer.presentValueSensitivityRates(trade, ratesProvider, checkSabr(volatilities)));
 }