public virtual void test_pv01()
        {
            ScenarioMarketData             md                      = SwaptionTradeCalculationFunctionTest.marketData();
            RatesProvider                  provider                = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            VolatilitySwaptionTradePricer  pricer                  = VolatilitySwaptionTradePricer.DEFAULT;
            PointSensitivities             pvPointSens             = pricer.presentValueSensitivityRatesStickyStrike(RTRADE, provider, VOLS);
            CurrencyParameterSensitivities pvParamSens             = provider.parameterSensitivity(pvPointSens);
            MultiCurrencyAmount            expectedPv01Cal         = pvParamSens.total().multipliedBy(1e-4);
            CurrencyParameterSensitivities expectedPv01CalBucketed = pvParamSens.multipliedBy(1e-4);

            assertEquals(SwaptionTradeCalculations.DEFAULT.pv01RatesCalibratedSum(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(SwaptionTradeCalculations.DEFAULT.pv01RatesCalibratedBucketed(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData            md         = SwaptionTradeCalculationFunctionTest.marketData();
            RatesProvider                 provider   = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            VolatilitySwaptionTradePricer pricer     = VolatilitySwaptionTradePricer.DEFAULT;
            CurrencyAmount                expectedPv = pricer.presentValue(RTRADE, provider, VOLS);
            MultiCurrencyAmount           expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS);
            CurrencyAmount                expectedCurrentCash      = pricer.currentCash(RTRADE, provider.ValuationDate);

            assertEquals(SwaptionTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(SwaptionTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(SwaptionTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, SWAPTION_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
        }
Example #3
0
 /// <summary>
 /// Creates an instance.
 /// </summary>
 /// <param name="tradePricer">  the pricer for <seealso cref="ResolvedSwaptionTrade"/> </param>
 /// <param name="sabrTradePricer">  the pricer for <seealso cref="ResolvedSwaptionTrade"/> SABR </param>
 internal SwaptionMeasureCalculations(VolatilitySwaptionTradePricer tradePricer, SabrSwaptionTradePricer sabrTradePricer)
 {
     this.tradePricer     = ArgChecker.notNull(tradePricer, "tradePricer");
     this.sabrTradePricer = ArgChecker.notNull(sabrTradePricer, "sabrTradePricer");
 }
 /// <summary>
 /// Creates an instance.
 /// <para>
 /// In most cases, applications should use the <seealso cref="#DEFAULT"/> instance.
 ///
 /// </para>
 /// </summary>
 /// <param name="tradePricer">  the pricer for <seealso cref="ResolvedSwaptionTrade"/> </param>
 /// <param name="sabrTradePricer">  the pricer for <seealso cref="ResolvedSwaptionTrade"/> SABR </param>
 public SwaptionTradeCalculations(VolatilitySwaptionTradePricer tradePricer, SabrSwaptionTradePricer sabrTradePricer)
 {
     this.calc = new SwaptionMeasureCalculations(tradePricer, sabrTradePricer);
 }