本文整理了Java中com.opengamma.strata.pricer.ZeroRateSensitivity.combinedWith()
方法的一些代码示例,展示了ZeroRateSensitivity.combinedWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroRateSensitivity.combinedWith()
方法的具体详情如下:
包路径:com.opengamma.strata.pricer.ZeroRateSensitivity
类名称:ZeroRateSensitivity
方法名:combinedWith
暂无
代码示例来源:origin: OpenGamma/Strata
public void test_combinedWith_mutable() {
ZeroRateSensitivity base = ZeroRateSensitivity.of(GBP, YEARFRAC, 32d);
MutablePointSensitivities expected = new MutablePointSensitivities();
expected.add(base);
PointSensitivityBuilder test = base.combinedWith(new MutablePointSensitivities());
assertEquals(test, expected);
}
代码示例来源:origin: OpenGamma/Strata
public void test_combinedWith() {
ZeroRateSensitivity base1 = ZeroRateSensitivity.of(GBP, YEARFRAC, 32d);
ZeroRateSensitivity base2 = ZeroRateSensitivity.of(GBP, YEARFRAC2, 22d);
MutablePointSensitivities expected = new MutablePointSensitivities();
expected.add(base1).add(base2);
PointSensitivityBuilder test = base1.combinedWith(base2);
assertEquals(test, expected);
}
代码示例来源:origin: OpenGamma/Strata
public void test_singleDiscountCurveParameterSensitivity() {
ZeroRateSensitivity zeroPt = ZeroRateSensitivity.of(USD, 10d, 5d);
CreditCurveZeroRateSensitivity creditPt = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY_ABC, JPY, 2d, 3d);
FxForwardSensitivity fxPt = FxForwardSensitivity.of(CurrencyPair.of(JPY, USD), USD, LocalDate.of(2017, 2, 14), 15d);
CreditRatesProvider test = ImmutableCreditRatesProvider.builder()
.creditCurves(ImmutableMap.of(
Pair.of(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD),
Pair.of(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY),
Pair.of(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF)))
.discountCurves(ImmutableMap.of(USD, DSC_USD, JPY, DSC_JPY))
.recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY_ABC, RR_ABC, LEGAL_ENTITY_DEF, RR_DEF))
.valuationDate(VALUATION)
.build();
CurrencyParameterSensitivities computed = CurrencyParameterSensitivities.of(
test.singleDiscountCurveParameterSensitivity(zeroPt.combinedWith(creditPt).combinedWith(fxPt).build(), USD));
CurrencyParameterSensitivities expected = DSC_USD.parameterSensitivity(zeroPt);
assertTrue(computed.equalWithTolerance(expected, 1.0e-14));
}
代码示例来源:origin: OpenGamma/Strata
public void test_singleCreditCurveParameterSensitivity() {
ZeroRateSensitivity zeroPt = ZeroRateSensitivity.of(USD, 10d, 5d);
CreditCurveZeroRateSensitivity creditPt = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY_ABC, JPY, 2d, 3d);
FxForwardSensitivity fxPt = FxForwardSensitivity.of(CurrencyPair.of(JPY, USD), USD, LocalDate.of(2017, 2, 14), 15d);
CreditRatesProvider test = ImmutableCreditRatesProvider.builder()
.creditCurves(ImmutableMap.of(
Pair.of(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD),
Pair.of(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY),
Pair.of(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF)))
.discountCurves(ImmutableMap.of(USD, DSC_USD, JPY, DSC_JPY))
.recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY_ABC, RR_ABC, LEGAL_ENTITY_DEF, RR_DEF))
.valuationDate(VALUATION)
.build();
CurrencyParameterSensitivities computed = CurrencyParameterSensitivities.of(test.singleCreditCurveParameterSensitivity(
zeroPt.combinedWith(creditPt).combinedWith(fxPt).build(),
LEGAL_ENTITY_ABC,
JPY));
CurrencyParameterSensitivities expected =
LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY).parameterSensitivity(creditPt);
assertTrue(computed.equalWithTolerance(expected, 1.0e-14));
}
代码示例来源:origin: OpenGamma/Strata
public void test_parameterSensitivity() {
ZeroRateSensitivity zeroPt = ZeroRateSensitivity.of(USD, 10d, 5d);
CreditCurveZeroRateSensitivity creditPt = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY_ABC, JPY, 2d, 3d);
FxForwardSensitivity fxPt = FxForwardSensitivity.of(CurrencyPair.of(JPY, USD), USD, LocalDate.of(2017, 2, 14), 15d);
CreditRatesProvider test = ImmutableCreditRatesProvider.builder()
.creditCurves(ImmutableMap.of(
Pair.of(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD),
Pair.of(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY),
Pair.of(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF)))
.discountCurves(ImmutableMap.of(USD, DSC_USD, JPY, DSC_JPY))
.recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY_ABC, RR_ABC, LEGAL_ENTITY_DEF, RR_DEF))
.valuationDate(VALUATION)
.build();
CurrencyParameterSensitivities computed =
test.parameterSensitivity(zeroPt.combinedWith(creditPt).combinedWith(fxPt).build());
CurrencyParameterSensitivities expected = DSC_USD.parameterSensitivity(zeroPt).combinedWith(
LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY).parameterSensitivity(creditPt));
assertTrue(computed.equalWithTolerance(expected, 1.0e-14));
}
代码示例来源:origin: OpenGamma/Strata
currencyPair.getCounter(),
-priceDerivatives.getDerivative(3) * signedNotional);
return counterSensi.combinedWith(baseSensi);
内容来源于网络,如有侵权,请联系作者删除!