Interface IWeightedTailMeasureCalc

  • All Known Implementing Classes:
    WeightedTailMeasureCalc

    public interface IWeightedTailMeasureCalc
    Functions for calculating weighted tail measures. This interface is injected into the post-processors to aid in calculating the Expected Shortfall, Value at Risk, Value at Earning and Expected Tail Gain weighted tail measures.

    Post-processors that expect implementations of this interface to be injected implement the IWeightedTailMeasureCalcAware interface.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      double[] calculateWeights​(int n, double lambda)
      Generates an array of weightings of length equal to the number of scenarios n, based on a Lambda value.
      Integer[] getIndices​(com.quartetfs.biz.pivot.IActivePivot activePivot, com.qfs.store.IDatastoreVersion datastore, IWeightedTailMeasureCalc.CalcType type, com.qfs.vector.IVector pnl, double[] weights, double quantile, boolean isPnlOldestFirst)
      Return an array of the indices in the vector that contribute to the weighted VaR/ES.
      Double getLEstimator​(com.quartetfs.biz.pivot.IActivePivot activePivot, com.qfs.store.IDatastoreVersion datastore, IWeightedTailMeasureCalc.CalcType type, com.qfs.vector.IVector referencePnl, com.qfs.vector.IVector pnl, double[] weights, double quantile, boolean isPnlOldestFirst)
      Calculate the contribution to the VaR, ES, VaE or ETG of the PnL vector for the quantile.
      Double getWeightedTailMeasure​(com.quartetfs.biz.pivot.IActivePivot activePivot, com.qfs.store.IDatastoreVersion datastore, IWeightedTailMeasureCalc.CalcType type, com.qfs.vector.IVector pnl, double[] weights, double quantile, boolean isPnlOldestFirst)
      Calculate the VaR, ES, VaE or ETG of the PnL vector for the quantile.
    • Method Detail

      • getWeightedTailMeasure

        Double getWeightedTailMeasure​(com.quartetfs.biz.pivot.IActivePivot activePivot,
                                      com.qfs.store.IDatastoreVersion datastore,
                                      IWeightedTailMeasureCalc.CalcType type,
                                      com.qfs.vector.IVector pnl,
                                      double[] weights,
                                      double quantile,
                                      boolean isPnlOldestFirst)
        Calculate the VaR, ES, VaE or ETG of the PnL vector for the quantile.
        Parameters:
        activePivot - Active Pivot instance.
        datastore - Datastore version.
        type - "ES", "VaR", "VaE" or "ETG"
        pnl - The PnL vector.
        weights - The weights
        quantile - The quantile for the ES, VaR or VaE between 0 and 1 (equals 1 minus the confidence level).
        isPnlOldestFirst - flag to indicate if the PnL values in the PnL vector are present from with the oldest value at index 0 or the most recent value at index 0. The flag is set to 'true' if the oldest PnL value is present at index 0 and to 'false' if the most recent PnL value is present at index 0.
        Returns:
        The tail measure (i.e. VaR, ES or VaE value of the vector for the quantile).
      • calculateWeights

        double[] calculateWeights​(int n,
                                  double lambda)
        Generates an array of weightings of length equal to the number of scenarios n, based on a Lambda value.
        Parameters:
        n - index
        lambda - value
        Returns:
        array of weightings.
      • getIndices

        Integer[] getIndices​(com.quartetfs.biz.pivot.IActivePivot activePivot,
                             com.qfs.store.IDatastoreVersion datastore,
                             IWeightedTailMeasureCalc.CalcType type,
                             com.qfs.vector.IVector pnl,
                             double[] weights,
                             double quantile,
                             boolean isPnlOldestFirst)
        Return an array of the indices in the vector that contribute to the weighted VaR/ES.
        Parameters:
        activePivot - Active Pivot instance.
        datastore - Datastore version.
        type - "ES", "VaR", "VaE" or "ETG"
        pnl - The PnL vector.
        weights - the weights
        quantile - The quantile for the VaR, between 0 and 1 (equals 1 minus the confidence level).
        isPnlOldestFirst - flag to indicate if the PnL values in the PnL vector are present from with the oldest value at index 0 or the most recent value at index 0. The flag is set to 'true' if the oldest PnL value is present at index 0 and to 'false' if the most recent PnL value is present at index 0.
        Returns:
        The array of vector indices.
      • getLEstimator

        Double getLEstimator​(com.quartetfs.biz.pivot.IActivePivot activePivot,
                             com.qfs.store.IDatastoreVersion datastore,
                             IWeightedTailMeasureCalc.CalcType type,
                             com.qfs.vector.IVector referencePnl,
                             com.qfs.vector.IVector pnl,
                             double[] weights,
                             double quantile,
                             boolean isPnlOldestFirst)
        Calculate the contribution to the VaR, ES, VaE or ETG of the PnL vector for the quantile.
        Parameters:
        activePivot - Active Pivot instance.
        datastore - Datastore version.
        type - "ES", "VaR", "VaE" or "ETG"
        referencePnl - The aggregate PnL vector at the reference level.
        pnl - The PnL vector for the current sub-portfolio.
        weights - The weights
        quantile - The quantile for the ES, VaR or VaE between 0 and 1 (equals 1 minus the confidence level).
        isPnlOldestFirst - flag to indicate if the PnL values in the PnL vector are present from with the oldest value at index 0 or the most recent value at index 0. The flag is set to 'true' if the oldest PnL value is present at index 0 and to 'false' if the most recent PnL value is present at index 0.
        Returns:
        The tail measure (i.e. VaR, ES or VaE value of the vector for the quantile).