本文整理了Java中com.opengamma.strata.pricer.ZeroRatePeriodicDiscountFactors.getCurve()
方法的一些代码示例,展示了ZeroRatePeriodicDiscountFactors.getCurve()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroRatePeriodicDiscountFactors.getCurve()
方法的具体详情如下:
包路径:com.opengamma.strata.pricer.ZeroRatePeriodicDiscountFactors
类名称:ZeroRatePeriodicDiscountFactors
方法名:getCurve
[英]Gets the underlying curve. The metadata of the curve must define a day count.
[中]获取基础曲线。曲线的元数据必须定义一个日计数。
代码示例来源:origin: OpenGamma/Strata
private Curve getCurve(DiscountFactors discountFactors) {
if (discountFactors instanceof SimpleDiscountFactors) {
return ((SimpleDiscountFactors) discountFactors).getCurve();
}
if (discountFactors instanceof ZeroRateDiscountFactors) {
return ((ZeroRateDiscountFactors) discountFactors).getCurve();
}
if (discountFactors instanceof ZeroRatePeriodicDiscountFactors) {
return ((ZeroRatePeriodicDiscountFactors) discountFactors).getCurve();
}
throw new IllegalArgumentException("Unsupported DiscountFactors type");
}
代码示例来源:origin: OpenGamma/Strata
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 575402001: // currency
return ((ZeroRatePeriodicDiscountFactors) bean).getCurrency();
case 113107279: // valuationDate
return ((ZeroRatePeriodicDiscountFactors) bean).getValuationDate();
case 95027439: // curve
return ((ZeroRatePeriodicDiscountFactors) bean).getCurve();
}
return super.propertyGet(bean, propertyName, quiet);
}
代码示例来源:origin: OpenGamma/Strata
public void test_withCurve() {
ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE).withCurve(CURVE2);
assertEquals(test.getCurve(), CURVE2);
}
代码示例来源:origin: OpenGamma/Strata
public void test_of() {
ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
assertEquals(test.getCurrency(), GBP);
assertEquals(test.getValuationDate(), DATE_VAL);
assertEquals(test.getCurve(), CURVE);
assertEquals(test.getParameterCount(), CURVE.getParameterCount());
assertEquals(test.getParameter(0), CURVE.getParameter(0));
assertEquals(test.getParameterMetadata(0), CURVE.getParameterMetadata(0));
assertEquals(test.withParameter(0, 1d).getCurve(), CURVE.withParameter(0, 1d));
assertEquals(test.withPerturbation((i, v, m) -> v + 1d).getCurve(), CURVE.withPerturbation((i, v, m) -> v + 1d));
assertEquals(test.findData(CURVE.getName()), Optional.of(CURVE));
assertEquals(test.findData(CurveName.of("Rubbish")), Optional.empty());
}
内容来源于网络,如有侵权,请联系作者删除!