private static CurveNode curveIborIborCurveNode(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 Ibor-Ibor swap: {}", timeStr)); } Period periodToEnd = Period.parse("P" + matcher.group(1)); IborIborSwapConvention convention = IborIborSwapConvention.of(conventionStr); IborIborSwapTemplate template = IborIborSwapTemplate.of(Tenor.of(periodToEnd), convention); return(IborIborSwapCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build()); }
static CalibrationZeroRateUsd3OisIrsBsTest() { DSC_NAMES[DSCON_CURVE_NAME] = USD; ISet <Index> usdFedFundSet = new HashSet <Index>(); usdFedFundSet.Add(USD_FED_FUND); IDX_NAMES[DSCON_CURVE_NAME] = usdFedFundSet; ISet <Index> usdLibor3Set = new HashSet <Index>(); usdLibor3Set.Add(USD_LIBOR_3M); IDX_NAMES[FWD3_CURVE_NAME] = usdLibor3Set; ISet <Index> usdLibor6Set = new HashSet <Index>(); usdLibor6Set.Add(USD_LIBOR_6M); IDX_NAMES[FWD6_CURVE_NAME] = usdLibor6Set; for (int i = 0; i < DSC_NB_DEPO_NODES; i++) { BusinessDayAdjustment bda = BusinessDayAdjustment.of(FOLLOWING, USNY); TermDepositConvention convention = ImmutableTermDepositConvention.of("USD-Dep", USD, bda, ACT_360, DaysAdjustment.ofBusinessDays(DSC_DEPO_OFFSET[i], USNY)); DSC_NODES[i] = TermDepositCurveNode.of(TermDepositTemplate.of(Period.ofDays(1), convention), QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i]))); } for (int i = 0; i < DSC_NB_OIS_NODES; i++) { DSC_NODES[DSC_NB_DEPO_NODES + i] = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(Period.ZERO, Tenor.of(DSC_OIS_TENORS[i]), USD_FIXED_1Y_FED_FUND_OIS), QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[DSC_NB_DEPO_NODES + i]))); } FWD3_NODES[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(USD_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[0]))); for (int i = 0; i < FWD3_NB_FRA_NODES; i++) { FWD3_NODES[i + 1] = FraCurveNode.of(FraTemplate.of(FWD3_FRA_TENORS[i], USD_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i + 1]))); } for (int i = 0; i < FWD3_NB_IRS_NODES; i++) { FWD3_NODES[i + 1 + FWD3_NB_FRA_NODES] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(FWD3_IRS_TENORS[i]), USD_FIXED_6M_LIBOR_3M), QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i + 1 + FWD3_NB_FRA_NODES]))); } FWD6_NODES[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(USD_LIBOR_6M), QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[0]))); for (int i = 0; i < FWD6_NB_FRA_NODES; i++) { FWD6_NODES[i + 1] = FraCurveNode.of(FraTemplate.of(FWD6_FRA_TENORS[i], USD_LIBOR_6M), QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[i + 1]))); } for (int i = 0; i < FWD6_NB_IRS_NODES; i++) { FWD6_NODES[i + 1 + FWD6_NB_FRA_NODES] = IborIborSwapCurveNode.of(IborIborSwapTemplate.of(Period.ZERO, Tenor.of(FWD6_IRS_TENORS[i]), USD_LIBOR_3M_LIBOR_6M), QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[i + 1 + FWD6_NB_FRA_NODES]))); } ImmutableMarketDataBuilder builder = ImmutableMarketData.builder(VAL_DATE); for (int i = 0; i < DSC_NB_NODES; i++) { builder.addValue(QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i])), DSC_MARKET_QUOTES[i]); } for (int i = 0; i < FWD3_NB_NODES; i++) { builder.addValue(QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i])), FWD3_MARKET_QUOTES[i]); } for (int i = 0; i < FWD6_NB_NODES; i++) { builder.addValue(QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[i])), FWD6_MARKET_QUOTES[i]); } ALL_QUOTES = builder.build(); IList <CurveNode[]> groupDsc = new List <CurveNode[]>(); groupDsc.Add(DSC_NODES); CURVES_NODES.Add(groupDsc); IList <CurveNode[]> groupFwd3 = new List <CurveNode[]>(); groupFwd3.Add(FWD3_NODES); CURVES_NODES.Add(groupFwd3); IList <CurveNode[]> groupFwd6 = new List <CurveNode[]>(); groupFwd6.Add(FWD6_NODES); CURVES_NODES.Add(groupFwd6); IList <CurveMetadata> groupDsc = new List <CurveMetadata>(); groupDsc.Add(DefaultCurveMetadata.builder().curveName(DSCON_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).build()); CURVES_METADATA.Add(groupDsc); IList <CurveMetadata> groupFwd3 = new List <CurveMetadata>(); groupFwd3.Add(DefaultCurveMetadata.builder().curveName(FWD3_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).build()); CURVES_METADATA.Add(groupFwd3); IList <CurveMetadata> groupFwd6 = new List <CurveMetadata>(); groupFwd6.Add(DefaultCurveMetadata.builder().curveName(FWD6_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).build()); CURVES_METADATA.Add(groupFwd6); }