Ejemplo n.º 1
0
        public virtual void test_pv01()
        {
            ScenarioMarketData             md                      = FraTradeCalculationFunctionTest.marketData();
            RatesProvider                  provider                = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingFraTradePricer      pricer                  = DiscountingFraTradePricer.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(FraTradeCalculations.DEFAULT.pv01CalibratedSum(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(FraTradeCalculations.DEFAULT.pv01CalibratedBucketed(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData        md                 = FraTradeCalculationFunctionTest.marketData();
            RatesProvider             provider           = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingFraTradePricer pricer             = DiscountingFraTradePricer.DEFAULT;
            CurrencyAmount            expectedPv         = pricer.presentValue(RTRADE, provider);
            ExplainMap          expectedExplainPv        = pricer.explainPresentValue(RTRADE, provider);
            double              expectedParRate          = pricer.parRate(RTRADE, provider);
            double              expectedParSpread        = pricer.parSpread(RTRADE, provider);
            CashFlows           expectedCashFlows        = pricer.cashFlows(RTRADE, provider);
            MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider);
            CurrencyAmount      expectedCurrentCash      = pricer.currentCash(RTRADE, provider);

            assertEquals(FraTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(FraTradeCalculations.DEFAULT.explainPresentValue(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedExplainPv)));
            assertEquals(FraTradeCalculations.DEFAULT.parRate(RTRADE, RATES_LOOKUP, md), DoubleScenarioArray.of(ImmutableList.of(expectedParRate)));
            assertEquals(FraTradeCalculations.DEFAULT.parSpread(RTRADE, RATES_LOOKUP, md), DoubleScenarioArray.of(ImmutableList.of(expectedParSpread)));
            assertEquals(FraTradeCalculations.DEFAULT.cashFlows(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedCashFlows)));
            assertEquals(FraTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(FraTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
        }