private static CurveNode curveFixedOvernightCurveNode( String conventionStr, String timeStr, String label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order) { Matcher matcher = SIMPLE_YMD_TIME_REGEX.matcher(timeStr.toUpperCase(Locale.ENGLISH)); if (!matcher.matches()) { throw new IllegalArgumentException(Messages.format("Invalid time format for Fixed-Overnight swap: {}", timeStr)); } Period periodToEnd = Period.parse("P" + matcher.group(1)); FixedOvernightSwapConvention convention = FixedOvernightSwapConvention.of(conventionStr); FixedOvernightSwapTemplate template = FixedOvernightSwapTemplate.of(Tenor.of(periodToEnd), convention); return FixedOvernightSwapCurveNode.builder() .template(template) .rateId(quoteId) .additionalSpread(spread) .label(label) .date(date) .dateOrder(order) .build(); }
public void test_builder() { FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.builder() .label(LABEL) .template(TEMPLATE) .rateId(QUOTE_ID) .additionalSpread(SPREAD) .build(); assertEquals(test.getLabel(), LABEL); assertEquals(test.getRateId(), QUOTE_ID); assertEquals(test.getAdditionalSpread(), SPREAD); assertEquals(test.getTemplate(), TEMPLATE); assertEquals(test.getDate(), CurveNodeDate.END); }
/** * Returns a curve node for a Fixed-Overnight interest rate swap using the * specified instrument template, rate key and spread. * <p> * A suitable default label will be created. * * @param template the template defining the node instrument * @param rateId the identifier of the market data providing the rate for the node instrument * @param additionalSpread the additional spread amount added to the rate * @return a node whose instrument is built from the template using a market rate */ public static FixedOvernightSwapCurveNode of( FixedOvernightSwapTemplate template, ObservableId rateId, double additionalSpread) { return builder() .template(template) .rateId(rateId) .additionalSpread(additionalSpread) .build(); }