Beispiel #1
0
        private static CurveNode curveXCcyIborIborCurveNode(string conventionStr, string timeStr, string label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order)
        {
            Matcher matcher = SIMPLE_YM_TIME_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH));

            if (!matcher.matches())
            {
                throw new System.ArgumentException(Messages.format("Invalid time format for Cross Currency Swap: {}", timeStr));
            }
            Period periodToEnd = Period.parse("P" + matcher.group(1));
            XCcyIborIborSwapConvention convention = XCcyIborIborSwapConvention.of(conventionStr);
            XCcyIborIborSwapTemplate   template   = XCcyIborIborSwapTemplate.of(Tenor.of(periodToEnd), convention);

            return(XCcyIborIborSwapCurveNode.builder().template(template).spreadId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build());
        }
        static CalibrationZeroRateUsdOisIrsEurFxXCcyIrsTest()
        {
            USD_DSC_NODES[0] = TermDepositCurveNode.of(TermDepositTemplate.of(Period.ofDays(1), USD_SHORT_DEPOSIT_T0), QuoteId.of(StandardId.of(SCHEME, USD_DSC_ID_VALUE[0])));
            USD_DSC_NODES[1] = TermDepositCurveNode.of(TermDepositTemplate.of(Period.ofDays(1), USD_SHORT_DEPOSIT_T1), QuoteId.of(StandardId.of(SCHEME, USD_DSC_ID_VALUE[1])));
            for (int i = 0; i < USD_DSC_NB_OIS_NODES; i++)
            {
                USD_DSC_NODES[2 + i] = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(Period.ZERO, Tenor.of(USD_DSC_OIS_TENORS[i]), USD_FIXED_1Y_FED_FUND_OIS), QuoteId.of(StandardId.of(SCHEME, USD_DSC_ID_VALUE[2 + i])));
            }
            USD_FWD3_NODES[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(USD_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, USD_FWD3_ID_VALUE[0])));
            for (int i = 0; i < USD_FWD3_NB_FRA_NODES; i++)
            {
                USD_FWD3_NODES[i + 1] = FraCurveNode.of(FraTemplate.of(USD_FWD3_FRA_TENORS[i], USD_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, USD_FWD3_ID_VALUE[i + 1])));
            }
            for (int i = 0; i < USD_FWD3_NB_IRS_NODES; i++)
            {
                USD_FWD3_NODES[i + 1 + USD_FWD3_NB_FRA_NODES] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(USD_FWD3_IRS_TENORS[i]), USD_FIXED_6M_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, USD_FWD3_ID_VALUE[i + 1 + USD_FWD3_NB_FRA_NODES])));
            }
            for (int i = 0; i < EUR_DSC_NB_FX_NODES; i++)
            {
                EUR_DSC_NODES[i] = FxSwapCurveNode.of(FxSwapTemplate.of(EUR_DSC_FX_TENORS[i], EUR_USD), QuoteId.of(StandardId.of(SCHEME, EUR_DSC_ID_VALUE[i])));
            }
            for (int i = 0; i < EUR_DSC_NB_XCCY_NODES; i++)
            {
                EUR_DSC_NODES[EUR_DSC_NB_FX_NODES + i] = XCcyIborIborSwapCurveNode.of(XCcyIborIborSwapTemplate.of(Tenor.of(EUR_DSC_XCCY_TENORS[i]), EUR_EURIBOR_3M_USD_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, EUR_DSC_ID_VALUE[EUR_DSC_NB_FX_NODES + i])));
            }
            EUR_FWD3_NODES[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(EUR_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, EUR_FWD3_ID_VALUE[0])));
            for (int i = 0; i < EUR_FWD3_NB_FRA_NODES; i++)
            {
                EUR_FWD3_NODES[i + 1] = FraCurveNode.of(FraTemplate.of(EUR_FWD3_FRA_TENORS[i], EUR_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, EUR_FWD3_ID_VALUE[i + 1])));
            }
            for (int i = 0; i < EUR_FWD3_NB_IRS_NODES; i++)
            {
                EUR_FWD3_NODES[i + 1 + EUR_FWD3_NB_FRA_NODES] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(EUR_FWD3_IRS_TENORS[i]), EUR_FIXED_1Y_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, EUR_FWD3_ID_VALUE[i + 1 + EUR_FWD3_NB_FRA_NODES])));
            }
            ImmutableMarketDataBuilder builder = ImmutableMarketData.builder(VAL_DATE);

            for (int i = 0; i < USD_DSC_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, USD_DSC_ID_VALUE[i])), USD_DSC_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < USD_FWD3_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, USD_FWD3_ID_VALUE[i])), USD_FWD3_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < EUR_DSC_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, EUR_DSC_ID_VALUE[i])), EUR_DSC_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < EUR_FWD3_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, EUR_FWD3_ID_VALUE[i])), EUR_FWD3_MARKET_QUOTES[i]);
            }
            builder.addValue(QuoteId.of(StandardId.of(SCHEME, EUR_USD_ID_VALUE)), FX_RATE_EUR_USD);
            builder.addValue(FxRateId.of(EUR, USD), FxRate.of(EUR, USD, FX_RATE_EUR_USD));
            ALL_QUOTES = builder.build();
        }