public virtual void test_pv01_calibrated()
        {
            ScenarioMarketData               md                      = BondFutureTradeCalculationFunctionTest.marketData();
            LegalEntityDiscountingProvider   provider                = LOOKUP.marketDataView(md.scenario(0)).discountingProvider();
            DiscountingBondFutureTradePricer pricer                  = DiscountingBondFutureTradePricer.DEFAULT;
            PointSensitivities               pvPointSens             = pricer.presentValueSensitivity(RTRADE, provider);
            CurrencyParameterSensitivities   pvParamSens             = provider.parameterSensitivity(pvPointSens);
            MultiCurrencyAmount              expectedPv01Cal         = pvParamSens.total().multipliedBy(1e-4);
            CurrencyParameterSensitivities   expectedPv01CalBucketed = pvParamSens.multipliedBy(1e-4);

            assertEquals(BondFutureTradeCalculations.DEFAULT.pv01CalibratedSum(RTRADE, LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(BondFutureTradeCalculations.DEFAULT.pv01CalibratedBucketed(RTRADE, LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
        public virtual void test_pv01_quote()
        {
            ScenarioMarketData               md                      = BondFutureTradeCalculationFunctionTest.marketData();
            LegalEntityDiscountingProvider   provider                = LOOKUP.marketDataView(md.scenario(0)).discountingProvider();
            DiscountingBondFutureTradePricer pricer                  = DiscountingBondFutureTradePricer.DEFAULT;
            PointSensitivities               pvPointSens             = pricer.presentValueSensitivity(RTRADE, provider);
            CurrencyParameterSensitivities   pvParamSens             = provider.parameterSensitivity(pvPointSens);
            CurrencyParameterSensitivities   expectedPv01CalBucketed = MQ_CALC.sensitivity(pvParamSens.multipliedBy(1e-4), provider);
            MultiCurrencyAmount              expectedPv01Cal         = expectedPv01CalBucketed.total();

            MultiCurrencyScenarioArray sumComputed = BondFutureTradeCalculations.DEFAULT.pv01MarketQuoteSum(RTRADE, LOOKUP, md);
            ScenarioArray <CurrencyParameterSensitivities> bucketedComputed = BondFutureTradeCalculations.DEFAULT.pv01MarketQuoteBucketed(RTRADE, LOOKUP, md);

            assertEquals(sumComputed.ScenarioCount, 1);
            assertEquals(sumComputed.get(0).Currencies, ImmutableSet.of(USD));
            assertTrue(DoubleMath.fuzzyEquals(sumComputed.get(0).getAmount(USD).Amount, expectedPv01Cal.getAmount(USD).Amount, 1.0e-10));
            assertEquals(bucketedComputed.ScenarioCount, 1);
            assertTrue(bucketedComputed.get(0).equalWithTolerance(expectedPv01CalBucketed, 1.0e-10));
        }
Beispiel #3
0
        // calibrated sum PV01 for one scenario
        internal MultiCurrencyAmount pv01CalibratedSum(ResolvedBondFutureTrade trade, LegalEntityDiscountingProvider discountingProvider)
        {
            PointSensitivities pointSensitivity = tradePricer.presentValueSensitivity(trade, discountingProvider);

            return(discountingProvider.parameterSensitivity(pointSensitivity).total().multipliedBy(ONE_BASIS_POINT));
        }