예제 #1
0
        public virtual void test_pv01()
        {
            ScenarioMarketData             md                      = FxSingleTradeCalculationFunctionTest.marketData();
            RatesProvider                  provider                = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingFxSingleTradePricer pricer                  = DiscountingFxSingleTradePricer.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(FxSingleTradeCalculations.DEFAULT.pv01CalibratedSum(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(FxSingleTradeCalculations.DEFAULT.pv01CalibratedBucketed(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
예제 #2
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData             md         = FxSingleTradeCalculationFunctionTest.marketData();
            RatesProvider                  provider   = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingFxSingleTradePricer pricer     = DiscountingFxSingleTradePricer.DEFAULT;
            MultiCurrencyAmount            expectedPv = pricer.presentValue(RTRADE, provider);
            MultiCurrencyAmount            expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider);
            MultiCurrencyAmount            expectedCurrentCash      = pricer.currentCash(RTRADE, provider);
            FxRate expectedForwardFx = pricer.forwardFxRate(RTRADE, provider);

            assertEquals(FxSingleTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(FxSingleTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(FxSingleTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
            assertEquals(FxSingleTradeCalculations.DEFAULT.forwardFxRate(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedForwardFx)));
        }