Class CurveSensitivityUtils
- java.lang.Object
-
- com.opengamma.strata.pricer.sensitivity.CurveSensitivityUtils
-
public class CurveSensitivityUtils extends Object
Utilities to transform sensitivities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DoubleMatrix
jacobianFromMarketQuoteSensitivities(List<CurveParameterSize> curveOrder, List<CurrencyParameterSensitivities> marketQuoteSensitivities)
Construct the inverse Jacobian matrix from the sensitivities of the trades market quotes to the curve parameters.static DoubleMatrix
jacobianFromMarketQuoteSensitivities(List<CurveParameterSize> curveOrder, List<ResolvedTrade> trades, 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, List<LocalDate> targetDates)
Re-buckets aCurrencyParameterSensitivities
to a given set of dates.static CurrencyParameterSensitivities
linearRebucketing(CurrencyParameterSensitivities sensitivities, List<LocalDate> targetDates, LocalDate sensitivityDate)
Re-buckets aCurrencyParameterSensitivities
to a given set of dates.
-
-
-
Method Detail
-
jacobianFromMarketQuoteSensitivities
public static DoubleMatrix jacobianFromMarketQuoteSensitivities(List<CurveParameterSize> curveOrder, 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(List<CurveParameterSize> curveOrder, List<ResolvedTrade> trades, 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, List<LocalDate> targetDates)
Re-buckets aCurrencyParameterSensitivities
to a given set of dates.The list of dates must be sorted in chronological order. All sensitivities are re-bucketed to the same date list. The re-bucketing 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 re-bucketing dates, the weight on the start date is the number days between end date and the date re-bucketed 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 re-bucketing- Returns:
- the sensitivity after the re-bucketing
-
linearRebucketing
public static CurrencyParameterSensitivities linearRebucketing(CurrencyParameterSensitivities sensitivities, List<LocalDate> targetDates, LocalDate sensitivityDate)
Re-buckets aCurrencyParameterSensitivities
to a given set of dates.The list of dates must be sorted in chronological order. All sensitivities are re-bucketed to the same date list. The re-bucketing 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 re-bucketing dates, the weight on the start date is the number days between end date and the date re-bucketed 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 re-bucketingsensitivityDate
- the date for which the sensitivities are valid- Returns:
- the sensitivity after the re-bucketing
-
-