Class RatesFiniteDifferenceSensitivityCalculator
- java.lang.Object
-
- com.opengamma.strata.pricer.sensitivity.RatesFiniteDifferenceSensitivityCalculator
-
public class RatesFiniteDifferenceSensitivityCalculator extends Object
Computes the curve parameter sensitivity by finite difference.This is based on an
ImmutableRatesProvider
,LegalEntityDiscountingProvider
orCreditRatesProvider
. The sensitivities are calculated by finite difference.
-
-
Field Summary
Fields Modifier and Type Field Description static RatesFiniteDifferenceSensitivityCalculator
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description RatesFiniteDifferenceSensitivityCalculator(double shift)
Create an instance of the finite difference calculator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyParameterSensitivities
sensitivity(LegalEntityDiscountingProvider provider, Function<ImmutableLegalEntityDiscountingProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of a LegalEntityDiscountingProvider to a double by finite difference.CurrencyParameterSensitivities
sensitivity(CreditRatesProvider provider, Function<ImmutableCreditRatesProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of aCreditRatesProvider
to a double by finite difference.CurrencyParameterSensitivities
sensitivity(RatesProvider provider, Function<ImmutableRatesProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of a RatesProvider to a double by finite difference.
-
-
-
Field Detail
-
DEFAULT
public static final RatesFiniteDifferenceSensitivityCalculator DEFAULT
Default implementation. The shift is one basis point (0.0001).
-
-
Method Detail
-
sensitivity
public CurrencyParameterSensitivities sensitivity(RatesProvider provider, Function<ImmutableRatesProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of a RatesProvider to a double by finite difference.The finite difference is computed by forward type. The function should return a value in the same currency for any rate provider.
- Parameters:
provider
- the rates providervalueFn
- the function from a rate provider to a currency amount for which the sensitivity should be computed- Returns:
- the curve sensitivity
-
sensitivity
public CurrencyParameterSensitivities sensitivity(LegalEntityDiscountingProvider provider, Function<ImmutableLegalEntityDiscountingProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of a LegalEntityDiscountingProvider to a double by finite difference.The finite difference is computed by forward type. The function should return a value in the same currency for any rates provider of LegalEntityDiscountingProvider.
- Parameters:
provider
- the rates providervalueFn
- the function from a rate provider to a currency amount for which the sensitivity should be computed- Returns:
- the curve sensitivity
-
sensitivity
public CurrencyParameterSensitivities sensitivity(CreditRatesProvider provider, Function<ImmutableCreditRatesProvider,CurrencyAmount> valueFn)
Computes the first order sensitivities of a function of aCreditRatesProvider
to a double by finite difference.The finite difference is computed by forward type. The function should return a value in the same currency for any rates provider of
CreditRatesProvider
.- Parameters:
provider
- the rates providervalueFn
- the function from a rate provider to a currency amount for which the sensitivity should be computed- Returns:
- the curve sensitivity
-
-