@Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { metaProperty(propertyName); if (quiet) { return; } throw new UnsupportedOperationException("Property cannot be written: " + propertyName); }
/** * Computes the first order sensitivities of a function of a LegalEntityDiscountingProvider to a double by finite difference. * <p> * The finite difference is computed by forward type. * The function should return a value in the same currency for any rates provider of LegalEntityDiscountingProvider. * * @param provider the rates provider * @param valueFn the function from a rate provider to a currency amount for which the sensitivity should be computed * @return the curve sensitivity */ public CurrencyParameterSensitivities sensitivity( LegalEntityDiscountingProvider provider, Function<ImmutableLegalEntityDiscountingProvider, CurrencyAmount> valueFn) { ImmutableLegalEntityDiscountingProvider immProv = provider.toImmutableLegalEntityDiscountingProvider(); CurrencyAmount valueInit = valueFn.apply(immProv); CurrencyParameterSensitivities discounting = sensitivity( immProv, valueFn, ImmutableLegalEntityDiscountingProvider.meta().repoCurves(), valueInit); CurrencyParameterSensitivities forward = sensitivity( immProv, valueFn, ImmutableLegalEntityDiscountingProvider.meta().issuerCurves(), valueInit); return discounting.combinedWith(forward); }
private CurrencyAmount fn(ImmutableLegalEntityDiscountingProvider provider) { double result = 0.0; // issuer curve ImmutableMap<Pair<LegalEntityGroup, Currency>, DiscountFactors> mapLegal = provider.metaBean().issuerCurves() .get(provider); for (Entry<Pair<LegalEntityGroup, Currency>, DiscountFactors> entry : mapLegal.entrySet()) { InterpolatedNodalCurve curveInt = checkInterpolated(checkDiscountFactors(entry.getValue())); result += sumProduct(curveInt); } // repo curve ImmutableMap<Pair<RepoGroup, Currency>, DiscountFactors> mapRepo = provider.metaBean().repoCurves().get(provider); for (Entry<Pair<RepoGroup, Currency>, DiscountFactors> entry : mapRepo.entrySet()) { InterpolatedNodalCurve curveInt = checkInterpolated(checkDiscountFactors(entry.getValue())); result += sumProduct(curveInt); } return CurrencyAmount.of(USD, result); }