private static CurveNode curveFixedInflationCurveNode( String conventionStr, String timeStr, String label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order) { Matcher matcher = SIMPLE_YM_TIME_REGEX.matcher(timeStr.toUpperCase(Locale.ENGLISH)); if (!matcher.matches()) { throw new IllegalArgumentException(Messages.format("Invalid time format for Fixed-Inflation swap: {}", timeStr)); } Period periodToEnd = Period.parse("P" + matcher.group(1)); FixedInflationSwapConvention convention = FixedInflationSwapConvention.of(conventionStr); FixedInflationSwapTemplate template = FixedInflationSwapTemplate.of(Tenor.of(periodToEnd), convention); return FixedInflationSwapCurveNode.builder() .template(template) .rateId(quoteId) .additionalSpread(spread) .label(label) .date(date) .dateOrder(order) .build(); }
/** * Returns a curve node for a Fixed-Inflation 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 FixedInflationSwapCurveNode of( FixedInflationSwapTemplate template, ObservableId rateId, double additionalSpread) { return builder() .template(template) .rateId(rateId) .additionalSpread(additionalSpread) .build(); }
@Override public FixedInflationSwapCurveNode.Builder builder() { return new FixedInflationSwapCurveNode.Builder(); }
public void test_builder() { FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.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 builder used to create an instance of the bean. * @return the builder, not null */ public static FixedInflationSwapCurveNode.Builder builder() { return new FixedInflationSwapCurveNode.Builder(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }