Class PnLExplainFormulaProvider

    • Constructor Detail

      • PnLExplainFormulaProvider

        public PnLExplainFormulaProvider​(org.springframework.core.env.Environment environment)
    • 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 sensitivity
        derivativeOrder - 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 sensitivity
        derivativeOrder - 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 sensitivity
        derivativeOrder - The derivative order of the sensitivity, aka delta = 1, gamma = 2
        shift - 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 interface IPnLExplainFormulaProvider
        Parameters:
        cache - cache
        sensitivityKind - the type of sensitivity delta / gamma /vega / ....
        sensitivityName - sensitivity name
        riskClass - 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 interface IPnLExplainFormulaProvider
        Parameters:
        cache - cache
        sensitivityKind - the type of sensitivity delta / gamma /vega / ....
        sensitivityName - sensitivity name
        riskClass - risk class
        Returns:
        A function that takes as parameter (double sensi, double shift)