Class CurveSensitivityUtils
 java.lang.Object

 com.opengamma.strata.pricer.sensitivity.CurveSensitivityUtils

public class CurveSensitivityUtils extends java.lang.Object
Utilities to transform sensitivities.


Constructor Summary
Constructors Constructor Description CurveSensitivityUtils()

Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DoubleMatrix
jacobianFromMarketQuoteSensitivities(java.util.List<CurveParameterSize> curveOrder, java.util.List<CurrencyParameterSensitivities> marketQuoteSensitivities)
Construct the inverse Jacobian matrix from the sensitivities of the trades market quotes to the curve parameters.static DoubleMatrix
jacobianFromMarketQuoteSensitivities(java.util.List<CurveParameterSize> curveOrder, java.util.List<ResolvedTrade> trades, java.util.function.Function<ResolvedTrade,CurrencyParameterSensitivities> sensitivityFunction)
Construct the inverse Jacobian matrix from the trades and a function used to compute the sensitivities of the market quotes to the curve parameters.static CurrencyParameterSensitivities
linearRebucketing(CurrencyParameterSensitivities sensitivities, java.util.List<java.time.LocalDate> targetDates)
Rebuckets aCurrencyParameterSensitivities
to a given set of dates.static CurrencyParameterSensitivities
linearRebucketing(CurrencyParameterSensitivities sensitivities, java.util.List<java.time.LocalDate> targetDates, java.time.LocalDate sensitivityDate)
Rebuckets aCurrencyParameterSensitivities
to a given set of dates.



Method Detail

jacobianFromMarketQuoteSensitivities
public static DoubleMatrix jacobianFromMarketQuoteSensitivities(java.util.List<CurveParameterSize> curveOrder, java.util.List<CurrencyParameterSensitivities> marketQuoteSensitivities)
Construct the inverse Jacobian matrix from the sensitivities of the trades market quotes to the curve parameters.All the trades and sensitivities must be in the same currency. The data should be coherent with the market quote sensitivities passed in an order coherent with the list of curves.
For each trade describing the market quotes, the sensitivity provided should be the sensitivity of that market quote to the curve parameters.
 Parameters:
curveOrder
 the order in which the curves should be represented in the jacobianmarketQuoteSensitivities
 the market quotes sensitivity to the curve parameters Returns:
 inverse jacobian matrix, which correspond to the sensitivity of the parameters to the market quotes

jacobianFromMarketQuoteSensitivities
public static DoubleMatrix jacobianFromMarketQuoteSensitivities(java.util.List<CurveParameterSize> curveOrder, java.util.List<ResolvedTrade> trades, java.util.function.Function<ResolvedTrade,CurrencyParameterSensitivities> sensitivityFunction)
Construct the inverse Jacobian matrix from the trades and a function used to compute the sensitivities of the market quotes to the curve parameters.All the trades must be in the same currency. The trades should be coherent with the curves order.
 Parameters:
curveOrder
 the order in which the curves should be represented in the jacobiantrades
 the list of tradessensitivityFunction
 the function from a trade to the market quote sensitivity to curve parameters Returns:
 inverse jacobian matrix, which correspond to the sensitivity of the parameters to the market quotes

linearRebucketing
public static CurrencyParameterSensitivities linearRebucketing(CurrencyParameterSensitivities sensitivities, java.util.List<java.time.LocalDate> targetDates)
Rebuckets aCurrencyParameterSensitivities
to a given set of dates.The list of dates must be sorted in chronological order. All sensitivities are rebucketed to the same date list. The rebucketing is done by linear weighting on the number of days, i.e. the sensitivities for dates outside the extremes are fully bucketed to the extremes and for date between two rebucketing dates, the weight on the start date is the number days between end date and the date rebucketed divided by the number of days between the start and the end. The input sensitivity should have a
DatedParameterMetadata
for each sensitivity. Parameters:
sensitivities
 the input sensitivitiestargetDates
 the list of dates for the rebucketing Returns:
 the sensitivity after the rebucketing

linearRebucketing
public static CurrencyParameterSensitivities linearRebucketing(CurrencyParameterSensitivities sensitivities, java.util.List<java.time.LocalDate> targetDates, java.time.LocalDate sensitivityDate)
Rebuckets aCurrencyParameterSensitivities
to a given set of dates.The list of dates must be sorted in chronological order. All sensitivities are rebucketed to the same date list. The rebucketing is done by linear weighting on the number of days, i.e. the sensitivities for dates outside the extremes are fully bucketed to the extremes and for date between two rebucketing dates, the weight on the start date is the number days between end date and the date rebucketed divided by the number of days between the start and the end. The date of the nodes can be directly in the parameter metadata  when the metadata is of the type
DatedParameterMetadata
 or inferred from the sensitivity date and the tenor when the metadata is of the typeTenorParameterMetadata
. Only those types of metadata are accepted. Parameters:
sensitivities
 the input sensitivitiestargetDates
 the list of dates for the rebucketingsensitivityDate
 the date for which the sensitivities are valid Returns:
 the sensitivity after the rebucketing

