public virtual void test_presentValueSensitivity_ended()
        {
            ResolvedFxSwap     product  = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_LONG_PAST, PAYMENT_DATE_PAST);
            PointSensitivities computed = PRICER.presentValueSensitivity(product, PROVIDER);

            assertEquals(computed, PointSensitivities.empty());
        }
        public virtual void test_parSpread_ended()
        {
            ResolvedFxSwap product   = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_LONG_PAST, PAYMENT_DATE_PAST);
            double         parSpread = PRICER.parSpread(product, PROVIDER);

            assertEquals(parSpread, 0d, TOL);
        }
        //-------------------------------------------------------------------------
        public virtual void test_parSpread_beforeStart()
        {
            double              parSpread = PRICER.parSpread(SWAP_PRODUCT, PROVIDER);
            ResolvedFxSwap      product   = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS + parSpread, PAYMENT_DATE_NEAR, PAYMENT_DATE_FAR);
            MultiCurrencyAmount pv        = PRICER.presentValue(product, PROVIDER);

            assertEquals(pv.convertedTo(USD, PROVIDER).Amount, 0d, NOMINAL_USD * TOL);
        }
        public virtual void test_parSpreadSensitivity_ended()
        {
            ResolvedFxSwap                 product  = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_LONG_PAST, PAYMENT_DATE_PAST);
            PointSensitivities             pts      = PRICER.parSpreadSensitivity(product, PROVIDER);
            CurrencyParameterSensitivities computed = PROVIDER.parameterSensitivity(pts);

            assertTrue(computed.equalWithTolerance(CurrencyParameterSensitivities.empty(), TOLERANCE_SPREAD_DELTA));
        }
        public virtual void test_parSpreadSensitivity_started()
        {
            ResolvedFxSwap                 product  = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_PAST, PAYMENT_DATE_NEAR);
            PointSensitivities             pts      = PRICER.parSpreadSensitivity(product, PROVIDER);
            CurrencyParameterSensitivities computed = PROVIDER.parameterSensitivity(pts);
            CurrencyParameterSensitivities expected = CAL_FD.sensitivity(PROVIDER, (p) => CurrencyAmount.of(KRW, PRICER.parSpread(product, p)));

            assertTrue(computed.equalWithTolerance(expected, TOLERANCE_SPREAD_DELTA));
        }
        public virtual void test_presentValueSensitivity_started()
        {
            ResolvedFxSwap                 product     = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_PAST, PAYMENT_DATE_NEAR);
            PointSensitivities             point       = PRICER.presentValueSensitivity(product, PROVIDER);
            CurrencyParameterSensitivities computed    = PROVIDER.parameterSensitivity(point);
            CurrencyParameterSensitivities expectedUsd = CAL_FD.sensitivity(PROVIDER, (p) => PRICER.presentValue(product, (p)).getAmount(USD));
            CurrencyParameterSensitivities expectedKrw = CAL_FD.sensitivity(PROVIDER, (p) => PRICER.presentValue(product, (p)).getAmount(KRW));

            assertTrue(computed.equalWithTolerance(expectedUsd.combinedWith(expectedKrw), NOMINAL_USD * FX_RATE * EPS_FD));
        }
        public virtual void test_presentValue_ended()
        {
            ResolvedFxSwap      product  = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_LONG_PAST, PAYMENT_DATE_PAST);
            MultiCurrencyAmount computed = PRICER.presentValue(product, PROVIDER);

            assertEquals(computed, MultiCurrencyAmount.empty());

            // currency exposure
            MultiCurrencyAmount exposure = PRICER.currencyExposure(product, PROVIDER);

            assertEquals(exposure, computed);
        }
        public virtual void test_presentValue_started()
        {
            ResolvedFxSwap      product  = ResolvedFxSwap.ofForwardPoints(CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_PAST, PAYMENT_DATE_NEAR);
            MultiCurrencyAmount computed = PRICER.presentValue(product, PROVIDER);
            double expected_usd          = -NOMINAL_USD *PROVIDER.discountFactor(USD, PAYMENT_DATE_NEAR);

            double expected_krw = NOMINAL_USD * (FX_RATE + FX_FWD_POINTS) * PROVIDER.discountFactor(KRW, PAYMENT_DATE_NEAR);

            assertEquals(computed.getAmount(USD).Amount, expected_usd, NOMINAL_USD * TOL);
            assertEquals(computed.getAmount(KRW).Amount, expected_krw, NOMINAL_USD * FX_RATE * TOL);

            // currency exposure
            MultiCurrencyAmount exposure = PRICER.currencyExposure(product, PROVIDER);

            assertEquals(exposure, computed);
        }