Class ExtendedPnLExplainFormulaProvider
- java.lang.Object
-
- com.activeviam.risk.core.utils.PnLExplainFormulaProvider
-
- com.activeviam.risk.starter.utils.ExtendedPnLExplainFormulaProvider
-
- All Implemented Interfaces:
IPnLExplainFormulaProvider
public class ExtendedPnLExplainFormulaProvider extends PnLExplainFormulaProvider
-
-
Field Summary
Fields Modifier and Type Field Description static String
VARIANCE_TO_VOLATILITY
static String
VOLATILITY_TO_VARIANCE
-
Fields inherited from class com.activeviam.risk.core.utils.PnLExplainFormulaProvider
ABSOLUTE, DHS, FORMULA_RULE, INTERPOLATION_FLAG, RELATIVE
-
-
Constructor Summary
Constructors Constructor Description ExtendedPnLExplainFormulaProvider(org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.quartetfs.fwk.impl.Pair<Double,String>
computeInterpolatedMarketDataForTriDimensionalVectorisedSensitivities(com.qfs.vector.IVector finalQuote, Map.Entry<Double,Integer> tenor, TreeMap<Double,Integer> inputTenors, Map.Entry<Double,Integer> maturity, TreeMap<Double,Integer> inputMaturities, Map.Entry<Double,Integer> moneyness, TreeMap<Double,Integer> inputMoneyness, BiFunction<Double,Double,Double> preInterpolationCalcTenors, BiFunction<Double,Double,Double> postInterpolationCalcTenors, BiFunction<Double,Double,Double> preInterpolationCalcMaturities, BiFunction<Double,Double,Double> postInterpolationCalcMaturities, BiFunction<Double,Double,Double> preInterpolationCalcMoneyness, BiFunction<Double,Double,Double> postInterpolationCalcMoneyness, boolean enableDebugString)
Computes the interpolation of market daa in the case of a vectorised 3D-sensitivitycom.quartetfs.fwk.impl.Pair<Double,String>
getMarketDataValueForScalarInterpolation(MarketPrice marketDataRecord, List<String> pos, int[] interpolationOrder)
Retrieves the market data from aMarketPrice
recordBiFunction<Double,Double,Double>
getPostInterpolationFunction(String sensitivityName, String riskClass, int axis)
BiFunction<Double,Double,Double>
getPostMarketDataInterpolationFunction(com.quartetfs.biz.pivot.query.IQueryCache cache, int axisIndex, 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 doneBiFunction<Double,Double,Double>
getPreInterpolationFunction(String sensitivityName, String riskClass, int axis)
BiFunction<Double,Double,Double>
getPreMarketDataInterpolationFunction(com.quartetfs.biz.pivot.query.IQueryCache cache, int axisIndex, 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)
BiFunction<Double,Double,Double>
varianceToVolatilityFunction()
BiFunction<Double,Double,Double>
volatilityToVarianceFunction()
-
Methods inherited from class com.activeviam.risk.core.utils.PnLExplainFormulaProvider
absoluteFunctionPnL, absoluteFunctionVaR, computeInterpolatedMarketDataForBiDimensionalVectorisedSensitivities, computeInterpolatedMarketDataForSingleDimensionalVectorisedSensitivities, dhsFunction, getCalculationMethod, getEnvironment, getMarketDataInterpolationFlag, getMarketDataInterpolationFlag, getPnlExplainFormula, getPnlExplainFormula, getVaRExplainFormula, getVaRExplainFormula, relativeFunctionPnL, relativeFunctionVaR
-
-
-
-
Method Detail
-
getPreMarketDataInterpolationFunction
public BiFunction<Double,Double,Double> getPreMarketDataInterpolationFunction(com.quartetfs.biz.pivot.query.IQueryCache cache, int axisIndex, String sensitivityName, String riskClass)
Description copied from interface:IPnLExplainFormulaProvider
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 interfaceIPnLExplainFormulaProvider
- Overrides:
getPreMarketDataInterpolationFunction
in classPnLExplainFormulaProvider
- Parameters:
cache
- cacheaxisIndex
- index of the axissensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function that takes as parameter (double market data)
-
getPostMarketDataInterpolationFunction
public BiFunction<Double,Double,Double> getPostMarketDataInterpolationFunction(com.quartetfs.biz.pivot.query.IQueryCache cache, int axisIndex, String sensitivityName, String riskClass)
Description copied from interface:IPnLExplainFormulaProvider
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 interfaceIPnLExplainFormulaProvider
- Overrides:
getPostMarketDataInterpolationFunction
in classPnLExplainFormulaProvider
- Parameters:
cache
- cacheaxisIndex
- index of the axissensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function that takes as parameter (double market data)
-
getPrePostInterpolationCalculationMethod
protected String getPrePostInterpolationCalculationMethod(String sensitivityName, String riskClass, String prefix, int axis)
-
getPreInterpolationFunction
public BiFunction<Double,Double,Double> getPreInterpolationFunction(String sensitivityName, String riskClass, int axis)
-
getPostInterpolationFunction
public BiFunction<Double,Double,Double> getPostInterpolationFunction(String sensitivityName, String riskClass, int axis)
-
volatilityToVarianceFunction
public BiFunction<Double,Double,Double> volatilityToVarianceFunction()
-
varianceToVolatilityFunction
public BiFunction<Double,Double,Double> varianceToVolatilityFunction()
-
computeInterpolatedMarketDataForTriDimensionalVectorisedSensitivities
public com.quartetfs.fwk.impl.Pair<Double,String> computeInterpolatedMarketDataForTriDimensionalVectorisedSensitivities(com.qfs.vector.IVector finalQuote, Map.Entry<Double,Integer> tenor, TreeMap<Double,Integer> inputTenors, Map.Entry<Double,Integer> maturity, TreeMap<Double,Integer> inputMaturities, Map.Entry<Double,Integer> moneyness, TreeMap<Double,Integer> inputMoneyness, BiFunction<Double,Double,Double> preInterpolationCalcTenors, BiFunction<Double,Double,Double> postInterpolationCalcTenors, BiFunction<Double,Double,Double> preInterpolationCalcMaturities, BiFunction<Double,Double,Double> postInterpolationCalcMaturities, BiFunction<Double,Double,Double> preInterpolationCalcMoneyness, BiFunction<Double,Double,Double> postInterpolationCalcMoneyness, boolean enableDebugString)
Description copied from interface:IPnLExplainFormulaProvider
Computes the interpolation of market daa in the case of a vectorised 3D-sensitivity- Specified by:
computeInterpolatedMarketDataForTriDimensionalVectorisedSensitivities
in interfaceIPnLExplainFormulaProvider
- Overrides:
computeInterpolatedMarketDataForTriDimensionalVectorisedSensitivities
in classPnLExplainFormulaProvider
- Parameters:
finalQuote
- The IVector containing the market datatenor
- The map of all the tenorsinputTenors
- The map of tenors corresponding to the market data entrymaturity
- The map of all the maturitiesinputMaturities
- The map of maturities corresponding to the market data entrymoneyness
- The map of all the moneyness valuesinputMoneyness
- The map of moneyness values corresponding to the market data entrypreInterpolationCalcTenors
- The function computed before the interpolation of market data is performed on the tenor axispostInterpolationCalcTenors
- The function computed after the interpolation of market data is performed on the tenor axispreInterpolationCalcMaturities
- The function computed before the interpolation of market data is performed on the maturity axispostInterpolationCalcMaturities
- The function computed after the interpolation of market data is performed on the maturity axispreInterpolationCalcMoneyness
- The function computed before the interpolation of market data is performed on the moneyness axispostInterpolationCalcMoneyness
- The function computed after the interpolation of market data is performed on the moneyness axisenableDebugString
- Flag used to enable the generation of a debug string for market data interpolation. If set to 'true', the string is generated, if set to 'false', it is not generated- Returns:
- A
Pair<Double, String>
containing the interpolated market data on the left-hand side and the interpolation debug string on the right-hand side
-
getMarketDataValueForScalarInterpolation
public com.quartetfs.fwk.impl.Pair<Double,String> getMarketDataValueForScalarInterpolation(MarketPrice marketDataRecord, List<String> pos, int[] interpolationOrder)
Description copied from interface:IPnLExplainFormulaProvider
Retrieves the market data from aMarketPrice
record- Specified by:
getMarketDataValueForScalarInterpolation
in interfaceIPnLExplainFormulaProvider
- Overrides:
getMarketDataValueForScalarInterpolation
in classPnLExplainFormulaProvider
- Parameters:
marketDataRecord
- The market price recordpos
- A list representing the position of the market daa to retrieve on each axisinterpolationOrder
- 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.- Returns:
- A
Pair<Double, String>
containing the market data (interpolated if interpolation is enabled) on the left-hand side and the interpolation debug string on the right-hand side
-
-