public virtual void test_pv01() { ScenarioMarketData md = IborCapFloorTradeCalculationFunctionTest.marketData(); RatesProvider provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); VolatilityIborCapFloorTradePricer pricer = VolatilityIborCapFloorTradePricer.DEFAULT; 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); assertEquals(IborCapFloorTradeCalculations.DEFAULT.pv01RatesCalibratedSum(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal))); assertEquals(IborCapFloorTradeCalculations.DEFAULT.pv01RatesCalibratedBucketed(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed))); }
//------------------------------------------------------------------------- public virtual void test_presentValue() { ScenarioMarketData md = IborCapFloorTradeCalculationFunctionTest.marketData(); RatesProvider provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); VolatilityIborCapFloorTradePricer pricer = VolatilityIborCapFloorTradePricer.DEFAULT; MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider, VOLS); assertEquals(IborCapFloorTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv))); assertEquals(IborCapFloorTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure))); assertEquals(IborCapFloorTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash))); }