greek-based-pl-formula-rules.properties

File purpose

The greek-based-pl-formula-rules.properties file is used for PnL Explain. The properties define the type of computation (formula and Taylor expansion order) per risk class and sensitivity measure.

For more information on the PnL Explain calculation, see PnL Explain

File values for ladder configuration

For more information, see Sensitivity ladders

Key Value Description
formula.input.delta.* LADDER-FIRST Formula input selection. Determines if the input for the PnL Explain formula is a sensitivity ladder or a sensitivity. Associated with the sensitivity name.
formula.input.gamma.* SENSI-ONLY
formula.input.vanna.* SENSI-ONLY
formula.input.vega.* LADDER-FIRST
formula.input.volga.* SENSI-ONLY
formula.type.delta.* DeltaShift Specifies the ladder formula to apply.
formula.type.vega.* DeltaShift Specifies the ladder formula to apply.

Ladder formulae

Formula Name Function Behavior
DeltaShift LadderFromDeltaShift::ladder This function supposes that the ladders are $L(x) = \frac{(P(x) - P(0))}{x} $ so $PnL(x) = x \cdot L(x)$, the ladder is interpolated between the plots.
LinearIntegration LadderLinearIntegration::ladder This function is computing the surface between two ladders plots as a trapeze to perform and integration of $L(x) \cdot dx$.
DerivativeRelative LadderFromDerivativeRelative::ladder This function supposes that $L(x) = \frac{dP(x)}{dx}$ and use it as a constant sensitivity until the next step for integration.
DerivativeAbsolute LadderFromDerivativeAbsolute::ladder This function supposes that $L(x) = \frac{x \cdot dP(x)}{dx}$ and use it as a constant sensitivity until the next step for integration.

Adding a new formula

To add a new formula, create a new Extended Plugin that complies with the signature:

@QuartetExtendedPluginValue(intf = ILadderFormulaProvider.class, key = MyLadderFormula.PLUGIN_KEY)
public class MyLadderFormula implements ILadderFormulaProvider {

    public static final String PLUGIN_KEY = "MyLadderFormula";

    @Override public ILadderFormula getLadderFormula() {
        return MyLadderFormula::ladder;
    }
    
    public static double ladder(double shift, double shift1, double ladder1, double shift2, double ladder2, DoubleBinaryOperator pnlFormula,
            FormulaStep currentWindow) {
        //
        // Here comes you formula
        //
    }

    @Override public String getType() {
        return PLUGIN_KEY;
    }
}

The formula has to comply with the ILadderFormula interface. The function will be called and the result summed for each ladder step until the target shift is reached.

Parameter Type Meaning
shift double The target shift we curently compute expressed as $shift = \frac{MD_d}{MD_{d-1} - 1}$
shift1 double The shift of the 1rst ladder plot (closest to the center).
ladder1 double The ladder value of the 1rst plot.
shift2 double The shift of the second ladder plot.
ladder2 double The ladder value of the 2nd plot.
pnlFormula DoubleBinaryOperator The function (sensi, shift) -> PNL comming from IPnLExplainFormulaProvider::getVaRExplainFormula
currentWindow FormulaStep This enum provides the position of the shift against the current ladder interval.
- BELOW: shift is between 0 and shift1
- IN: shift is between shift1 and shift2
- ABOVE: shift is above shift2 (only called when the shift is out of the ladder).

File values for formula configuration

Key Value Description
formula.rule.correlation.equity Relative,1,1,true Formula for the equity correlation.
formula.rule.correlation.* Relative,1,1,true Formula for the non-equity correlation.
formula.rule.crossgamma.1.* Relative,1,1,true Formula for the risk 1st factor of cross gamma.
formula.rule.crossgamma.2.* Relative,1,1,true Formula for the risk 2nd factor of cross gamma.
formula.rule.delta.csr-non-sec Absolute,1,1,true Formula rule for each sensitivity and risk class. The elements are arranged in the following order: SensitivityName.RiskClass = PriceChange,PriceFactor,DerivativeOrder,MarketDataInterpolation
formula.rule.delta.csr-sec-ctp Absolute,1,1,true
formula.rule.delta.girr Absolute,1,1,true
formula.rule.delta.commodity Relative,1,1,true
formula.rule.delta.equity Relative,1,1,true
formula.rule.delta.fx FXRelative,1,1,false
formula.rule.dividend.* Absolute,1,1,false PnL explain computation rule for dividend (previous dividend is never taken into account).
formula.rule.gamma.csr-non-sec Absolute,1,2,true
formula.rule.gamma.csr-sec-non-ctp Absolute,1,2,true
formula.rule.gamma.csr-sec-ctp Absolute,1,2,true
formula.rule.gamma.girr Absolute,1,2,true
formula.rule.gamma.commodity Relative,1,2,true
formula.rule.gamma.equity Relative,1,2,true
formula.rule.gamma.fx Relative,1,2,false
formula.rule.vega.csr-non-sec Absolute,1,1,true
formula.rule.vega.csr-sec-non-ctp Absolute,1,1,true
formula.rule.vega.csr-sec-ctp Absolute,1,1,true
formula.rule.vega.girr Absolute,1,1,true
formula.rule.vega.commodity Absolute,1,1,true
formula.rule.vega.equity Absolute,1,1,true
formula.rule.vega.fx Absolute,1,1,false
formula.rule.vanna.1.csr-non-sec Absolute,1,1,true PnL explain computation rule for first risk factor axis for Vanna and CSR non sec.
formula.rule.vanna.2.csr-non-sec Absolute,1,1,true PnL explain computation rule for second risk factor axis for Vanna and CSR non sec.
formula.rule.vanna.1.csr-sec-non-ctp Absolute,1,1,true PnL explain computation rule for first risk factor axis for Vanna and CSR sec non CTP.
formula.rule.vanna.2.csr-sec-non-ctp Absolute,1,1,true PnL explain computation rule for second risk factor axis for Vanna and CSR sec non CTP.
formula.rule.vanna.1.csr-sec-ctp Absolute,1,1,true PnL explain computation rule for first risk factor axis for Vanna and CSR sec CTP.
formula.rule.vanna.2.csr-sec-ctp Absolute,1,1,true PnL explain computation rule for second risk factor axis for Vanna and CSR sec CTP.
formula.rule.vanna.1.girr Absolute,1,1,true PnL explain computation rule for first risk factor axis for Vanna and GIRR.
formula.rule.vanna.2.girr Absolute,1,1,true PnL explain computation rule for second risk factor axis for Vanna and GIRR.
formula.rule.vanna.1.commodity Relative,1,1,true PnL explain computation rule for first risk factor axis for Vanna and Commodity.
formula.rule.vanna.2.commodity Relative,1,1,true PnL explain computation rule for second risk factor axis for Vanna and Commodity.
formula.rule.vanna.1.equity Relative,1,1,true PnL explain computation rule for first risk factor axis for Vanna and Equity.
formula.rule.vanna.2.equity Relative,1,1,true PnL explain computation rule for second risk factor axis for Vanna and Equity.
formula.rule.vanna.1.fx Relative,1,1,true PnL explain computation rule for first risk factor axis for Vanna and FX.
formula.rule.vanna.2.fx Relative,1,1,false PnL explain computation rule for second risk factor axis for Vanna and FX.
formula.rule.volga.csr-non-sec Absolute,1,2,true
formula.rule.volga.csr-sec-non-ctp Absolute,1,2,true
formula.rule.volga.csr-sec-ctp Absolute,1,2,true
formula.rule.volga.girr Absolute,1,2,true
formula.rule.volga.commodity Absolute,1,2,true
formula.rule.volga.equity Absolute,1,2,true
formula.rule.volga.fx Absolute,1,2,false
formula.rule.cash.fx FXRelative,1,1,false PnL explain computation rule for cash.
formula.rule.theta.* Absolute,1,1,false PnL explain computation rule for theta.

formula.rule, formula.input and formula.type entry description

The [formula.rule] entries follow this format : formula.rule.sensitivity.riskClass

  • sensitivity field, lowercase.

  • riskClass field, lowercase and the spaces are replaced by -.

  • The sensitivity field can contain the sensitivity metric name (sensitivity_kind) or the sensitivity provided name (sensitivity_name).

The lookup order is the following :

Order Lookup
1 formula.rule.sensitivity_name.riskClass
2 formula.rule.sensitivity_name.*
3 formula.rule.sensitivity_kind.riskClass
4 formula.rule.sensitivity_kind.*

formula.rule content description

note

For the dividend metric, the lookup is first on sensitivity_kind and then on sensitivity_name.

The formula value has the following entries separated by commas: formula,priceFactor,derivativeOrder,interpolation,shift

Entry Position Meaning
formula 1 The keyword defining the used formula.
priceFactor 2 A scale applied to the sensitivity ( sensitivity * priceFactor).
derivativeOrder 3 A number defining the derivative order or the sensitivity, 1 for delta, 2 for gamma.
interpolation 4 true means interpolation of market data is allowed.
shift 5 A shift that is added to the sensitivity ( sensitivity + shift ).

The following formulae are available:

Formula Meaning
Absolute $$ pnl = sensitivity \cdot \frac{ \left ({(quote_T \cdot priceFactor) - (quote_{T-1} \cdot priceFactor)} \right ) ^ {derivativeOrder}}{ derivativeOrder!} $$
Relative $$ pnl = sensitivity \cdot \frac {\left (\frac{quote_T \cdot priceFactor}{quote_{T-1} \cdot priceFactor} - 1 \right ) ^ {derivativeOrder}}{derivativeOrder! } $$
DHS $$ pnl = sensitivity \cdot \frac {\left (\frac{quote_T \cdot priceFactor+shift}{quote_{T-1} \cdot priceFactor+shift} - 1 \right ) ^ {derivativeOrder}}{derivativeOrder! } $$
FXRelative $$pnl = sensitivity \cdot \frac {\left ( 1 - \frac {quote_{T-1} \cdot priceFactor}{quote_T \cdot priceFactor} \right ) ^ {derivativeOrder}}{derivativeOrder!}$$