예제 #1
0
        public virtual void present_value_payer_receiver_parity()
        {
            CurrencyAmount      pvLongPay  = PRICER_SWAPTION_BLACK.presentValue(SWAPTION_LONG_PAY, MULTI_USD, BLACK_VOLS_USD_STD);
            CurrencyAmount      pvShortRec = PRICER_SWAPTION_BLACK.presentValue(SWAPTION_SHORT_REC, MULTI_USD, BLACK_VOLS_USD_STD);
            MultiCurrencyAmount pvSwapPay  = PRICER_SWAP.presentValue(RSWAP_PAY, MULTI_USD);

            assertEquals(pvLongPay.Amount + pvShortRec.Amount, pvSwapPay.getAmount(USD).Amount, TOLERANCE_PV);
        }
예제 #2
0
        public virtual void test_presentValue_atMaturity()
        {
            CurrencyAmount computedRec = PRICER.presentValue(SWAPTION_REC_LONG, RATES_PROVIDER_AT_MATURITY, HW_PROVIDER_AT_MATURITY);
            CurrencyAmount computedPay = PRICER.presentValue(SWAPTION_PAY_SHORT, RATES_PROVIDER_AT_MATURITY, HW_PROVIDER_AT_MATURITY);
            double         swapPv      = SWAP_PRICER.presentValue(RSWAP_REC, RATES_PROVIDER_AT_MATURITY).getAmount(EUR).Amount;

            assertEquals(computedRec.Amount, swapPv, NOTIONAL * TOL);
            assertEquals(computedPay.Amount, 0d, NOTIONAL * TOL);
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public virtual void calibration_present_value()
        {
            RatesProvider result = CALIBRATOR.calibrate(CURVE_GROUP_CONFIG, ALL_QUOTES, REF_DATA);

            ImmutableList <CurveDefinition> definitions = CURVE_GROUP_CONFIG.CurveDefinitions;
            // Test PV Dsc
            ImmutableList <CurveNode> dscNodes  = definitions.get(0).Nodes;
            IList <ResolvedTrade>     dscTrades = new List <ResolvedTrade>();

            for (int i = 0; i < dscNodes.size(); i++)
            {
                dscTrades.Add(dscNodes.get(i).resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // OIS
            for (int i = 0; i < DSC_NB_OIS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)dscTrades[i]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Fwd3
            ImmutableList <CurveNode> fwd3Nodes  = definitions.get(1).Nodes;
            IList <ResolvedTrade>     fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd3Nodes.size(); i++)
            {
                fwd3Trades.Add(fwd3Nodes.get(i).resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // IRS
            for (int i = 0; i < FWD3_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Fwd6
            ImmutableList <CurveNode> fwd6Nodes  = definitions.get(2).Nodes;
            IList <ResolvedTrade>     fwd6Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd6Nodes.size(); i++)
            {
                fwd6Trades.Add(fwd6Nodes.get(i).resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // IRS
            for (int i = 0; i < FWD6_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd6Trades[i]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
        }
예제 #4
0
        //-------------------------------------------------------------------------
        public virtual void calibration_present_value()
        {
            RatesProvider result2 = CALIBRATOR.calibrate(CURVE_GROUP_DEFN, ALL_QUOTES, REF_DATA);

            // Test PV
            CurveNode[]           fwd3Nodes  = CURVES_NODES[0][0];
            IList <ResolvedTrade> fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd3Nodes.Length; i++)
            {
                fwd3Trades.Add(fwd3Nodes[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Fixing
            CurrencyAmount pvFixing2 = FIXING_PRICER.presentValue(((ResolvedIborFixingDepositTrade)fwd3Trades[0]).Product, result2);

            assertEquals(pvFixing2.Amount, 0.0, TOLERANCE_PV);
            // FRA
            for (int i = 0; i < FWD3_NB_FRA_NODES; i++)
            {
                CurrencyAmount pvFra2 = FRA_PRICER.presentValue(((ResolvedFraTrade)fwd3Trades[i + 1]), result2);
                assertEquals(pvFra2.Amount, 0.0, TOLERANCE_PV);
            }
            // IRS
            for (int i = 0; i < FWD3_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs2 = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i + 1 + FWD3_NB_FRA_NODES]).Product, result2);
                assertEquals(pvIrs2.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
        }
        //-------------------------------------------------------------------------
        public virtual void calibration_test()
        {
            RatesProvider result2 = CALIBRATOR.calibrate(CURVE_GROUP_DEFN, ALL_QUOTES, REF_DATA);

            // pv test
            CurveNode[]           fwd3Nodes  = CURVES_NODES[0][0];
            IList <ResolvedTrade> fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd3Nodes.Length; i++)
            {
                fwd3Trades.Add(fwd3Nodes[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            for (int i = 0; i < FWD6_NB_NODES; i++)
            {
                MultiCurrencyAmount pvIrs2 = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i]).Product, result2);
                assertEquals(pvIrs2.getAmount(GBP).Amount, 0.0, TOLERANCE_PV);
            }
            // regression test for curve
            DiscountFactors dsc     = result2.discountFactors(GBP);
            double          prevDsc = 0d;

            for (int i = 0; i < 121; ++i)
            {
                double time   = ((double)i);
                double curDsc = dsc.discountFactor(time);
                if (i > 59)
                {
                    double fwd = prevDsc / curDsc - 1d;
                    assertEquals(fwd, 0.042, 2d * ONE_BP);
                }
                assertEquals(curDsc, DSC_EXP.get(i), ONE_PC);
                prevDsc = curDsc;
            }
        }
예제 #6
0
        private void assertPresentValue(RatesProvider result)
        {
            // Test PV USD;
            IList <ResolvedTrade> usdTrades = new List <ResolvedTrade>();

            for (int i = 0; i < USD_DSC_NODES.Length; i++)
            {
                usdTrades.Add(USD_DSC_NODES[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Depo
            for (int i = 0; i < USD_DSC_NB_DEPO_NODES; i++)
            {
                CurrencyAmount pvDep = DEPO_PRICER.presentValue(((ResolvedTermDepositTrade)usdTrades[i]).Product, result);
                assertEquals(pvDep.Amount, 0.0, TOLERANCE_PV);
            }
            // OIS
            for (int i = 0; i < USD_DSC_NB_OIS_NODES; i++)
            {
                MultiCurrencyAmount pvOis = SWAP_PRICER.presentValue(((ResolvedSwapTrade)usdTrades[USD_DSC_NB_DEPO_NODES + i]).Product, result);
                assertEquals(pvOis.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV EUR;
            IList <ResolvedTrade> eurTrades = new List <ResolvedTrade>();

            for (int i = 0; i < EUR_DSC_NODES.Length; i++)
            {
                eurTrades.Add(EUR_DSC_NODES[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Depo
            for (int i = 0; i < EUR_DSC_NB_FX_NODES; i++)
            {
                MultiCurrencyAmount pvFx = FX_PRICER.presentValue(((ResolvedFxSwapTrade)eurTrades[i]).Product, result);
                assertEquals(pvFx.convertedTo(USD, result).Amount, 0.0, TOLERANCE_PV);
            }
        }
        private void assertResult(RatesProvider result)
        {
            // Test PV Dsc
            CurveNode[]           dscNodes  = CURVES_NODES[0][0];
            IList <ResolvedTrade> dscTrades = new List <ResolvedTrade>();

            for (int i = 0; i < dscNodes.Length; i++)
            {
                dscTrades.Add(dscNodes[i].resolvedTrade(1d, ALL_QUOTES_BD, REF_DATA));
            }
            // Depo
            for (int i = 0; i < DSC_NB_DEPO_NODES; i++)
            {
                CurrencyAmount pvIrs = DEPO_PRICER.presentValue(((ResolvedTermDepositTrade)dscTrades[i]).Product, result);
                assertEquals(pvIrs.Amount, 0.0, TOLERANCE_PV);
            }
            // OIS
            for (int i = 0; i < DSC_NB_OIS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)dscTrades[DSC_NB_DEPO_NODES + i]).Product, result);
                assertEquals(pvIrs.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Fwd3
            CurveNode[]           fwd3Nodes  = CURVES_NODES[1][0];
            IList <ResolvedTrade> fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd3Nodes.Length; i++)
            {
                fwd3Trades.Add(fwd3Nodes[i].resolvedTrade(1d, ALL_QUOTES_BD, REF_DATA));
            }
            // Fixing
            CurrencyAmount pvFixing = FIXING_PRICER.presentValue(((ResolvedIborFixingDepositTrade)fwd3Trades[0]).Product, result);

            assertEquals(pvFixing.Amount, 0.0, TOLERANCE_PV);
            // FRA
            for (int i = 0; i < FWD3_NB_FRA_NODES; i++)
            {
                CurrencyAmount pvFra = FRA_PRICER.presentValue(((ResolvedFraTrade)fwd3Trades[i + 1]), result);
                assertEquals(pvFra.Amount, 0.0, TOLERANCE_PV);
            }
            // IRS
            for (int i = 0; i < FWD3_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i + 1 + FWD3_NB_FRA_NODES]).Product, result);
                assertEquals(pvIrs.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
        }
예제 #8
0
        private void assertPresentValue(RatesProvider result)
        {
            // Test PV Dsc
            CurveNode[]           dscNodes  = CURVES_NODES[0][0];
            IList <ResolvedTrade> dscTrades = new List <ResolvedTrade>();

            for (int i = 0; i < dscNodes.Length; i++)
            {
                dscTrades.Add(dscNodes[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Depo
            for (int i = 0; i < DSC_NB_DEPO_NODES; i++)
            {
                CurrencyAmount pvIrs = DEPO_PRICER.presentValue(((ResolvedTermDepositTrade)dscTrades[i]).Product, result);
                assertEquals(pvIrs.Amount, 0.0, TOLERANCE_PV);
            }
            // OIS
            for (int i = 0; i < DSC_NB_OIS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)dscTrades[DSC_NB_DEPO_NODES + i]).Product, result);
                assertEquals(pvIrs.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Infaltion swaps
            CurveNode[]           cpiNodes  = CURVES_NODES[1][0];
            IList <ResolvedTrade> cpiTrades = new List <ResolvedTrade>();

            for (int i = 0; i < cpiNodes.Length; i++)
            {
                cpiTrades.Add(cpiNodes[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // ZC swaps
            for (int i = 0; i < CPI_NB_NODES; i++)
            {
                MultiCurrencyAmount pvInfl = SWAP_PRICER.presentValue(((ResolvedSwapTrade)cpiTrades[i]).Product, result);
                assertEquals(pvInfl.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
        }
        private void calibration_market_quote_sensitivity_check(System.Func <MarketData, RatesProvider> calibrator, double shift)
        {
            double                         notional = 100_000_000.0;
            double                         spread   = 0.0050;
            SwapTrade                      trade    = FixedIborSwapConventions.USD_FIXED_1Y_LIBOR_3M.createTrade(VAL_DATE, Period.ofMonths(8), Tenor.TENOR_7Y, BuySell.BUY, notional, spread, REF_DATA);
            RatesProvider                  result   = calibrator(ALL_QUOTES);
            ResolvedSwap                   product  = trade.Product.resolve(REF_DATA);
            PointSensitivityBuilder        pts      = SWAP_PRICER.presentValueSensitivity(product, result);
            CurrencyParameterSensitivities ps       = result.parameterSensitivity(pts.build());
            CurrencyParameterSensitivities mqs      = MQC.sensitivity(ps, result);
            double                         pv0      = SWAP_PRICER.presentValue(product, result).getAmount(USD).Amount;

            double[] mqsDscComputed = mqs.getSensitivity(DSCON_CURVE_NAME, USD).Sensitivity.toArray();
            for (int i = 0; i < DSC_NB_NODES; i++)
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, Object> map = new java.util.HashMap<>(ALL_QUOTES.getValues());
                IDictionary <MarketDataId <object>, object> map = new Dictionary <MarketDataId <object>, object>(ALL_QUOTES.Values);
                map[QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i]))] = DSC_MARKET_QUOTES[i] + shift;
                ImmutableMarketData marketData = ImmutableMarketData.of(VAL_DATE, map);
                RatesProvider       rpShifted  = calibrator(marketData);
                double pvS = SWAP_PRICER.presentValue(product, rpShifted).getAmount(USD).Amount;
                assertEquals(mqsDscComputed[i], (pvS - pv0) / shift, TOLERANCE_PV_DELTA, "DSC - node " + i);
            }
            double[] mqsFwd3Computed = mqs.getSensitivity(FWD3_CURVE_NAME, USD).Sensitivity.toArray();
            for (int i = 0; i < FWD3_NB_NODES; i++)
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, Object> map = new java.util.HashMap<>(ALL_QUOTES.getValues());
                IDictionary <MarketDataId <object>, object> map = new Dictionary <MarketDataId <object>, object>(ALL_QUOTES.Values);
                map[QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i]))] = FWD3_MARKET_QUOTES[i] + shift;
                ImmutableMarketData marketData = ImmutableMarketData.of(VAL_DATE, map);
                RatesProvider       rpShifted  = calibrator(marketData);
                double pvS = SWAP_PRICER.presentValue(product, rpShifted).getAmount(USD).Amount;
                assertEquals(mqsFwd3Computed[i], (pvS - pv0) / shift, TOLERANCE_PV_DELTA, "FWD3 - node " + i);
            }
        }
        //-----------------------------------------------------------------------
        public virtual void test_VanillaFixedVsLibor3mSwap()
        {
            SwapLeg           payLeg     = fixedLeg(LocalDate.of(2014, 9, 12), LocalDate.of(2021, 9, 12), P6M, PAY, NOTIONAL, 0.015, null);
            SwapLeg           receiveLeg = iborLeg(LocalDate.of(2014, 9, 12), LocalDate.of(2021, 9, 12), USD_LIBOR_3M, RECEIVE, NOTIONAL, null);
            ResolvedSwapTrade trade      = SwapTrade.builder().info(TradeInfo.builder().tradeDate(LocalDate.of(2014, 9, 10)).build()).product(Swap.of(payLeg, receiveLeg)).build().resolve(REF_DATA);

            // test pv
            DiscountingSwapTradePricer pricer = swapPricer();
            CurrencyAmount             pv     = pricer.presentValue(trade, provider()).getAmount(USD);

            assertEquals(pv.Amount, 7170391.798257509, TOLERANCE_PV);
            // test par rate
            double parRate = PRICER_PRODUCT.parRate(trade.Product, provider());

            assertEquals(parRate, 0.02589471566819517, TOLERANCE_RATE);
            // test par rate vs pv
            ResolvedSwap   swapPV0 = Swap.of(fixedLeg(LocalDate.of(2014, 9, 12), LocalDate.of(2021, 9, 12), P6M, PAY, NOTIONAL, parRate, null), receiveLeg).resolve(REF_DATA);
            CurrencyAmount pv0     = PRICER_PRODUCT.presentValue(swapPV0, provider()).getAmount(USD);

            assertEquals(pv0.Amount, 0, TOLERANCE_PV);     // PV at par rate should be 0
        }
예제 #11
0
        // test diagonal part against finite difference approximation computed from pv
        public virtual void swap_exampleTest()
        {
            LocalDate    start    = LocalDate.of(2014, 3, 10);
            LocalDate    end      = LocalDate.of(2021, 3, 10);
            double       notional = 1.0e6;
            ResolvedSwap swap     = FixedIborSwapConventions.USD_FIXED_6M_LIBOR_3M.toTrade(RatesProviderDataSets.VAL_DATE_2014_01_22, start, end, BuySell.BUY, notional, 0.005).Product.resolve(REF_DATA);
            DiscountingSwapProductPricer pricer = DiscountingSwapProductPricer.DEFAULT;

            System.Func <ImmutableRatesProvider, CurrencyAmount> pvFunction = p => pricer.presentValue(swap, USD, p);
            System.Func <ImmutableRatesProvider, CurrencyParameterSensitivities> sensiFunction = p =>
            {
                PointSensitivities sensi = pricer.presentValueSensitivity(swap, p).build();
                return(p.parameterSensitivity(sensi));
            };
            CurrencyParameterSensitivities expected = sensitivityDiagonal(RatesProviderDataSets.MULTI_CPI_USD, pvFunction);
            CurrencyParameterSensitivities computed = CENTRAL.calculateCrossGammaIntraCurve(RatesProviderDataSets.MULTI_CPI_USD, sensiFunction).diagonal();

            assertTrue(computed.equalWithTolerance(expected, Math.Sqrt(EPS) * notional));
            CurrencyParameterSensitivities computedFromCross = CENTRAL.calculateCrossGammaCrossCurve(RatesProviderDataSets.MULTI_CPI_USD, sensiFunction).diagonal();

            assertTrue(computed.equalWithTolerance(computedFromCross, TOL));
        }
        //-------------------------------------------------------------------------
        public virtual void calibration_present_value()
        {
            RatesProvider result = CalibrationEurStandard.calibrateEurStandard(VAL_DATE, DSC_MARKET_QUOTES, DSC_OIS_TENORS, FWD3_FIXING_QUOTE, FWD3_FRA_QUOTES, FWD3_IRS_QUOTES, FWD3_FRA_TENORS, FWD3_IRS_TENORS, FWD6_FIXING_QUOTE, FWD6_FRA_QUOTES, FWD6_IRS_QUOTES, FWD6_FRA_TENORS, FWD6_IRS_TENORS);

            /* Curve Discounting/EUR-EONIA */
            string[] dscIdValues = CalibrationEurStandard.dscIdValues(DSC_OIS_TENORS);
            /* Curve EUR-EURIBOR-3M */
            double[] fwd3MarketQuotes = CalibrationEurStandard.fwdMarketQuotes(FWD3_FIXING_QUOTE, FWD3_FRA_QUOTES, FWD3_IRS_QUOTES);
            string[] fwd3IdValue      = CalibrationEurStandard.fwdIdValue(3, FWD3_FIXING_QUOTE, FWD3_FRA_QUOTES, FWD3_IRS_QUOTES, FWD3_FRA_TENORS, FWD3_IRS_TENORS);
            /* Curve EUR-EURIBOR-6M */
            double[] fwd6MarketQuotes = CalibrationEurStandard.fwdMarketQuotes(FWD6_FIXING_QUOTE, FWD6_FRA_QUOTES, FWD6_IRS_QUOTES);
            string[] fwd6IdValue      = CalibrationEurStandard.fwdIdValue(6, FWD6_FIXING_QUOTE, FWD6_FRA_QUOTES, FWD6_IRS_QUOTES, FWD6_FRA_TENORS, FWD6_IRS_TENORS);
            /* All quotes for the curve calibration */
            MarketData allQuotes = CalibrationEurStandard.allQuotes(VAL_DATE, DSC_MARKET_QUOTES, dscIdValues, fwd3MarketQuotes, fwd3IdValue, fwd6MarketQuotes, fwd6IdValue);
            /* All nodes by groups. */
            RatesCurveGroupDefinition config = CalibrationEurStandard.config(DSC_OIS_TENORS, dscIdValues, FWD3_FRA_TENORS, FWD3_IRS_TENORS, fwd3IdValue, FWD6_FRA_TENORS, FWD6_IRS_TENORS, fwd6IdValue);

            ImmutableList <CurveDefinition> definitions = config.CurveDefinitions;
            // Test PV Dsc
            ImmutableList <CurveNode> dscNodes  = definitions.get(0).Nodes;
            IList <ResolvedTrade>     dscTrades = new List <ResolvedTrade>();

            for (int i = 0; i < dscNodes.size(); i++)
            {
                dscTrades.Add(dscNodes.get(i).resolvedTrade(1d, allQuotes, REF_DATA));
            }
            // OIS
            for (int i = 0; i < DSC_MARKET_QUOTES.Length; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)dscTrades[i]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Fwd3
            ImmutableList <CurveNode> fwd3Nodes  = definitions.get(1).Nodes;
            IList <ResolvedTrade>     fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd3Nodes.size(); i++)
            {
                fwd3Trades.Add(fwd3Nodes.get(i).resolvedTrade(1d, allQuotes, REF_DATA));
            }
            // FRA
            for (int i = 0; i < FWD3_FRA_QUOTES.Length; i++)
            {
                CurrencyAmount pvFra = PRICER_FRA.presentValue(((ResolvedFraTrade)fwd3Trades[i + 1]).Product, result);
                assertEquals(pvFra.Amount, 0.0, TOLERANCE_PV);
            }
            // IRS
            for (int i = 0; i < FWD3_IRS_QUOTES.Length; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i + 1 + FWD3_FRA_QUOTES.Length]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV Fwd6
            ImmutableList <CurveNode> fwd6Nodes  = definitions.get(2).Nodes;
            IList <ResolvedTrade>     fwd6Trades = new List <ResolvedTrade>();

            for (int i = 0; i < fwd6Nodes.size(); i++)
            {
                fwd6Trades.Add(fwd6Nodes.get(i).resolvedTrade(1d, allQuotes, REF_DATA));
            }
            // IRS
            for (int i = 0; i < FWD6_IRS_QUOTES.Length; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd6Trades[i + 1 + FWD6_FRA_QUOTES.Length]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
        }
        private void assertPresentValue(RatesProvider result)
        {
            // Test PV USD;
            IList <ResolvedTrade> usdTrades = new List <ResolvedTrade>();

            foreach (CurveNode USD_DSC_NODE in USD_DSC_NODES)
            {
                usdTrades.Add(USD_DSC_NODE.resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Depo
            for (int i = 0; i < 2; i++)
            {
                CurrencyAmount pvDep = DEPO_PRICER.presentValue(((ResolvedTermDepositTrade)usdTrades[i]).Product, result);
                assertEquals(pvDep.Amount, 0.0, TOLERANCE_PV);
            }
            // OIS
            for (int i = 0; i < USD_DSC_NB_OIS_NODES; i++)
            {
                MultiCurrencyAmount pvOis = SWAP_PRICER.presentValue(((ResolvedSwapTrade)usdTrades[2 + i]).Product, result);
                assertEquals(pvOis.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV USD Fwd3
            IList <ResolvedTrade> fwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < USD_FWD3_NB_NODES; i++)
            {
                fwd3Trades.Add(USD_FWD3_NODES[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Fixing
            CurrencyAmount pvFixing = FIXING_PRICER.presentValue(((ResolvedIborFixingDepositTrade)fwd3Trades[0]).Product, result);

            assertEquals(pvFixing.Amount, 0.0, TOLERANCE_PV);
            // FRA
            for (int i = 0; i < USD_FWD3_NB_FRA_NODES; i++)
            {
                CurrencyAmount pvFra = FRA_PRICER.presentValue(((ResolvedFraTrade)fwd3Trades[i + 1]), result);
                assertEquals(pvFra.Amount, 0.0, TOLERANCE_PV);
            }
            // IRS
            for (int i = 0; i < USD_FWD3_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)fwd3Trades[i + 1 + USD_FWD3_NB_FRA_NODES]).Product, result);
                assertEquals(pvIrs.getAmount(USD).Amount, 0.0, TOLERANCE_PV);
            }
            // Test DSC EUR;
            IList <ResolvedTrade> eurTrades = new List <ResolvedTrade>();

            foreach (CurveNode EUR_DSC_NODE in EUR_DSC_NODES)
            {
                eurTrades.Add(EUR_DSC_NODE.resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // FX
            for (int i = 0; i < EUR_DSC_NB_FX_NODES; i++)
            {
                MultiCurrencyAmount pvFx = FX_PRICER.presentValue(((ResolvedFxSwapTrade)eurTrades[i]).Product, result);
                assertEquals(pvFx.convertedTo(USD, result).Amount, 0.0, TOLERANCE_PV);
            }
            // XCCY
            for (int i = 0; i < EUR_DSC_NB_XCCY_NODES; i++)
            {
                MultiCurrencyAmount pvFx = SWAP_PRICER.presentValue(((ResolvedSwapTrade)eurTrades[EUR_DSC_NB_FX_NODES + i]).Product, result);
                assertEquals(pvFx.convertedTo(USD, result).Amount, 0.0, TOLERANCE_PV);
            }
            // Test PV EUR Fwd3
            IList <ResolvedTrade> eurFwd3Trades = new List <ResolvedTrade>();

            for (int i = 0; i < EUR_FWD3_NB_NODES; i++)
            {
                eurFwd3Trades.Add(EUR_FWD3_NODES[i].resolvedTrade(1d, ALL_QUOTES, REF_DATA));
            }
            // Fixing
            CurrencyAmount eurPvFixing = FIXING_PRICER.presentValue(((ResolvedIborFixingDepositTrade)eurFwd3Trades[0]).Product, result);

            assertEquals(eurPvFixing.Amount, 0.0, TOLERANCE_PV);
            // FRA
            for (int i = 0; i < EUR_FWD3_NB_FRA_NODES; i++)
            {
                CurrencyAmount pvFra = FRA_PRICER.presentValue(((ResolvedFraTrade)eurFwd3Trades[i + 1]), result);
                assertEquals(pvFra.Amount, 0.0, TOLERANCE_PV);
            }
            // IRS
            for (int i = 0; i < EUR_FWD3_NB_IRS_NODES; i++)
            {
                MultiCurrencyAmount pvIrs = SWAP_PRICER.presentValue(((ResolvedSwapTrade)eurFwd3Trades[i + 1 + EUR_FWD3_NB_FRA_NODES]).Product, result);
                assertEquals(pvIrs.getAmount(EUR).Amount, 0.0, TOLERANCE_PV);
            }
        }