Пример #1
0
        public virtual void test_currentCash_onPayment()
        {
            double eps = 1.0e-14;
            ImmutableRatesProvider prov = ImmutableRatesProvider.builder(FX_RESET_NOTIONAL_EXCHANGE_REC_USD.PaymentDate).fxRateProvider(FX_MATRIX).discountCurve(GBP, DISCOUNT_CURVE_GBP).discountCurve(USD, DISCOUNT_CURVE_USD).build();
            DiscountingFxResetNotionalExchangePricer test = new DiscountingFxResetNotionalExchangePricer();
            double rate  = prov.fxIndexRates(FX_RESET_NOTIONAL_EXCHANGE_REC_USD.Observation.Index).rate(FX_RESET_NOTIONAL_EXCHANGE_REC_USD.Observation, FX_RESET_NOTIONAL_EXCHANGE_REC_USD.ReferenceCurrency);
            double ccUSD = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_REC_USD, prov);

            assertEquals(ccUSD, NOTIONAL * rate, eps);
            double ccGBP = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_PAY_GBP, prov);

            assertEquals(ccGBP, -NOTIONAL / rate, eps);
        }
Пример #2
0
        public virtual void test_currentCash_zero()
        {
            ImmutableRatesProvider prov = ImmutableRatesProvider.builder(VAL_DATE).fxRateProvider(FX_MATRIX).discountCurve(GBP, DISCOUNT_CURVE_GBP).discountCurve(USD, DISCOUNT_CURVE_USD).build();
            DiscountingFxResetNotionalExchangePricer test = new DiscountingFxResetNotionalExchangePricer();
            double cc = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_REC_USD, prov);

            assertEquals(cc, 0d);
        }