Package com.activeviam.risk.core.utils
Class PnLExplainFormulaProvider
- java.lang.Object
-
- com.activeviam.risk.core.utils.PnLExplainFormulaProvider
-
- All Implemented Interfaces:
IPnLExplainFormulaProvider
public class PnLExplainFormulaProvider extends Object implements IPnLExplainFormulaProvider
-
-
Constructor Summary
Constructors Constructor Description PnLExplainFormulaProvider(org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.qfs.func.ITriFunction<Double,Double,Double,Double>
absoluteFunctionPnL(double priceFactor, Integer derivativeOrder)
Lambda function for the PNL of absolute sensitivityBinaryOperator<Double>
absoluteFunctionVaR(double priceFactor, Integer derivativeOrder)
Lambda function for the VaR return of absolute sensitivitycom.qfs.func.ITriFunction<Double,Double,Double,Double>
dhsFunction(double priceFactor, Integer derivativeOrder, double shift)
Lambda function for the PNL of relative sensitivity shifted from zero (dx/(x+shift))com.qfs.func.ITriFunction<Double,Double,Double,Double>
fxRelativeFunctionPnL(Integer derivativeOrder)
Lambda function for the PNL of relative sensitivity (dx/x)BinaryOperator<Double>
fxRelativeFunctionVaR(Integer derivativeOrder)
Lambda function for the VaR of relative sensitivity (dx/x)com.qfs.func.ITriFunction<Double,Double,Double,Double>
getPnlExplainFormula(com.quartetfs.biz.pivot.query.IQueryCache cache, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that computes pnl from a market change from T-1 to Tcom.qfs.func.ITriFunction<Double,Double,Double,Double>
getPnlExplainFormula(String sensitivityKind, String sensitivityName, String riskClass)
Retrieve a PNL formulaBinaryOperator<Double>
getVaRExplainFormula(com.quartetfs.biz.pivot.query.IQueryCache cache, String sensitivityKind, String sensitivityName, String riskClass)
Retrieves a function that computes pnl from a market change expressed as a shift that may be Absolute : shift = MtM(T)-MtM(T-1) Relative : shift = MtM(T)/MtM(T-1) - 1 DHS : shift = (MtM(T) + c)/(MtM(T-1) + c) - 1BinaryOperator<Double>
getVaRExplainFormula(String sensitivityKind, String sensitivityName, String riskClass)
Retrieve a VaR formulacom.qfs.func.ITriFunction<Double,Double,Double,Double>
relativeFunctionPnL(Integer derivativeOrder)
Lambda function for the PNL of relative sensitivity (dx/x)BinaryOperator<Double>
relativeFunctionVaR(Integer derivativeOrder)
Lambda function for the VaR of relative sensitivity (dx/x)
-
-
-
Field Detail
-
ABSOLUTE
public static final String ABSOLUTE
- See Also:
- Constant Field Values
-
RELATIVE
public static final String RELATIVE
- See Also:
- Constant Field Values
-
FX_RELATIVE
public static final String FX_RELATIVE
- See Also:
- Constant Field Values
-
DHS
public static final String DHS
- See Also:
- Constant Field Values
-
-
Method Detail
-
absoluteFunctionPnL
public com.qfs.func.ITriFunction<Double,Double,Double,Double> absoluteFunctionPnL(double priceFactor, Integer derivativeOrder)
Lambda function for the PNL of absolute sensitivity- Parameters:
priceFactor
- A coefficient to apply to the sensitivityderivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
absoluteFunctionVaR
public BinaryOperator<Double> absoluteFunctionVaR(double priceFactor, Integer derivativeOrder)
Lambda function for the VaR return of absolute sensitivity- Parameters:
priceFactor
- A coefficient to apply to the sensitivityderivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
relativeFunctionPnL
public com.qfs.func.ITriFunction<Double,Double,Double,Double> relativeFunctionPnL(Integer derivativeOrder)
Lambda function for the PNL of relative sensitivity (dx/x)- Parameters:
derivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
fxRelativeFunctionPnL
public com.qfs.func.ITriFunction<Double,Double,Double,Double> fxRelativeFunctionPnL(Integer derivativeOrder)
Lambda function for the PNL of relative sensitivity (dx/x)- Parameters:
derivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
relativeFunctionVaR
public BinaryOperator<Double> relativeFunctionVaR(Integer derivativeOrder)
Lambda function for the VaR of relative sensitivity (dx/x)- Parameters:
derivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
fxRelativeFunctionVaR
public BinaryOperator<Double> fxRelativeFunctionVaR(Integer derivativeOrder)
Lambda function for the VaR of relative sensitivity (dx/x)- Parameters:
derivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2- Returns:
- A formula
-
dhsFunction
public com.qfs.func.ITriFunction<Double,Double,Double,Double> dhsFunction(double priceFactor, Integer derivativeOrder, double shift)
Lambda function for the PNL of relative sensitivity shifted from zero (dx/(x+shift))- Parameters:
priceFactor
- A coefficient to apply to the sensitivityderivativeOrder
- The derivative order of the sensitivity, aka delta = 1, gamma = 2shift
- The shifted zero of the relative sensitivity- Returns:
- A formula
-
getPnlExplainFormula
public com.qfs.func.ITriFunction<Double,Double,Double,Double> getPnlExplainFormula(String sensitivityKind, String sensitivityName, String riskClass)
Retrieve a PNL formula- Parameters:
sensitivityKind
- The king of the sensi : delta / vega / gamma / ...sensitivityName
- The name of the sensi : inflation / ir-gamma / ...riskClass
- The risk class of the sensi : FX / GIRR / ...- Returns:
- A lambda formula
-
getVaRExplainFormula
public BinaryOperator<Double> getVaRExplainFormula(String sensitivityKind, String sensitivityName, String riskClass)
Retrieve a VaR formula- Parameters:
sensitivityKind
- The king of the sensi : delta / vega / gamma / ...sensitivityName
- The name of the sensi : inflation / ir-gamma / ...riskClass
- The risk class of the sensi : FX / GIRR / ...- Returns:
- A lambda formula
-
getPnlExplainFormula
public com.qfs.func.ITriFunction<Double,Double,Double,Double> getPnlExplainFormula(com.quartetfs.biz.pivot.query.IQueryCache cache, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IPnLExplainFormulaProvider
Retrieves a function that computes pnl from a market change from T-1 to T- Specified by:
getPnlExplainFormula
in interfaceIPnLExplainFormulaProvider
- Parameters:
cache
- cachesensitivityKind
- the type of sensitivity delta / gamma /vega / ....sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function that takes as parameter (double sensi, double quoteTMinus1, double quoteT)
-
getVaRExplainFormula
public BinaryOperator<Double> getVaRExplainFormula(com.quartetfs.biz.pivot.query.IQueryCache cache, String sensitivityKind, String sensitivityName, String riskClass)
Description copied from interface:IPnLExplainFormulaProvider
Retrieves a function that computes pnl from a market change expressed as a shift that may be- Absolute : shift = MtM(T)-MtM(T-1)
- Relative : shift = MtM(T)/MtM(T-1) - 1
- DHS : shift = (MtM(T) + c)/(MtM(T-1) + c) - 1
- Specified by:
getVaRExplainFormula
in interfaceIPnLExplainFormulaProvider
- Parameters:
cache
- cachesensitivityKind
- the type of sensitivity delta / gamma /vega / ....sensitivityName
- sensitivity nameriskClass
- risk class- Returns:
- A function that takes as parameter (double sensi, double shift)
-
-