Class AScalarMarketDataPostProcessor

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor

        com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor.BasicPostProcessorPrefetcher, com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor.TransformationProcedure
    • Constructor Summary

      Constructors 
      Constructor Description
      AScalarMarketDataPostProcessor​(String name, com.quartetfs.biz.pivot.cube.hierarchy.measures.IPostProcessorCreationContext creationContext)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract Double doEvaluate​(com.quartetfs.biz.pivot.ILocation leafLocation, LocalDate asOfDate, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers, List<BiFunction<Double,​Double,​Double>> preInterpolationCalcs, List<BiFunction<Double,​Double,​Double>> postInterpolationCalcs, int[] interpolationOrder, boolean interpolate)  
      Double evaluate​(com.quartetfs.biz.pivot.ILocation leafLocation, Object[] underlyingMeasures)
      There is only one underlying measure here: the Double Sensi Value .
      protected Optional<com.qfs.store.record.IRecordReader> fetchMarketData​(com.qfs.store.IDatastoreVersion datastoreVersion, String marketDataStoreName, LocalDate date, String marketDataSet, String riskFactor, Object[] labels, Object[] dates, List<String> marketDataFields)
      Attempts to fetch a market data record by its key.
      boolean getEnableMDStringDebug()  
      protected Optional<com.qfs.store.record.IRecordReader> getMarketDataRecord​(LocalDate date, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers)
      Method that retrieves the market data for the current day
      protected static com.activeviam.desc.build.ICanStartBuildingMeasures.BuildablePostProcessorBuilder getPostProcessorDescription​(com.activeviam.desc.build.ICanStartBuildingMeasures builder, String pluginKey, String measureName, String underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, int[] interpolationOrder, String interpolationDebugStringIdentifier, String formatter, String folder)
      This will create a PP configuration
      void init​(Properties properties)
      Three custom property needs to be present in the configuration of the post-processor: keyLeafLevels: It's the value representing the key levels: AsOfDate, Risk Factor e.g.
      "AsOfDate@Date@Dates", "RiskFactor@Risk Factor@Risk" * DateInfo: its value is the string representing the date property (either current date or precious date) e.g.
      "currentDate" SensitivityName: its value is the string representing the sensi type, e.g.
      "Delta", "Vega", "Gamma" * MaxFallback days: its value is the string representing the maximum fallback days for previous date market data.
      protected com.quartetfs.fwk.impl.Pair<Double,​String> interpolate​(com.quartetfs.biz.pivot.ILocation location, String marketDataSet, LocalDate asOfDate, String riskFactor, List<BiFunction<Double,​Double,​Double>> preInterpolationCalcs, List<BiFunction<Double,​Double,​Double>> postInterpolationCalcs, int[] interpolationOrder, boolean enableDebugString)
      Return the interpolated value
      protected static com.activeviam.copper.api.CopperMeasure measure​(String pluginKey, com.activeviam.copper.api.CopperMeasure underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, String interpolationDebugStringIdentifier, int[] interpolationOrder)
      This will create a PP configuration
      void setMaturityConverter​(IMaturityConverter maturityConverter)
      Set the implementation of IMaturityConverter
      void setPnLExplainFormulaProvider​(IPnLExplainFormulaProvider provider)
      Set the implementation of IPnLExplainFormulaProvider
      protected LocalDate stepDate​(LocalDate date, boolean first)
      Step the as-of date forward or backwards according to dateProperty.
      • Methods inherited from class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor

        checkPrefetchers, compute, computePrefetchFilter, createPrefetchers, createProcedure, evaluate, initializeUnderlyingMeasures, reduce, setPartitioningLevels, supportsAnalysisLevels
      • Methods inherited from class com.quartetfs.biz.pivot.postprocessing.impl.AAdvancedPostProcessor

        addContextDependency, checkInterruption, checkOutputType, computeNamePath, computeOutputType, createEvaluator, expandResult, getActivePivot, getContext, getContextDependencies, getContinuousQueryHandlerKeys, getCurrentMeasure, getDatastoreVersion, getDerivedContextDependencies, getExpansionProcedure, getGenericOutputType, getMeasuresProvider, getName, getOutputType, getOutputTypeFromGenericClassParameter, getOutputTypeFromProperties, getPrefetchers, getProperties, getQueryCache, getTypeFromClass, handleCircularDependency, handleNotSupportedAnalysisLevels, handleUnknownUnderlyingMeasure, hideEvaluator, initializeContinuousQueryHandlerKeys, removeAnalysisLevelsFromFilter, restrictLocationAnalysisLevels, retrieveAnalysisLevelsToExpand, retrieveNamedPrefetchAggregatesWithAnalysisLevels, retrievePrefetchAggregates, retrievePrefetchAggregatesWithAnalysisLevels, setAggregatedMeasureName, toString
      • Methods inherited from interface com.quartetfs.fwk.types.IExtendedPluginValue

        getType
      • Methods inherited from interface com.quartetfs.biz.pivot.postprocessing.IPostProcessor

        getContextDependencies, getContinuousQueryHandlerKeys, getName, getOutputType, getPrefetchers, getProperties
    • Constructor Detail

      • AScalarMarketDataPostProcessor

        public AScalarMarketDataPostProcessor​(String name,
                                              com.quartetfs.biz.pivot.cube.hierarchy.measures.IPostProcessorCreationContext creationContext)
    • Method Detail

      • getPostProcessorDescription

        protected static com.activeviam.desc.build.ICanStartBuildingMeasures.BuildablePostProcessorBuilder getPostProcessorDescription​(com.activeviam.desc.build.ICanStartBuildingMeasures builder,
                                                                                                                                       String pluginKey,
                                                                                                                                       String measureName,
                                                                                                                                       String underlyingMeasures,
                                                                                                                                       String asOfDateLevel,
                                                                                                                                       String marketDataSetLevel,
                                                                                                                                       String riskFactorLevel,
                                                                                                                                       String riskClassLevel,
                                                                                                                                       String[] primaryLevels,
                                                                                                                                       String[] secondaryLevels,
                                                                                                                                       Integer maxFallbackDays,
                                                                                                                                       String dateInfo,
                                                                                                                                       String sensitivityName,
                                                                                                                                       String marketDataStoreName,
                                                                                                                                       String[] marketDataStoreFields,
                                                                                                                                       BucketType[] bucketTypes,
                                                                                                                                       String tenorAndMaturityDefaultValue,
                                                                                                                                       String moneynessDefaultValue,
                                                                                                                                       int[] interpolationOrder,
                                                                                                                                       String interpolationDebugStringIdentifier,
                                                                                                                                       String formatter,
                                                                                                                                       String folder)
        This will create a PP configuration
        Parameters:
        builder - measure builder
        pluginKey - plugin key
        measureName - Name of the postprocessor
        underlyingMeasures - The underlying measure
        asOfDateLevel - Level containing the asOfSDate
        marketDataSetLevel - Level containing the market data set level
        riskFactorLevel - risk factor level
        riskClassLevel - risk class level
        primaryLevels - primary pillar levels
        secondaryLevels - secondary pillar levels
        maxFallbackDays - max fallback days
        dateInfo - date info
        sensitivityName - sensitivity name
        marketDataStoreName - market data store name
        marketDataStoreFields - market data store fields
        bucketTypes - bucket types
        tenorAndMaturityDefaultValue - default value for tenors and maturities
        moneynessDefaultValue - default value for moneyness
        interpolationDebugStringIdentifier - internal identifier used in the query cache. The keys in the query cache that will be used have the following pattern: measure name + identifier + location
        interpolationOrder - 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 the bucketTypes parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined in bucketTypes 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.
        formatter - formatter
        folder - Folder name of the metric, if not provider aka null measure is invisible
        Returns:
        measure builder
      • measure

        protected static com.activeviam.copper.api.CopperMeasure measure​(String pluginKey,
                                                                         com.activeviam.copper.api.CopperMeasure underlyingMeasures,
                                                                         String asOfDateLevel,
                                                                         String marketDataSetLevel,
                                                                         String riskFactorLevel,
                                                                         String riskClassLevel,
                                                                         String[] primaryLevels,
                                                                         String[] secondaryLevels,
                                                                         Integer maxFallbackDays,
                                                                         String dateInfo,
                                                                         String sensitivityName,
                                                                         String marketDataStoreName,
                                                                         String[] marketDataStoreFields,
                                                                         BucketType[] bucketTypes,
                                                                         String tenorAndMaturityDefaultValue,
                                                                         String moneynessDefaultValue,
                                                                         String interpolationDebugStringIdentifier,
                                                                         int[] interpolationOrder)
        This will create a PP configuration
        Parameters:
        pluginKey - plugin key
        underlyingMeasures - The underlying measure
        asOfDateLevel - Level containing the asOfSDate
        marketDataSetLevel - Level containing the market data set level
        riskFactorLevel - risk factor level
        riskClassLevel - risk class level
        primaryLevels - primary pillar levels
        secondaryLevels - secondary pillar levels
        maxFallbackDays - max fallback days
        dateInfo - date info
        sensitivityName - sensitivity name
        marketDataStoreName - market data store name
        marketDataStoreFields - market data store fields
        bucketTypes - bucket types
        tenorAndMaturityDefaultValue - default value for tenors and maturities
        moneynessDefaultValue - default value for moneyness
        interpolationDebugStringIdentifier - internal identifier used in the query cache. The keys in the query cache that will be used have the following pattern: measure name + identifier + location
        interpolationOrder - 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 the bucketTypes parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined in bucketTypes 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:
        measure builder
      • init

        public void init​(Properties properties)
                  throws com.quartetfs.fwk.QuartetException
        Three custom property needs to be present in the configuration of the post-processor:
        • keyLeafLevels: It's the value representing the key levels: AsOfDate, Risk Factor e.g.
          "AsOfDate@Date@Dates", "RiskFactor@Risk Factor@Risk" *
        • DateInfo: its value is the string representing the date property (either current date or precious date) e.g.
          "currentDate"
        • SensitivityName: its value is the string representing the sensi type, e.g.
          "Delta", "Vega", "Gamma" *
        • MaxFallback days: its value is the string representing the maximum fallback days for previous date market data. By default it is set to 1 e.g.
          "1"
        Specified by:
        init in interface com.quartetfs.biz.pivot.postprocessing.IEvaluator<Double>
        Specified by:
        init in interface com.quartetfs.biz.pivot.postprocessing.IPostProcessor<Double>
        Overrides:
        init in class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor<Double>
        Throws:
        com.quartetfs.fwk.QuartetException
      • evaluate

        public Double evaluate​(com.quartetfs.biz.pivot.ILocation leafLocation,
                               Object[] underlyingMeasures)
        There is only one underlying measure here: the Double Sensi Value .
        Specified by:
        evaluate in interface com.quartetfs.biz.pivot.postprocessing.IEvaluator<Double>
        Specified by:
        evaluate in class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor<Double>
      • getMarketDataRecord

        protected Optional<com.qfs.store.record.IRecordReader> getMarketDataRecord​(LocalDate date,
                                                                                   String marketDataSet,
                                                                                   String riskFactor,
                                                                                   Object[] primaryMembers,
                                                                                   Object[] secondaryMembers)
        Method that retrieves the market data for the current day
        Parameters:
        date - as of date
        marketDataSet - market data set context value
        riskFactor - risk factor
        primaryMembers - primary pillars
        secondaryMembers - secondary pillars
        Returns:
        market data for current day and tenor/maturity
      • fetchMarketData

        protected Optional<com.qfs.store.record.IRecordReader> fetchMarketData​(com.qfs.store.IDatastoreVersion datastoreVersion,
                                                                               String marketDataStoreName,
                                                                               LocalDate date,
                                                                               String marketDataSet,
                                                                               String riskFactor,
                                                                               Object[] labels,
                                                                               Object[] dates,
                                                                               List<String> marketDataFields)
        Attempts to fetch a market data record by its key.
        Parameters:
        datastoreVersion - The datastore version to run the query against.
        marketDataStoreName - The store name.
        date - The as of date.
        marketDataSet - The market data set.
        riskFactor - The risk factor.
        labels - The array of label values.
        dates - The array of date values.
        marketDataFields - The fields to return from the store.
        Returns:
        An optional containing a market data record, if found.
      • stepDate

        protected LocalDate stepDate​(LocalDate date,
                                     boolean first)
        Step the as-of date forward or backwards according to dateProperty.
        Parameters:
        date - input date
        first - is this the first time this is called in a search
        Returns:
        the target date
      • interpolate

        protected com.quartetfs.fwk.impl.Pair<Double,​String> interpolate​(com.quartetfs.biz.pivot.ILocation location,
                                                                               String marketDataSet,
                                                                               LocalDate asOfDate,
                                                                               String riskFactor,
                                                                               List<BiFunction<Double,​Double,​Double>> preInterpolationCalcs,
                                                                               List<BiFunction<Double,​Double,​Double>> postInterpolationCalcs,
                                                                               int[] interpolationOrder,
                                                                               boolean enableDebugString)
        Return the interpolated value
        Parameters:
        location - The input location of the value to interpolate
        marketDataSet - The record to look in
        asOfDate - The current date
        riskFactor - The name of the risk underlying
        preInterpolationCalcs - The functions computed before the interpolation of market data is performed, defined by axis.
        postInterpolationCalcs - The functions computed after the interpolation of market data is performed, defined by axis.
        interpolationOrder - 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 the bucketTypes parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined in bucketTypes 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.
        enableDebugString - 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:
        The interpolated value for the given risk
      • getEnableMDStringDebug

        public boolean getEnableMDStringDebug()