gpt4 book ai didi

com.opengamma.strata.market.param.YearMonthDateParameterMetadata类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 02:21:31 35 4
gpt4 key购买 nike

本文整理了Java中com.opengamma.strata.market.param.YearMonthDateParameterMetadata类的一些代码示例,展示了YearMonthDateParameterMetadata类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDateParameterMetadata类的具体详情如下:
包路径:com.opengamma.strata.market.param.YearMonthDateParameterMetadata
类名称:YearMonthDateParameterMetadata

YearMonthDateParameterMetadata介绍

[英]Parameter metadata based on a date and year-month.
[中]基于日期和年-月的参数元数据。

代码示例

代码示例来源:origin: OpenGamma/Strata

public void test_of_label() {
 YearMonthDateParameterMetadata test = YearMonthDateParameterMetadata.of(DATE, JAN2015, "Jan 2015");
 assertEquals(test.getDate(), DATE);
 assertEquals(test.getYearMonth(), JAN2015);
 assertEquals(test.getLabel(), "Jan 2015");
 assertEquals(test.getIdentifier(), JAN2015);
}

代码示例来源:origin: OpenGamma/Strata

@Override
public YearMonthDateParameterMetadata build() {
 preBuild(this);
 return new YearMonthDateParameterMetadata(
   date,
   yearMonth,
   label);
}

代码示例来源:origin: OpenGamma/Strata

@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
 switch (propertyName.hashCode()) {
  case 3076014:  // date
   return ((YearMonthDateParameterMetadata) bean).getDate();
  case -496678845:  // yearMonth
   return ((YearMonthDateParameterMetadata) bean).getYearMonth();
  case 102727412:  // label
   return ((YearMonthDateParameterMetadata) bean).getLabel();
 }
 return super.propertyGet(bean, propertyName, quiet);
}

代码示例来源:origin: OpenGamma/Strata

public void test_builder_defaultLabel() {
 BeanBuilder<? extends YearMonthDateParameterMetadata> builder = YearMonthDateParameterMetadata.meta().builder();
 builder.set(YearMonthDateParameterMetadata.meta().date(), DATE);
 builder.set(YearMonthDateParameterMetadata.meta().yearMonth(), JAN2015);
 YearMonthDateParameterMetadata test = builder.build();
 assertEquals(test.getDate(), DATE);
 assertEquals(test.getYearMonth(), JAN2015);
 assertEquals(test.getLabel(), "Jan15");
 assertEquals(test.getIdentifier(), JAN2015);
}

代码示例来源:origin: OpenGamma/Strata

public void test_metadata_end() {
 IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL);
 LocalDate date = LocalDate.of(2015, 10, 20);
 LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(date, REF_DATA);
 LocalDate maturityDate = TEMPLATE.getIndex().calculateMaturityFromEffective(referenceDate, REF_DATA);
 ParameterMetadata metadata = node.metadata(date, REF_DATA);
 assertEquals(metadata.getLabel(), LABEL);
 assertTrue(metadata instanceof YearMonthDateParameterMetadata);
 assertEquals(((YearMonthDateParameterMetadata) metadata).getDate(), maturityDate);
 assertEquals(((YearMonthDateParameterMetadata) metadata).getYearMonth(), YearMonth.from(referenceDate));
}

代码示例来源:origin: OpenGamma/Strata

@Override
public DatedParameterMetadata metadata(LocalDate valuationDate, ReferenceData refData) {
 LocalDate nodeDate = date(valuationDate, refData);
 LocalDate referenceDate = template.calculateReferenceDateFromTradeDate(valuationDate, refData);
 if (label.isEmpty()) {
  return YearMonthDateParameterMetadata.of(nodeDate, YearMonth.from(referenceDate));
 }
 return YearMonthDateParameterMetadata.of(nodeDate, YearMonth.from(referenceDate), label);
}

代码示例来源:origin: OpenGamma/Strata

public void test_metadata_last_fixing() {
 IborFutureCurveNode node =
   IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING);
 ImmutableMarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, 0.0d).build();
 IborFutureTrade trade = node.trade(1d, marketData, REF_DATA);
 LocalDate fixingDate = trade.getProduct().getFixingDate();
 DatedParameterMetadata metadata = node.metadata(VAL_DATE, REF_DATA);
 assertEquals(metadata.getDate(), fixingDate);
 LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(VAL_DATE, REF_DATA);
 assertEquals(((YearMonthDateParameterMetadata) metadata).getYearMonth(), YearMonth.from(referenceDate));
}

代码示例来源:origin: OpenGamma/Strata

public void test_builder_incomplete() {
 BeanBuilder<? extends YearMonthDateParameterMetadata> builder = YearMonthDateParameterMetadata.meta().builder();
 builder.set(YearMonthDateParameterMetadata.meta().date(), DATE);
 assertThrowsIllegalArg(() -> builder.build());
}

代码示例来源:origin: OpenGamma/Strata

public void test_builder_specifyLabel() {
 BeanBuilder<? extends YearMonthDateParameterMetadata> builder = YearMonthDateParameterMetadata.meta().builder();
 builder.set(YearMonthDateParameterMetadata.meta().date(), DATE);
 builder.set(YearMonthDateParameterMetadata.meta().yearMonth(), JAN2015);
 builder.set(YearMonthDateParameterMetadata.meta().label(), "Jan 2015");
 YearMonthDateParameterMetadata test = builder.build();
 assertEquals(test.getDate(), DATE);
 assertEquals(test.getYearMonth(), JAN2015);
 assertEquals(test.getLabel(), "Jan 2015");
 assertEquals(test.getIdentifier(), JAN2015);
}

代码示例来源:origin: OpenGamma/Strata

public void test_serialization() {
 YearMonthDateParameterMetadata test = YearMonthDateParameterMetadata.of(DATE, JAN2015);
 assertSerialization(test);
}

代码示例来源:origin: OpenGamma/Strata

public void test_of_noLabel() {
 YearMonthDateParameterMetadata test = YearMonthDateParameterMetadata.of(DATE, JAN2015);
 assertEquals(test.getDate(), DATE);
 assertEquals(test.getYearMonth(), JAN2015);
 assertEquals(test.getLabel(), "Jan15");
 assertEquals(test.getIdentifier(), JAN2015);
}

代码示例来源:origin: OpenGamma/Strata

public void coverage() {
 YearMonthDateParameterMetadata test = YearMonthDateParameterMetadata.of(DATE, JAN2015);
 coverImmutableBean(test);
 YearMonthDateParameterMetadata test2 = YearMonthDateParameterMetadata.of(date(2014, 1, 1), YearMonth.of(2016, 2));
 coverBeanEquals(test, test2);
}

代码示例来源:origin: OpenGamma/Strata

/**
 * Obtains an instance using the year-month, specifying the label.
 * 
 * @param date  the date associated with the parameter
 * @param yearMonth  the year-month of the curve node
 * @param label  the label to use
 * @return the parameter metadata based on the year-month
 */
public static YearMonthDateParameterMetadata of(LocalDate date, YearMonth yearMonth, String label) {
 return new YearMonthDateParameterMetadata(date, yearMonth, label);
}

代码示例来源:origin: OpenGamma/Strata

/**
 * Obtains an instance using the year-month.
 * 
 * @param date  the date associated with the parameter
 * @param yearMonth  the year-month of the curve node
 * @return the parameter metadata based on the year-month
 */
public static YearMonthDateParameterMetadata of(LocalDate date, YearMonth yearMonth) {
 ArgChecker.notNull(date, "date");
 ArgChecker.notNull(yearMonth, "yearMonth");
 return new YearMonthDateParameterMetadata(date, yearMonth, yearMonth.format(FORMATTER));
}

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com