Class InterpolationConfiguration
- java.lang.Object
-
- com.activeviam.risk.starter.utils.InterpolationConfiguration
-
- All Implemented Interfaces:
IInterpolationConfiguration
public class InterpolationConfiguration extends Object implements IInterpolationConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description static String
INTERPOLATION_FLAG
static String
VARIANCE_TO_VOLATILITY
static String
VOLATILITY_TO_VARIANCE
-
Constructor Summary
Constructors Constructor Description InterpolationConfiguration(org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleBinaryOperator
absoluteToRelativeMarketDataOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
The way to convert absolute MD to relative MDDoubleBinaryOperator
absoluteToRelativeShiftOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
The way to convert absolute shift to relative shiftIMarketDataRetrievalService.IPillarSet
fixPillarSet(IServiceContext context, IMarketDataRetrievalService.IPillarSet pillarSet, int axisIndex, String sensitivityKing, String sensitivityName, String riskClass)
Can modify on the fly the input pillar set before retrieval if you want to modify the equality condition check the classModifiedPillarSetOfPillar
that could encapsulate the provided pillarsint[]
getInterpolationOrder(IServiceContext context, int maxDeep, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves an arrays that gives the order in which the interpolation of market data is performed.boolean
getMarketDataInterpolationFlag(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves the flag that specifies whether interpolation of the market data is used for the computation of PnL explainboolean
getMarketDataInterpolationFlag(String sensitivityKind, String sensitivityName, String riskClass)
BinaryOperator<Double>
getPostInterpolationFunction(String sensitivityName, String riskClass, int axis)
BinaryOperator<Double>
getPostMarketDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that performs a calculation on the market data for a given axis after interpolation of market data is doneBinaryOperator<Double>
getPostShiftDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that performs a calculation on the shift data vector for a given axis after interpolation of shift data is doneBinaryOperator<Double>
getPreInterpolationFunction(String sensitivityName, String riskClass, int axis)
BinaryOperator<Double>
getPreMarketDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that performs a calculation on the market data for a given axis before interpolation of market data is doneprotected String
getPrePostInterpolationCalculationMethod(String sensitivityName, String riskClass, String prefix, int axis)
BinaryOperator<Double>
getPreShiftDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that performs a calculation on the shift data vector for a given axis before interpolation of shift data is doneboolean
getShiftDataInterpolationFlag(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves the flag that specifies whether interpolation of the shift data vector is used for the computation of VaRboolean
isRelativeMarketData(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Tells if the retrieved MD is absolute or relativeboolean
isRelativeShiftData(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Tells if the retrieved shift is absolute or relativeDoubleBinaryOperator
relativeToAbsoluteMarketDataOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
The way to convert relative MD to absolute MDDoubleBinaryOperator
relativeToAbsoluteShiftOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
The way to convert relative shift to absolute shiftBinaryOperator<Double>
varianceToVolatilityFunction()
BinaryOperator<Double>
volatilityToVarianceFunction()
-
-
-
Field Detail
-
VOLATILITY_TO_VARIANCE
public static final String VOLATILITY_TO_VARIANCE
- See Also:
- Constant Field Values
-
VARIANCE_TO_VOLATILITY
public static final String VARIANCE_TO_VOLATILITY
- See Also:
- Constant Field Values
-
INTERPOLATION_FLAG
public static final String INTERPOLATION_FLAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMarketDataInterpolationFlag
public boolean getMarketDataInterpolationFlag(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves the flag that specifies whether interpolation of the market data is used for the computation of PnL explain- Specified by:
getMarketDataInterpolationFlag
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ....sensitivityName
- the sensitivity nameriskClass
- the risk class- Returns:
- A boolean flag that is true if interpolation is used and false otherwise
-
getMarketDataInterpolationFlag
public boolean getMarketDataInterpolationFlag(String sensitivityKind, String sensitivityName, String riskClass)
-
getPreMarketDataInterpolationFunction
public BinaryOperator<Double> getPreMarketDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves a function that performs a calculation on the market data for a given axis before interpolation of market data is done- Specified by:
getPreMarketDataInterpolationFunction
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextaxisIndex
- index of the axissensitivityKind
- The type of sensitivity delta / gamma /vega / ....sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function with that prototype
(pillar, md) -> intermediate
, pillar is the current location of the md, interpolation will be made on intermediate Pre and Post functions must give identity on a non interpolated point for consistencyPost(pillar, Pre(pillar, md) = (pillar, md) -> md
-
getPostMarketDataInterpolationFunction
public BinaryOperator<Double> getPostMarketDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves a function that performs a calculation on the market data for a given axis after interpolation of market data is done- Specified by:
getPostMarketDataInterpolationFunction
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextaxisIndex
- index of the axissensitivityKind
- The type of sensitivity delta / gamma /vega / ....sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function with that prototype
(pillar, intermediate) -> md
, pillar is the target location of the md, intermediate is the interpolated value Pre and Post functions must give identity on a non interpolated point for consistencyPost(pillar, Pre(pillar, md) = (pillar, md) -> md
-
getShiftDataInterpolationFlag
public boolean getShiftDataInterpolationFlag(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves the flag that specifies whether interpolation of the shift data vector is used for the computation of VaR- Specified by:
getShiftDataInterpolationFlag
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- the sensitivity nameriskClass
- the risk class- Returns:
- A boolean flag that is true if interpolation is used and false otherwise
-
getPreShiftDataInterpolationFunction
public BinaryOperator<Double> getPreShiftDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves a function that performs a calculation on the shift data vector for a given axis before interpolation of shift data is done- Specified by:
getPreShiftDataInterpolationFunction
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextaxisIndex
- index of the axissensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function with that prototype
(pillar, shift) -> intermediate
, pillar is the current location of the shift, interpolation will be made on intermediate Pre and Post functions must give identity on a non interpolated point for consistencyPost(pillar, Pre(pillar, shift) = (pillar, shift) -> shift
-
getPostShiftDataInterpolationFunction
public BinaryOperator<Double> getPostShiftDataInterpolationFunction(IServiceContext context, int axisIndex, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves a function that performs a calculation on the shift data vector for a given axis after interpolation of shift data is done- Specified by:
getPostShiftDataInterpolationFunction
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextaxisIndex
- index of the axissensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function with that prototype
(pillar, intermediate) -> shift
, pillar is the target location of the shift, intermediate is the interpolated value Pre and Post functions must give identity on a non interpolated point for consistencyPost(pillar, Pre(pillar, shift) = (pillar, shift) -> shift
-
getPrePostInterpolationCalculationMethod
protected String getPrePostInterpolationCalculationMethod(String sensitivityName, String riskClass, String prefix, int axis)
-
getPreInterpolationFunction
public BinaryOperator<Double> getPreInterpolationFunction(String sensitivityName, String riskClass, int axis)
-
getPostInterpolationFunction
public BinaryOperator<Double> getPostInterpolationFunction(String sensitivityName, String riskClass, int axis)
-
volatilityToVarianceFunction
public BinaryOperator<Double> volatilityToVarianceFunction()
-
varianceToVolatilityFunction
public BinaryOperator<Double> varianceToVolatilityFunction()
-
getInterpolationOrder
public int[] getInterpolationOrder(IServiceContext context, int maxDeep, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Retrieves an arrays that gives the order in which the interpolation of market data is performed. That order is defined as an int[] in which each index indicates the order in which each of the axis defined in thebucketTypes
parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined inbucketTypes
like:{BucketType.TENOR_INPUT, BucketType.MATURITY_INPUT, BucketType.MONEYNESS_INPUT}
and if the interpolation order is defined as:0,1,2
, the interpolation will first be done on the tenors axis, then on the maturity axis, and then on the moneyness axis.- Specified by:
getInterpolationOrder
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextmaxDeep
- number of axissensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- An array with the axis number from the last to the first
-
fixPillarSet
public IMarketDataRetrievalService.IPillarSet fixPillarSet(IServiceContext context, IMarketDataRetrievalService.IPillarSet pillarSet, int axisIndex, String sensitivityKing, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Can modify on the fly the input pillar set before retrieval if you want to modify the equality condition check the classModifiedPillarSetOfPillar
that could encapsulate the provided pillars- Specified by:
fixPillarSet
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextpillarSet
- The pillar set to fixaxisIndex
- The axis number corresponding to the pillar setsensitivityKing
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- mainly the pillar set
-
isRelativeMarketData
public boolean isRelativeMarketData(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Tells if the retrieved MD is absolute or relative- Specified by:
isRelativeMarketData
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- true for relative data (ratio of nominal), false for absolute MD
-
absoluteToRelativeMarketDataOperator
public DoubleBinaryOperator absoluteToRelativeMarketDataOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
The way to convert absolute MD to relative MD- Specified by:
absoluteToRelativeMarketDataOperator
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- the formula, for instance (nominal, md) -> md / nominal
-
relativeToAbsoluteMarketDataOperator
public DoubleBinaryOperator relativeToAbsoluteMarketDataOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
The way to convert relative MD to absolute MD- Specified by:
relativeToAbsoluteMarketDataOperator
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- the formula, for instance (nominal, md) -> md * nominal
-
isRelativeShiftData
public boolean isRelativeShiftData(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
Tells if the retrieved shift is absolute or relative- Specified by:
isRelativeShiftData
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- true for relative data (ratio of nominal), false for absolute shift
-
absoluteToRelativeShiftOperator
public DoubleBinaryOperator absoluteToRelativeShiftOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
The way to convert absolute shift to relative shift- Specified by:
absoluteToRelativeShiftOperator
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- the formula, for instance (md, shift) -> shift / md
-
relativeToAbsoluteShiftOperator
public DoubleBinaryOperator relativeToAbsoluteShiftOperator(IServiceContext context, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IInterpolationConfiguration
The way to convert relative shift to absolute shift- Specified by:
relativeToAbsoluteShiftOperator
in interfaceIInterpolationConfiguration
- Parameters:
context
- The caller contextsensitivityKind
- The type of sensitivity delta / gamma /vega / ...sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- the formula, for instance (md, shift) -> shift * md
-
-