Esempio n. 1
0
        public virtual void test_pv01_quote()
        {
            ScenarioMarketData             md                      = BillTradeCalculationFunctionTest.marketData();
            LegalEntityDiscountingProvider provider                = LOOKUP.marketDataView(md.scenario(0)).discountingProvider();
            PointSensitivities             pvPointSens             = PRICER.presentValueSensitivity(RTRADE, provider);
            CurrencyParameterSensitivities pvParamSens             = provider.parameterSensitivity(pvPointSens);
            CurrencyParameterSensitivities expectedPv01CalBucketed = MQ_CALC.sensitivity(pvParamSens, provider).multipliedBy(1e-4);
            MultiCurrencyAmount            expectedPv01Cal         = expectedPv01CalBucketed.total();

            assertEquals(BillTradeCalculations.DEFAULT.pv01MarketQuoteSum(RTRADE, LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(BillTradeCalculations.DEFAULT.pv01MarketQuoteBucketed(RTRADE, LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
            assertEquals(BillTradeCalculations.DEFAULT.pv01MarketQuoteSum(RTRADE, provider), expectedPv01Cal);
            assertEquals(BillTradeCalculations.DEFAULT.pv01MarketQuoteBucketed(RTRADE, provider), expectedPv01CalBucketed);
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData             md            = BillTradeCalculationFunctionTest.marketData();
            LegalEntityDiscountingProvider provider      = LOOKUP.marketDataView(md.scenario(0)).discountingProvider();
            CurrencyAmount      expectedPv               = PRICER.presentValue(RTRADE, provider);
            MultiCurrencyAmount expectedCurrencyExposure = PRICER.currencyExposure(RTRADE, provider);
            CurrencyAmount      expectedCurrentCash      = PRICER.currentCash(RTRADE, provider.ValuationDate);

            assertEquals(CALC.presentValue(RTRADE, LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(CALC.currencyExposure(RTRADE, LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(CALC.currentCash(RTRADE, LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
            assertEquals(CALC.presentValue(RTRADE, provider), expectedPv);
            assertEquals(CALC.currencyExposure(RTRADE, provider), expectedCurrencyExposure);
            assertEquals(CALC.currentCash(RTRADE, provider), expectedCurrentCash);
        }